we have a nagios monitoring system already running and I was after monitor our vmware datastores using the following plugin
I installed vmware cli and tested with no issues:
[root@nrpe-relay ~]# /usr/lib64/nagios/plugins/check_vmfs.sh -C /usr/lib64/nagios/plugins/vmware_esxi_conf.txt -S 192.168.20.241 -V /vmfs/volumes/LocalSlot45S6 -w 75 -c 90 -u Gb
WARNING - /vmfs/volumes/LocalSlot45S6 - total: 931.25 Gb - used: 800.95 Gb (86%)- free: 130.29 Gb (14%) | /vmfs/volumes/LocalSlot45S6=800.95Gb;698.43;838.12;;931.25
[root@nrpe-relay ~]# ps auxww|grep nrpe
nagios 1463 0.0 0.1 41468 1364 ? Ss 21:24 0:00 nrpe -c /etc/nagios/nrpe.cfg -d
root 2261 0.0 0.0 103304 876 pts/0 S+ 22:00 0:00 grep nrpe
However I am not getting same value when the command runs remotely:
[root@nagios nagios]# /usr/lib64/nagios/plugins/check_nrpe -H <hostname> -c 'check_datastore_LocalSlot45S6'
CRITICAL -
This is what I have in my cfg file
command[check_datastore_LocalSlot45S6]=/usr/lib64/nagios/plugins/check_vmfs.sh -C /usr/lib64/nagios/plugins/vmware_esxi_conf.txt -S 192.168.20.241 -V /vmfs/volumes/LocalSlot45S6 -w 75 -c 90 -u Gb
and my server cfg:
define service{
use generic-service
host_name <hostname>
service_description datastore-LocalSlot45S6
check_command check_nrpe!check_datastore_LocalSlot45S6
}
This is what I can see from /var/log/message:
nagios nagios: EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;<hostname>;datastore-LocalSlot1-2S3;1441798845
QUESTION: Anyone has any clue about where the problem is? or how can I trace down this issue?
Best Answer
Your problem is that the NRPE daemon runs as the user
nagios
, and that user doesn't have permission to run the command in question.You will either have to open up permissions so that the user can run it (incidentally, your last comment suggests you're not paying complete attention to the output; it is the file
/usr/lib64/nagios/plugins/check_vmfs.err
on which permission has been denied, notcheck_vmfs.sh
), or modify the NRPEd to use passwordless sudo, with egcoupled with a
sudoers
entry similar toIf you take the latter route, you will need also to have
in your
sudoers
file, if it is not already there.