Page 2 of 4

Re: Check_VMWARE_API Plugin not working

PostPosted: Wed Mar 13, 2019 6:14 pm
by kwhogster
I got it working now

Found it in two other locations

root@tgcs017:/usr/local/nagios/libexec# ./check_vmware_api.pl -H Myhost-8 -D MTDatacenter
Usage: check_vmware_api.pl -D <data_center> | -H <host_name> [ -C <cluster_name> ] [ -N <vm_name> ]
-u <user> -p <pass> | -f <authfile>
-l <command> [ -s <subcommand> ] [ -T <timeshift> ] [ -i <interval> ]
[ -x <black_list> ] [ -o <additional_options> ]
[ -t <timeout> ] [ -w <warn_range> ] [ -c <crit_range> ]
[ -V ] [ -h ]

Missing argument: command


Anyone have a valid command as an example?

Re: Check_VMWARE_API Plugin not working

PostPosted: Wed Mar 13, 2019 8:03 pm
by kwhogster
I got a sample but it errors out.

root@tgcs017:/usr/local/nagios/libexec# ./check_vmware_api.pl -H MYHOST-3 -u myroot -p "##########" -l runtime -s status
Undefined subroutine &Nagios::Monitoring::Plugin::plugin_exit called at ./check_vmware_api.pl line 824.


This is line 824 in check_vmware_api.pl

$np->plugin_exit($result, $output);


Any ideas?

Re: Check_VMWARE_API Plugin not working

PostPosted: Thu Mar 14, 2019 8:32 am
by lmiltchev
Can you upload your plugin on the forum? I would like to test it in house. Thank you!

Re: Check_VMWARE_API Plugin not working

PostPosted: Thu Mar 14, 2019 11:13 pm
by kwhogster
Here it is

check_vmware_api.pl
plugin
(166.12 KiB) Downloaded 25 times

Re: Check_VMWARE_API Plugin not working

PostPosted: Fri Mar 15, 2019 8:45 am
by lmiltchev
Make a backup of your original plugin:
Code: Select all
mv check_vmware_api.pl check_vmware_api.pl.backup

Download the plugin below, and place it in the plugins directory.
check_vmware_api.pl
(166.38 KiB) Downloaded 67 times

Test the new plugin to see if it fixes your issue.

Re: Check_VMWARE_API Plugin not working

PostPosted: Fri Mar 15, 2019 9:02 am
by kwhogster
Now working..

Thank you.

do you have any sample checks I can set up?

I ran this one

root@tgcs017:/usr/local/nagios/libexec# ./check_vmware_api.pl -H MYHOST-3 -u root -p "###############" -l runtime -s status
CHECK_VMWARE_API.PL OK - overall status=green


I tried this

root@tgcs017:/usr/local/nagios/libexec# ./check_vmware_api.pl -D MY-Datacenter -u root -p "############" -l runtime -s status
CHECK_VMWARE_API.PL CRITICAL - Server version unavailable at 'https://TGCSNET-Datacenter:443/sdk/vimService.wsdl' at /usr/share/perl/5.22/VMware/VICommon.pm line 734.



Thank you

Tom

Re: Check_VMWARE_API Plugin not working

PostPosted: Fri Mar 15, 2019 9:33 am
by lmiltchev
You could try some basic checks as these:
Code: Select all
./check_vmware_api.pl -H MYHOST-3 -u root -p "###############" -l -l "CPU"
./check_vmware_api.pl -H MYHOST-3 -u root -p "###############" -l "VMFS"
./check_vmware_api.pl -H MYHOST-3 -u root -p "###############" -l "IO"
./check_vmware_api.pl -H MYHOST-3 -u root -p "###############" -l "MEM"
./check_vmware_api.pl -H MYHOST-3 -u root -p "###############" -l "NET"
./check_vmware_api.pl -H MYHOST-3 -u root -p "###############" -l "SERVICE"
./check_vmware_api.pl -H MYHOST-3 -u root -p "###############" -l "RUNTIME"

Depending on what you would like to monitor, and what metrics are available, you could "narrow down" the output by using a subcommand ("-s").

Example:
Code: Select all
[root@main-nagios-xi var]# /usr/local/nagios/libexec/check_vmware_api.pl -H <ip address> -u <username> -p <password> -l "NET"
CHECK_VMWARE_API.PL OK - net receive=1165.00 KBps, send=5918.00 KBps, all 2 NICs are connected | net_receive=1165.00;; net_send=5918.00;; OK_NICs=2;; Bad_NICs=0;;

[root@main-nagios-xi var]# /usr/local/nagios/libexec/check_vmware_api.pl -H <ip address> -u <username> -p <password> -l "NET" -s usage
CHECK_VMWARE_API.PL OK - net usage=5005.00 KBps | net_usage=5005.00;;

Re: Check_VMWARE_API Plugin not working

PostPosted: Fri Mar 15, 2019 9:47 am
by kwhogster
Thank you that's what I was looking for.


The plugin is timing out


root@tgcs017:/usr/local/nagios/libexec# ./check_vmware_api.pl -H MYHOST-1 -u root -p "#########" -l "CPU"
CHECK_VMWARE_API.PL UNKNOWN - plugin timed out (timeout 30s)
root@tgcs017:/usr/local/nagios/libexec# ./check_vmware_api.pl -H Myhost-1 -u root -p "############" -l runtime -s status
CHECK_VMWARE_API.PL UNKNOWN - plugin timed out (timeout 30s)

Re: Check_VMWARE_API Plugin not working

PostPosted: Fri Mar 15, 2019 10:04 am
by lmiltchev
Hmm, the default timeout is quite a bit - 30 sec.
-t, --timeout=INTEGER
Seconds before plugin times out (default: 30)


You could try increasing the timeout to see if this is going to resolve the issue:
Code: Select all
./check_vmware_api.pl -H MYHOST-1 -t 50 -u root -p "#########" -l "CPU"


There must be some other issue though... Try increasing the verbosity in order to debug the problem:
Code: Select all
./check_vmware_api.pl -H MYHOST-1 -u root -p "#########" -l "CPU" -vvv

Re: Check_VMWARE_API Plugin not working

PostPosted: Fri Mar 15, 2019 10:18 am
by kwhogster
root@tgcs017:/usr/local/nagios/libexec# ./check_vmware_api.pl -H myhost-2 -t 50 -u root -p "#########" -l runtime -s status -vvv
[extra-opts] check_vmware_api.pl -H muhost-2 -t 50 -u root -p ##My95hog -l runtime -s status -vvv
CHECK_VMWARE_API.PL UNKNOWN - plugin timed out (timeout 50s)
root@tgcs017:/usr/local/nagios/libexec# ./check_vmware_api.pl -H myhost-2 -t 120 -u root -p "##########" -l "CPU" -vvv
[extra-opts] check_vmware_api.pl -H myhost-2 -t 120 -u root -p ##My95hog -l CPU -vvv
CHECK_VMWARE_API.PL UNKNOWN - plugin timed out (timeout 120s)


Even upping it to 120 still time outs