Page 1 of 1

check_proliant.py

Posted: Fri Nov 15, 2013 12:25 pm
by vvz
Hello!
I have nagios installed on CentOS6 and nrpe and plugins on CentOS5
everything looks good and I get info from other plugins, exept check_proliant.py
I added nagios ALL=(ALL) NOPASSWD:/sbin/hpasmcli to sudoers and ! tty required line also
I'm not able to get respond from this plugin
nagios.log file says
[1384533721] SERVICE NOTIFICATION: nagiosadmin;callme-lekki-billing2;Temperature;CRITICAL;notify-service-by-email;CHECK_NRPE: Socket timeout after 10 seconds.
when I try to make $ sudo ./check_proliant.py --type=fan on client machine with nrpe and check_proliant installed I got this output
CRITICAL: Fan #1 Status=No. Fan #1 Speed=-. Fan #1 Redundant=N/A. Fan #2 Status=No. Fan #2 Speed=-. Fan #2 Redundant=N/A.
Before i deployed everything to real world I tested this in lab using Ubuntu as nagios and CentOS6 as NRPE, and everything was good
May be I forget something to change in privileges or nagios user permissions? Shall I change nagios user shell for /bin/bash/ on my server?
As I said works everything but this plugin
thank you

Re: check_proliant.py

Posted: Fri Nov 15, 2013 2:38 pm
by vvz
I have to add to my post that - when remote host checked with check_nrpe -H address - it returns NRPEv2.14

but when I start nagios in nagios.cfg I got let's say for host with the name - billing1
[1384543594] INITIAL HOST STATE: callme-lekki-billing1;UP;HARD;1;
[1384543594] INITIAL SERVICE STATE: callme-lekki-billing1;FANs status;CRITICAL;HARD;3;CHECK_NRPE: Socket timeout after 20 seconds. # I changed default timeout to 20 sec

for another host billing2 the timeout time was not changed
[1384543594] INITIAL HOST STATE: callme-lekki-billing2;UP;HARD;1;
[1384543594] INITIAL SERVICE STATE: callme-lekki-billing2;FANs status;CRITICAL;HARD;3;Connection refused by host
for both hosts i put nagios-server IP in allowed_hosts
any ideas?

Re: check_proliant.py

Posted: Fri Nov 15, 2013 2:39 pm
by abrist
What does your python script look like? You don't want to sudo the script, just the necessary command in the script. Can you run it as user nagios on the remote?

Code: Select all

su nagios
cd /usr/local/nagios/libexec
./check_proliant.py --type=fan

Re: check_proliant.py

Posted: Fri Nov 15, 2013 3:02 pm
by vvz
I put command as root because on default nagios user on client machine does not have shell
$ sudo ./check_proliant.py --type=fan
[sudo] password for vassiliy:
OK: 8 fans normal.
cat /etc/passwd | grep nagios
nagios:x:103:105::/var/spool/nagios:/sbin/nologin
shall i add shell to nagios user on remote machine? manual does not say that

Re: check_proliant.py

Posted: Fri Nov 15, 2013 3:12 pm
by vvz
actually i changed shell for nagios user and run script with the result
./check_proliant.py --type=fan
UNKNOWN: Error in pexpect while running hpasmcli
inside the script i have next strings
HPASMCMD = "sudo /sbin/hpasmcli"
HPASM_PROMPT = "hpasmcli>"
script actually calls /bin/hpasmcli command to grab info
may be just delete "sudo" from script?

Re: check_proliant.py

Posted: Fri Nov 15, 2013 3:21 pm
by vvz
I.ve tried to delete sudo from script - does not help to start script under nagios user
but i still can run script successfully as root

Re: check_proliant.py

Posted: Fri Nov 15, 2013 3:39 pm
by abrist
Don't you need sudo in order to run the /sbin/hpasmcli binary?

Re: check_proliant.py

Posted: Fri Nov 15, 2013 4:23 pm
by vvz
actually /sbin/hpasmcli has root:root as owner but it has to be run by check_proliant.py
which is also has root:root

that the reason to edit visudo and add nagios user there

Re: check_proliant.py

Posted: Mon Nov 18, 2013 11:01 am
by slansing
check_proliant should not be owned by root:root, it should be nagios:nagios, but I think you want to add the nagios user in the sudoers file so that it can call that binary.