Re: [Nagios-users] NRPE in FreeBSD jail

2007-01-27 Thread Dan Langille
On 27 Jan 2007 at 22:07, Andy Shellam (Mailing Lists) wrote:

> I've been struggling with this for the last 2 hours and I cannot work 
> out where it's going wrong.
> I have a Nagios 2.7 server talking to an NRPE 2.6 client.
> 
> The Nagios 2.7 server is running FreeBSD as does the NRPE client - 
> however the NRPE client is being run in a FreeBSD jail (this is a hosted 
> system which I have no control of outside of the jail.)
> I'm hoping I've simply missed something simple.
> 
> When I run from the console of the NRPE client, as the Nagios user:
> 
> $ /usr/local/bin/sudo /usr/local/nagios/libexec/check_swap -w 25% -c 10%
> SWAP OK - 91% free (7442 MB out of 8192 MB) |swap=7442MB;2048;819;0;8192
> $

You are you issuing

> 
> When I run the check from the Nagios server:
> 
> sudo -u nagios /usr/local/nagios/libexec/check_nrpe -H 
> mackay.mailnetwork.co.uk -c check_swap
> NRPE: Unable to read output
> 
> If I try an invalid command:
> 
> sudo -u nagios /usr/local/nagios/libexec/check_nrpe -H 
> mackay.mailnetwork.co.uk -c check_swapNOTEXIST
> NRPE: Command 'check_swapNOTEXIST' not defined
> 
> So, as you can see, it is reaching NRPE fine (and I presume the SSL is 
> working correctly.)
> I've tried starting up NRPE without SSL (-n), and ditto on the Nagios 
> server - still the same error.
> I've also tried setting allow_weak_random_seed=1, same error.
> 
> I'm guessing it has something to do with NRPE not sending the output 
> data from the plugin to the correct stream, and as I don't know much 
> about FreeBSD jails, I don't know whether stdin/out works as normal.
> 
> As you can see, I've also set debug=1, but don't get anything in my log 
> files other than "daemon starting up."
> 
> Is anyone else running NRPE inside a jail?  Or can point out something 
> obvious I'm missing!?  Or how to get more debug info?
> 
> Thanks
> 
> Andy.
> 
> ---
> 
> My nrpe.cfg file:
> 
> pid_file=/var/run/nrpe.pid
> server_port=5666
> #server_address=192.168.1.1
> nrpe_user=nagios
> nrpe_group=localservice
> #allowed_hosts=127.0.0.1,10.100.9.201

Why commented out?

> dont_blame_nrpe=0
> command_prefix=/usr/local/bin/sudo
> debug=1
> command_timeout=60
> connection_timeout=300
> #allow_weak_random_seed=1
> 
> command[check_swap]=/usr/local/nagios/libexec/check_swap -w 25% -c 10%

You issued an sudo above, yet the command here does not use sudo.

I've seen this error before, and recently.  Usually it was a 
permissions issue.  For some readon nrpe is unable to execute the 
command.  Perhaps it is this sudo issue.

A side note: sometimes it helps to add wrapper function.  All the 
wrapper function does it a cd /usr/local/nagios/libexec and then runs 
the command you would normally specify in nrpe.cfg

hth

-- 
Dan Langille : Software Developer looking for work
my resume: http://www.freebsddiary.org/dan_langille.php
PGCon - The PostgreSQL Conference - http://www.pgcon.org/



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null


Re: [Nagios-users] NRPE: Unable to read output

2007-01-15 Thread Dan Langille
On 16 Jan 2007 at 2:06, Arno Lehmann wrote:

