check_proliant.py

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
vvz
Posts: 187
Joined: Wed Oct 30, 2013 5:15 pm

check_proliant.py

Post 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
vvz
Posts: 187
Joined: Wed Oct 30, 2013 5:15 pm

Re: check_proliant.py

Post 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?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: check_proliant.py

Post 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
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
vvz
Posts: 187
Joined: Wed Oct 30, 2013 5:15 pm

Re: check_proliant.py

Post 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
vvz
Posts: 187
Joined: Wed Oct 30, 2013 5:15 pm

Re: check_proliant.py

Post 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?
vvz
Posts: 187
Joined: Wed Oct 30, 2013 5:15 pm

Re: check_proliant.py

Post 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
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: check_proliant.py

Post by abrist »

Don't you need sudo in order to run the /sbin/hpasmcli binary?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
vvz
Posts: 187
Joined: Wed Oct 30, 2013 5:15 pm

Re: check_proliant.py

Post 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
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_proliant.py

Post 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.
Locked