Page 1 of 1

Plugin check_vmware_api.pl error

Posted: Tue Apr 12, 2016 4:10 am
by manburra
Hi Guys,

I am testing check_vmware_api.pl plugin but it is shows me an error, if I test the plugin looks like is working but when i configure the command file and added the service to the host, it shows this error on nagios gui.

Error:
Usage: check_vmware_api.pl -D

Plugin test:

root@NagiosCore4:/usr/local/nagios/libexec# ./check_vmware_api.pl -H 192.168.160.xx -u xxxx -p xxxx -l cpu
CHECK_VMWARE_API.PL OK - cpu usage=1508.00 MHz (2.90%) | cpu_usagemhz=1508.00MHz;; cpu_usage=2.90%;;


Command Define:

define command{
command_name check_vmware_api_host_cpu_usage
command_line $USER1$/check_vmware_api.pl -H $HOSTADDRESS$ -u $USER11$ -p $USER12$ -l cpu -s usage -w $ARG1$ -c $ARG2$
}


Service Define

# check_vmware_api.pl

define service{

use local-service
host_name c1b1
service_description CPU_USAGE
check_command check_vmware_api_host_cpu_usage! -H 192.168.160.xx -u xxxx -p xxxx -l cpu
}



I need some help on this.

Br,

Re: Plugin check_vmware_api.pl error

Posted: Tue Apr 12, 2016 2:54 pm
by jomann
The defined command is using $ARGx$ and $USERx$ ... which means that your check command should be more along the lines of

check_command check_vmware_api_host_cpu_usage!50!60

Which would give $ARG1$ = 50 and $ARG2$ = 60 ... you may want to read the documentation on how creating check commands works here https://assets.nagios.com/downloads/nag ... acros.html

Re: Plugin check_vmware_api.pl error

Posted: Tue Apr 12, 2016 3:02 pm
by scottwilkerson
If you password has special chars in it, this could cause a problem, you may want to consider quoting the $USER11$ & $USER12$ vars, like so:

Code: Select all

define command{
command_name check_vmware_api_host_cpu_usage
command_line $USER1$/check_vmware_api.pl -H $HOSTADDRESS$ -u '$USER11$' -p '$USER12$' -l cpu -s usage -w $ARG1$ -c $ARG2$
}