> Hi,
> 
> On 1/16/2007 1:26 AM, Dan Langille wrote:
> > On 16 Jan 2007 at 1:12, Arno Lehmann wrote:
> > 
> > 
> >>Hi,
> >>
> >>On 1/16/2007 12:40 AM, Dan Langille wrote:
> >>
> >>>On 15 Jan 2007 at 18:08, Dan Langille wrote:
> >>>
> >>>
> >>>
> >>>>Hi folks,
> >>>>
> >>>>I'm using nrpe 1.9 on FreeBSD 6.x and I'm failing to get a remote 
> >>>>script to work.  It seems that no perl script works, but I can get 
> >>>>compiled plug-ins to work.
> >>
> >>...
> >>
> >>>My thanks to bernardl for the repeated questions about what I was 
> >>>doing.  The solution: write a wrapper which does a cd.
> >>>
> >>># cat check_raid_dell_wrapper
> >>>#!/bin/sh
> >>>cd /usr/local/libexec/nagios
> >>>perl check_raid_dell
> >>>
> >>>Then refer to the wrapper in the nrpe.cfg on the remote server:
> >>>
> >>># grep dell /usr/local/etc/nrpe.cfg
> >>>command[check_raid_dell]=/usr/local/libexec/nagios/check_raid_dell_wra
> >>>pper
> >>
> >>Interesting. Should be possible to invoke the check script directly, 
> >>though. You can call it with its path, it should have a hash bang line, 
> >>and the necessary inclusion of utils.pm could be handled from inside the 
> >>script. Which, incidentially, is how the standard plugins I know work :-)
> >>
> >>But a wrapper is often the solution to plugin problems...
> > 
> > 
> > 
> > We write that, with the full path.  That is what led us to the 
> > wrapper solution:
> > 
> > # su -m -c nagios nagios c 
> > "/usr/local/libexec/nagios/check_raid_dell"
> > Can't locate utils.pm in @INC (@INC contains: nagios 
> > /usr/local/lib/perl5/5.8.8/BSDPAN 
> > /usr/local/lib/perl5/site_perl/5.8.8/mach 
> > /usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl 
> > /usr/local/lib/perl5/5.8.8/mach /usr/local/lib/perl5/5.8.8 .) at 
> > /usr/local/libexec/nagios/check_raid_dell line 17.
> > BEGIN failed--compilation aborted at 
> > /usr/local/libexec/nagios/check_raid_dell line 17.
> > #
> > 
> 
> Well, I'm not a perl guru, but in the standard plugins I looked at I 
> have a line "use lib "/usr/local/nagios2/libexec"  ;" which looks like 
> it is important for cases like yours...

$ grep "use lib" check_*
check_breeze:use lib "nagios" ;
check_disk_smb:use lib "nagios" ;
check_file_age:use lib "nagios";
check_flexlm:use lib "nagios";
check_ifoperstatus:use lib "nagios" ;
check_ifstatus:use lib "nagios" ;
check_ircd:use lib "nagios";
check_mailq:use lib  "nagios";
check_rpc:use lib "nagios";
check_wave:use lib "nagios";

Yep...  How unfortunate that the one I chose to base my plugin on is 
check_file_age, which does not have this.


-- 
Dan Langille : Software Developer looking for work
my resume: http://www.freebsddiary.org/dan_langille.php
PGCon - The PostgreSQL Conference - http://www.pgcon.org/



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null


Re: [Nagios-users] NRPE: Unable to read output

2007-01-15 Thread Dan Langille
On 16 Jan 2007 at 1:12, Arno Lehmann wrote:

> Hi,
> 
> On 1/16/2007 12:40 AM, Dan Langille wrote:
> > On 15 Jan 2007 at 18:08, Dan Langille wrote:
> > 
> > 
> >>Hi folks,
> >>
> >>I'm using nrpe 1.9 on FreeBSD 6.x and I'm failing to get a remote 
> >>script to work.  It seems that no perl script works, but I can get 
> >>compiled plug-ins to work.
> ...
> > My thanks to bernardl for the repeated questions about what I was 
> > doing.  The solution: write a wrapper which does a cd.
> > 
> > # cat check_raid_dell_wrapper
> > #!/bin/sh
> > cd /usr/local/libexec/nagios
> > perl check_raid_dell
> > 
> > Then refer to the wrapper in the nrpe.cfg on the remote server:
> > 
> > # grep dell /usr/local/etc/nrpe.cfg
> > command[check_raid_dell]=/usr/local/libexec/nagios/check_raid_dell_wra
> > pper
> 
> Interesting. Should be possible to invoke the check script directly, 
> though. You can call it with its path, it should have a hash bang line, 
> and the necessary inclusion of utils.pm could be handled from inside the 
> script. Which, incidentially, is how the standard plugins I know work :-)
> 
> But a wrapper is often the solution to plugin problems...


We write that, with the full path.  That is what led us to the 
wrapper solution:

# su -m -c nagios nagios c 
"/usr/local/libexec/nagios/check_raid_dell"
Can't locate utils.pm in @INC (@INC contains: nagios 
/usr/local/lib/perl5/5.8.8/BSDPAN 
/usr/local/lib/perl5/site_perl/5.8.8/mach 
/usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl 
/usr/local/lib/perl5/5.8.8/mach /usr/local/lib/perl5/5.8.8 .) at 
/usr/local/libexec/nagios/check_raid_dell line 17.
BEGIN failed--compilation aborted at 
/usr/local/libexec/nagios/check_raid_dell line 17.
#


