check_vmware_api.pl error

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
lee62817
Posts: 8
Joined: Wed Jul 04, 2012 8:04 pm

check_vmware_api.pl error

Post 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
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: check_vmware_api.pl error

Post 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
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
lee62817
Posts: 8
Joined: Wed Jul 04, 2012 8:04 pm

Re: check_vmware_api.pl error

Post 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
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: check_vmware_api.pl error

Post 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$
}
Be sure to check out our Knowledgebase for helpful articles and solutions!
lee62817
Posts: 8
Joined: Wed Jul 04, 2012 8:04 pm

Re: check_vmware_api.pl error

Post 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
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: check_vmware_api.pl error

Post 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"
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: check_vmware_api.pl error

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
lee62817
Posts: 8
Joined: Wed Jul 04, 2012 8:04 pm

Re: check_vmware_api.pl error

Post 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
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: check_vmware_api.pl error

Post by sreinhardt »

So after switching off of the newest SDK from vmware, this started working properly?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
lee62817
Posts: 8
Joined: Wed Jul 04, 2012 8:04 pm

Re: check_vmware_api.pl error

Post by lee62817 »

sreinhardt wrote:So after switching off of the newest SDK from vmware, this started working properly?
yes

it's wokring

thanks
Locked