[Nagiosplug-help] Xen VM Monitor plugin problem

Thomas Guyot-Sionnest dermoth at aei.ca
Thu Feb 14 06:07:46 CET 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 13/02/08 11:20 AM, Hydropone wrote:
> Thomas Guyot-Sionnest a écrit :
>> On 08/02/08 10:39 AM, Hydropone wrote:
>>> Hi all,
>>> I just found this cool plugin :
>>> http://www.novell.com/communities/node/2640/xen-virtual-machine-monitor-plugin-nagios
>>
>>> to monitor VM on a Xen Host.
>>> I followed the readme (and add user "nagios" to /etc/sudoers) ...
>>> The plugin seems to work correctly on the Xen Host :
>>> [root at host plugins]# su nagios
>>> sh-3.1$ /usr/lib64/nagios/plugins/check_xen -w 0 -c 0
>>> OK: Xen Hypervisor "host" is running Xen VMs: testvm
>>> But on the nagios server, it report a wrong result :
>>> root at nagios~ #/usr/lib/nagios/plugins/check_nrpe -H host -c check_xen
>>> Critical Xen VMs Usage - Total NB: 0 - detected VMs:
>>> What did i miss ?
>> Make sure:
>>
>> 1. Check_nrpe is runnig as the nagios user (it the user even created?)
> 
> Yes :
> 
> ps aux | grep nrpe
> 
> nagios   21896  0.0  0.1  39876  1040 ?  Ss Feb08 0:00 nrpe -c
> /etc/nagios/nrpe.cfg -d
> 
> and
> 
> # cat /etc/passwd | grep nagios
> nagios:x:100:101:nagios:/var/log/nagios:/bin/sh
> 
>> 2. The nrpe check definition includes the sudo command
> 
> Yes...
> 
>> RUNNING=$(sudo /usr/sbin/xm list | awk '!/[DN]/  {print $1 }')
>> NBVMS=$(echo $RUNNING | wc -w)
>> HNAME=$(hostname)

I was thinking you'd be running the sudo command from the NRPE check
which would catch sudo errors differently. In your code you don't check
for the return code from your main command. Something like this would be
better:

RUNNING=$(sudo /usr/sbin/xm list)
if [ $? -ne 0 ]; then
  echo "Command failled..."
  exit 3
fi
NBVMS=$(echo $RUNNING| awk '!/[DN]/  {print $1 }'| wc -w)


Anyways, your problem could also be that Sudo refuses to run without a
controlling TTY. This is something you can change in the sudoers config
file.

Hope this helps...

Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHs8yh6dZ+Kt5BchYRAqrTAKDRZmFpZLfcQnNMLhlBxj6v1fHUjACfbkMG
vJIr+XZP+UIxh3I3+KlsiME=
=p1w6
-----END PGP SIGNATURE-----




More information about the Help mailing list