-- 
Dan Langille : Software Developer looking for work
my resume: http://www.freebsddiary.org/dan_langille.php
PGCon - The PostgreSQL Conference - http://www.pgcon.org/



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null


Re: [Nagios-users] NRPE: Unable to read output

2007-01-15 Thread Dan Langille
On 15 Jan 2007 at 18:08, Dan Langille wrote:

> Hi folks,
> 
> I'm using nrpe 1.9 on FreeBSD 6.x and I'm failing to get a remote 
> script to work.  It seems that no perl script works, but I can get 
> compiled plug-ins to work.
> 
> The result is, which invoked on the nagios server is:
> 
> $ ./check_nrpe -H app09 -c check_raid_dell
> NRPE: Unable to read output
> 
> On the remote machine, app09, I get:
> 
> $ perl check_raid_dell
> RAID_DELL CRITICAL: RAID is critical.
> $
> 
> I know that a value is being returned:
> 
> $ echo $?
> 2
> $
> 
> It's as if the remote script is inappropriate for use with nrpe.  I 
> can get other scripts to work:
> 
> 
> $ ./check_nrpe -H app09 -c check_users
> USERS OK - 1 users currently logged in |users=1;5;10;0
> 
> $ ./check_nrpe -H app09 -c check_load
> OK - load average: 0.00, 0.05, 0.06|load1=0.003;15.000;30.000;0; 
> load5=0.046;10.000;25.000;0; load15=0.061;5.000;20.000;0;
> 
> 
> FWIW, both of the above scripts are binaries:
> 
> $ file check_load check_users check_raid_dell
> check_load:  ELF 64-bit LSB executable, AMD x86-64, version 1 
> (FreeBSD), dynamically linked (uses shared libs), stripped
> check_users: ELF 64-bit LSB executable, AMD x86-64, version 1 
> (FreeBSD), dynamically linked (uses shared libs), stripped
> check_raid_dell: perl script text
> 
> I have confirmed that the user that nrpe is running as can execute 
> the command:
> 
> # su -m -c nagios nagios -c "cd /usr/local/libexec/nagios && perl 
> check_raid_dell"
> RAID_DELL CRITICAL: RAID is critical.
> 
> Ideas?  Suggestions?  Plans?

My thanks to bernardl for the repeated questions about what I was 
doing.  The solution: write a wrapper which does a cd.

# cat check_raid_dell_wrapper
#!/bin/sh
cd /usr/local/libexec/nagios
perl check_raid_dell

Then refer to the wrapper in the nrpe.cfg on the remote server:

# grep dell /usr/local/etc/nrpe.cfg
command[check_raid_dell]=/usr/local/libexec/nagios/check_raid_dell_wra
pper

NOTE the use of the wrapper path

Restart nrpe on the remote box and then test it on the server:


$ ./check_nrpe -H app09 -c check_raid_dell
RAID_DELL CRITICAL: RAID is critical.

\o/

cheers


-- 
Dan Langille : Software Developer looking for work
my resume: http://www.freebsddiary.org/dan_langille.php
PGCon - The PostgreSQL Conference - http://www.pgcon.org/



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null


[Nagios-users] NRPE: Unable to read output

2007-01-15 Thread Dan Langille
Hi folks,

I'm using nrpe 1.9 on FreeBSD 6.x and I'm failing to get a remote 
script to work.  It seems that no perl script works, but I can get 
compiled plug-ins to work.

The result is, which invoked on the nagios server is:

$ ./check_nrpe -H app09 -c check_raid_dell
NRPE: Unable to read output

On the remote machine, app09, I get:

$ perl check_raid_dell
RAID_DELL CRITICAL: RAID is critical.
$

I know that a value is being returned:

$ echo $?
2
$

It's as if the remote script is inappropriate for use with nrpe.  I 
can get other scripts to work:


$ ./check_nrpe -H app09 -c check_users
USERS OK - 1 users currently logged in |users=1;5;10;0

$ ./check_nrpe -H app09 -c check_load
OK - load average: 0.00, 0.05, 0.06|load1=0.003;15.000;30.000;0; 
load5=0.046;10.000;25.000;0; load15=0.061;5.000;20.000;0;


FWIW, both of the above scripts are binaries:

