Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm using plugin which gives me warning or crtis with established connections. If I run it on local machine it gives:

*root@graber:/usr/lib/nagios/plugins# ./check_connections -w 1 -c 5 -C sshd
CRITICAL  Established connections: 6*

I know, I run as root. But:

Rights to the file:

root@graber:/usr/lib/nagios/plugins# ls -all check_connections
-rwxr-xr-x 1 nagios nagios 5459 2012-07-06 10:19 check_connections

/etc/sudoers:

root@graber:/usr/lib/nagios/plugins# cat /etc/sudoers
Defaults        env_reset
root    ALL=(ALL:ALL) ALL
%admin ALL=(ALL) ALL
nagios ALL=(ALL) NOPASSWD: /usr/bin/lsof
nagios ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/

/etc/nagios/nrpe.cfg:

*nrpe_user=nagios
nrpe_group=nagios*
*dont_blame_nrpe=1*
*command_prefix=/usr/bin/sudo
command[check_connections]=/usr/lib/nagios/plugins/check_connections -w 1 -c 5 -C sshd*

log from remote:

*2012-07-06T11:12:49+02:00 graber nrpe[25928]: Handling the connection...
2012-07-06T11:12:49+02:00 graber nrpe[25928]: Host address is in allowed_hosts
2012-07-06T11:12:49+02:00 graber nrpe[25928]: Host is asking for command 'check_connections' to be run...
2012-07-06T11:12:49+02:00 graber nrpe[25928]: Running command: /usr/lib/nagios/plugins/check_connections -w 1 -c 5 -C sshd
2012-07-06T11:19:11+02:00 graber nrpe[26100]: Return Code: 2, Output: NRPE: Unable to read output*

Why is this happening? I'm out of ideas, I've searched google for 2 days now :)

share|improve this question
    
I'm not sure right now, but shouldn't that line in /etc/sudoers be /usr/lib/nagios/plugins/* ? –  faker Jul 6 '12 at 10:32
    
well I tried with *, also tried adding path to the file (/usr/lib/nagios/plugins/check_connections). No effect whatsoever –  Włodzimierz Jul 6 '12 at 10:43
    
Seems like a permissions problem. How does check_connections work? Does it read or write to some file or device as root? –  linux with a hammer Jul 6 '12 at 14:48
    
nope. it reads number of established connections and displays the outcome as (as example of course) "WARNING Established connections 3" as seen above. No write on disk take place –  Włodzimierz Jul 9 '12 at 6:52
    
it works! The problem was with absence of utils.pm in certain locations. All I had to do is to run script with sudo -u nagios and check output. thanks for help! –  Włodzimierz Jul 9 '12 at 8:43

1 Answer 1

it works! The problem was with absence of utils.pm in certain locations. All I had to do is to run script with sudo -u nagios and check output. thanks for help!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.