Page 1 of 2

check_vmware_api.pl error

Posted: Fri Oct 24, 2014 12:51 am
by lee62817
check_vmware_api.pl error

check_vmware_api.pl Website:
http://www.op5.org/community/plugin-inventory/plugins

my os:centos7
my nagios:4.08



i can use commnad line to get esxi status
but list error at website


[root@localhost libexec]# ./check_vmware_api.pl -H 192.168.1.171 -u root -p XXXXX -l cpu
CHECK_VMWARE_API.PL OK - cpu usage=182.00 MHz (3.04%) | cpu_usagemhz=182.00MHz;; cpu_usage=3.04%;;
[root@localhost libexec]# ./check_vmware_api.pl -H 192.168.1.171 -u root -p XXXXX -l vmfs
CHECK_VMWARE_API.PL OK - Storages : 'datastore1'(free)=4096.00 MB (80.00%), 'nas'(free)=128635.00 MB (25.14%) | datastore1=4096.00MB;; nas=128635.00MB;;
[root@localhost libexec]# ./check_vmware_api.pl -H 192.168.1.171 -u root -p XXXXX -l mem
CHECK_VMWARE_API.PL OK - mem usage=954.28 MB (46.60%), overhead=260.29 MB, swapped=0.00 MB, memctl=0.00 MB | mem_usagemb=954.28MB;; mem_usage=46.60%;; mem_overhead=260.29MB;; mem_swap=0.00MB;; mem_memctl=0.00MB;;
[root@localhost libexec]#



my commnad.cfg


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

esxi5_01.cfg

# Define a host for the local machine

define host{
use esxi-server ; Name of host template$
; This host definition$
; in (or inherited by)$
host_name esxi5_01
alias esxi5_01
address 192.168.1.171
contact_groups admins
}

# Define an optional hostgroup for Linux machines

define hostgroup{
hostgroup_name esxi-servers ; The name of the hostgroup
alias VMWARE Servers ; Long name of the group
members esxi5_01 ; Comma separated list of hosts that belo$
}

define service{
use local-service
host_name esxi5_01
service_description VMware CPU Usage
check_command check_vmware_api_host_cpu_usage!80!90
}


i run /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg


Nagios Core 4.0.8
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2014
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
Checked 12 services.
Checked 3 hosts.
Checked 2 host groups.
Checked 0 service groups.
Checked 2 contacts.
Checked 1 contact groups.
Checked 67 commands.
Checked 5 time periods.
Checked 0 host escalations.
Checked 0 service escalations.
Checking for circular paths...
Checked 3 hosts
Checked 0 service dependencies
Checked 0 host dependencies
Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors: 0

Things look okay - No serious problems were detected during the pre-flight check

but when i use http://192.168.1.25/nagios/ and login

list error

Image



Image



please help me to fix this error
thanks

Re: check_vmware_api.pl error

Posted: Fri Oct 24, 2014 1:16 pm
by sreinhardt
I don't have that particular version of the plugin at the moment. Could you run it with your warning and critical flags, as well as while running as the nagios user?

Code: Select all

./check_vmware_api.pl -H 192.168.1.171 -u root -p XXXXX -l cpu -s usage -w 80 -c 90
su nagios -s /bin/bash
./check_vmware_api.pl -H 192.168.1.171 -u root -p XXXXX -l cpu
./check_vmware_api.pl -H 192.168.1.171 -u root -p XXXXX -l cpu -s usage -w 80 -c 90
exit

Re: check_vmware_api.pl error

Posted: Sun Oct 26, 2014 8:39 pm
by lee62817
./check_vmware_api.pl -H 192.168.1.171 -u root -p XXXXX -l cpu -s usage -w 80 -c 90
CHECK_VMWARE_API.PL OK - cpu usage=1.66 % | cpu_usage=1.66%;80;90


./check_vmware_api.pl -H 192.168.1.171 -u nagios -p XXXXX -l cpu -s usage -w 80 -c 90
CHECK_VMWARE_API.PL OK - cpu usage=2.10 % | cpu_usage=2.10%;80;90

i can use this command to check

Re: check_vmware_api.pl error

Posted: Mon Oct 27, 2014 4:35 pm
by lmiltchev
It seems that when you run the command from the CLI, you run it with the correct flag ("-l"), but in your command, you use "-I" instead... It looks the same but it is not. :)
define command{
command_name check_vmware_api_host_cpu_usage
command_line $USER1$/check_vmware_api.pl -H $HOSTADDRESS$ -u $USER11$ -p $USER12$ -I cpu -s usage -w $ARG1$ -c $ARG2$
}

Re: check_vmware_api.pl error

Posted: Tue Oct 28, 2014 11:26 am
by lee62817
lmiltchev wrote:It seems that when you run the command from the CLI, you run it with the correct flag ("-l"), but in your command, you use "-I" instead... It looks the same but it is not. :)
define command{
command_name check_vmware_api_host_cpu_usage
command_line $USER1$/check_vmware_api.pl -H $HOSTADDRESS$ -u $USER11$ -p $USER12$ -I cpu -s usage -w $ARG1$ -c $ARG2$
}
sorry

my command is correct -l

-I was just keyin error on this post

Re: check_vmware_api.pl error

Posted: Tue Oct 28, 2014 11:47 am
by abrist
Can you force a check and then check your nagios.log for the relevant line for the check and post the output here?

Code: Select all

tail -50 /usr/local/nagios/var/nagios.log | grep "192.168.1.171"

Re: check_vmware_api.pl error

Posted: Tue Oct 28, 2014 8:54 pm
by Box293
I can see your test commands at the cli are as the user root.

When Nagios executes the commands it does this as the user nagios.

Whenever testing from the cli you should:

Code: Select all

su nagios -s /bin/bash
Then test your commands. When finished type exit.

Seeing as we're talking about VMware monitoring, I suggest you check out box293_check_vmware which can be downloaded here:
http://exchange.nagios.org/directory/Pl ... re/details

Re: check_vmware_api.pl error

Posted: Tue Oct 28, 2014 10:30 pm
by lee62817
i think this error like perl sdk 5.5 u2 's bug

i install perl sdk 5.1

website can list check ok


thanks

Re: check_vmware_api.pl error

Posted: Wed Oct 29, 2014 1:42 pm
by sreinhardt
So after switching off of the newest SDK from vmware, this started working properly?

Re: check_vmware_api.pl error

Posted: Thu Oct 30, 2014 12:07 am
by lee62817
sreinhardt wrote:So after switching off of the newest SDK from vmware, this started working properly?
yes

it's wokring

thanks