$ file check_load check_users check_raid_dell
check_load:  ELF 64-bit LSB executable, AMD x86-64, version 1 
(FreeBSD), dynamically linked (uses shared libs), stripped
check_users: ELF 64-bit LSB executable, AMD x86-64, version 1 
(FreeBSD), dynamically linked (uses shared libs), stripped
check_raid_dell: perl script text

I have confirmed that the user that nrpe is running as can execute 
the command:

# su -m -c nagios nagios -c "cd /usr/local/libexec/nagios && perl 
check_raid_dell"
RAID_DELL CRITICAL: RAID is critical.

Ideas?  Suggestions?  Plans?

-- 
Dan Langille : Software Developer looking for work
my resume: http://www.freebsddiary.org/dan_langille.php
PGCon - The PostgreSQL Conference - http://www.pgcon.org/

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null


Re: [Nagios-users] setting service visibility

2007-01-11 Thread Dan Langille
On 11 Jan 2007 at 11:12, Jesús Oliván wrote:

> Hi!
> 
> is it possible to allow some users (or group of users) to see a service 
> and don't allow other users to see it?

Failing other solutions...

By default users can see only those hosts/services for which they are 
contacts.  See authorized_for_all_service in cgi.cfg

Does that help?
-- 
Dan Langille : Software Developer looking for work
my resume: http://www.freebsddiary.org/dan_langille.php
PGCon - The PostgreSQL Conference - http://www.pgcon.org/



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null


Re: [Nagios-users] FreeBSD could not get group entry for Nagios

2007-01-09 Thread Dan Langille
On 9 Jan 2007 at 22:36, Andy Shellam (Mailing Lists) wrote:

> Hi Dan,
> 
> Thanks for the reply (answers inline below)
> 
> Dan Langille wrote:
> > Did you install via ports?
> >   
> 
> No - downloaded 2.6 and compiled from source.
> > Are you missing this?
> >
> > $ grep nagios /etc/group
> > nagios:*:1005:
> >   
> 
> I don't think so - I configured Nagios with:
> 
> ./configure --prefix=/usr/local/nagios --with-cgiurl=/nagios/cgi-bin 
> --with-htmurl=/nagios --with-nagios-user=nagios 
> --with-nagios-group=localservice --with-command-group=webservice
> 
> so this should say the Nagios group is "localservice" - right?
> The Nagios user has "localservice" set as it's default group, and it's 
> also a member of "webservice" - the command group.

Sorry, I don' t know.  I always use the port, and let it do what it 
does.  :(  By using the port, it trivializes upgrades and removals,  
and makes security notices easier (e.g. security/portaudit).

cd /usr/port/net-mgtm/nagios
make install

pretty easy... and if you need/want special config items, you can 
still do them, plus you get the benefits of packaging.

My recommendation: remove what you installed, and use the port.

-- 
Dan Langille : Software Developer looking for work
my resume: http://www.freebsddiary.org/dan_langille.php
PGCon - The PostgreSQL Conference - http://www.pgcon.org/



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null


Re: [Nagios-users] FreeBSD could not get group entry for Nagios

2007-01-09 Thread Dan Langille
On 9 Jan 2007 at 22:00, Andy Shellam (Mailing Lists) wrote:

> I'm testing Nagios out on a FreeBSD 6.1 system, and am getting a warning 
> about Nagios' group entry when I run a config file check - will this 
> cause any problems?

Did you install via ports?

> Nagios 2.6
> Copyright (c) 1999-2006 Ethan Galstad (http://www.nagios.org)
> Last Modified: 11-27-2006
> License: GPL
> 
> Reading configuration data...
> 
> Warning: Could not get group entry for 'nagios'
> ---
> 
> Passwd entry:
> nagios:*:1002:1001:Nagios Service Account:/home/nagios:/usr/local/bin/bash
> 
> Group file entry:
> localservice:*:1001:

Are you missing this?

$ grep nagios /etc/group
nagios:*:1005:
-- 
Dan Langille : Software Developer looking for work
my resume: http://www.freebsddiary.org/dan_langille.php
PGCon - The PostgreSQL Conference - http://www.pgcon.org/



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null


[Nagios-users] FreeBSD port of fruity

2007-01-08 Thread Dan Langille
There is now a FreeBSD port for fruity:

   http://www.freshports.org/net-mgmt/fruity/

fruity?  A PHP based web-frontend to your Nagios configuration.

   http://www.freshports.org/net-mgmt/fruity/

-- 
Dan Langille : Software Developer looking for work
my resume: http://www.freebsddiary.org/dan_langille.php
PGCon - The PostgreSQL Conference - http://www.pgcon.org/



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null