[Nagiosplug-help] Xen VM Monitor plugin problem

Hydropone hydropone at free.fr
Thu Feb 14 16:43:57 CET 2008


Thomas Guyot-Sionnest a écrit :
> 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.
> 

You're right !

The code you provided show me the error with the sudo command, and in
sudoers config, "require tty" was enabled...

Thanks a much for your help,

--
H.




More information about the Help mailing list