Check_VMWARE_API Plugin not working

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

Re: Check_VMWARE_API Plugin not working

Post by lmiltchev »

The check worked for you, didn't it?
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
Are you running the plugin against different servers? Is MYHOST-3 different than myhost-2? Can you ping myhost-2? Is there a firewall in between? What is the output of the command below?

Code: Select all

nmap myhost-2 -p 443
Some people reported issues with this plugin with unsigned certificates. I am not sure if this is the case here, but you could try an easy "workaround". Open the plugin in a text editor and add this as the first line (after the comments):

Code: Select all

$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
Save, exit, and try your check again.
Be sure to check out our Knowledgebase for helpful articles and solutions!
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: Check_VMWARE_API Plugin not working

Post by kwhogster »

1, yes the checked worked the first time on myhost-3 now it timesout.

2. I ran this against all my hosts I have 9 of them to see if it worked all the same timeout.

3. root@tgcs017:/usr/local/nagios/etc/objects/linuxservers# nmap myhost-2 -p 443

Starting Nmap 7.01 ( https://nmap.org ) at 2019-03-15 11:56 EDT
Nmap scan report formyhost-2 (10.2.8.60)
Host is up (0.00036s latency).
rDNS record for 10.2.8.60: myhost-2.my.network.com
PORT STATE SERVICE
443/tcp open https
MAC Address: 78:2B:CB:05:4C:38 (Dell)

4. I added $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
check VMware api
check VMware api
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 myhost-2 -t 50 -u root -p ########### -l runtime -s status -vvv
CHECK_VMWARE_API.PL UNKNOWN - plugin timed out (timeout 50s)


Same results after adding the code.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Check_VMWARE_API Plugin not working

Post by lmiltchev »

It is really strange that the check initially worked, and now it is timing out...
Does it make any difference if you use an IP address in your command instead of a hostname?

What is the OS/distro that you are using? What is the version of the ESXi/Vspher server that you are monitoring? What is the output of the following command?

Code: Select all

cat /proc/sys/kernel/random/entropy_avail
I found some reports on plugin's timeouts as this one:
https://github.com/op5/check_vmware_api/issues/17

You could try "check_esx3-05.pl" plugin as an alternative. It's a bit older, but it may work in your environment.
https://exchange.nagios.org/directory/P ... st/details

So far, I haven't been able to recreate the issue in-house. Unfortunately, the "verbose" output is not verbose at all, and it's not helping us either. :(
Be sure to check out our Knowledgebase for helpful articles and solutions!
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: Check_VMWARE_API Plugin not working

Post by kwhogster »

root@tgcs017:/usr/local/nagios/libexec# cat /proc/sys/kernel/random/entropy_avail
170



The other check gives this error



root@tgcs017:/usr/local/nagios/libexec# ./check_esx3.pl
Can't locate Nagios/Plugin.pm in @INC (you may need to install the Nagios::Plugin module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at ./check_esx3.pl line 31.


This is line 31

use Nagios::Plugin;
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Check_VMWARE_API Plugin not working

Post by cdienger »

Open check_esx3.pl in vi or another editor and check out line 31. It probably looks like:

use Nagios::Plugin;

Change it to:

use Nagios::Monitoring::Plugin;

There may be other lines in the script that need similar changes as well to point to the Nagios plugin module.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Check_VMWARE_API Plugin not working

Post by lmiltchev »

Nagios::Plugin has been replaced with Nagios::Monitoring::Plugin, so you would need to modify again the plugin.

Make a copy of the old plugin:

Code: Select all

cp -p /usr/local/nagios/libexec/check_esx3.pl /usr/local/nagios/libexec/check_esx3.pl.backup
then run:

Code: Select all

sed -i 's/Nagios::Plugin/Nagios::Monitoring::Plugin/g' check_esx3.pl
or you could modify your plugin manually as suggested by @cdienger.
Try your check again.
Be sure to check out our Knowledgebase for helpful articles and solutions!
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: Check_VMWARE_API Plugin not working

Post by kwhogster »

I found two places line 31 and line 99

I then tested all the command on all my hosts

All worked but one the VMFS check line 812 was another one.

My search ability in VI is not the best I am a Windows GUY LOL



Do you know of any other places in the script I may need to change?
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Check_VMWARE_API Plugin not working

Post by cdienger »

There are a few other places. I've attached a modified script here.
Attachments
check_esx3-0.5.pl
(133.09 KiB) Downloaded 314 times
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: Check_VMWARE_API Plugin not working

Post by kwhogster »

That worked great

Have one issue on one ESXI Host

Host: TGCSESXI-1
Service: ESXI VMFS Check
Status: CRITICAL
Last check: 04-05-2019 10:33:26
Duration: 0d 10h 37m 11s
Attempt: 3/3
Status information: (Service check timed out after 120.01 seconds)

run this
./check_vmware_api.pl -H TGCSESXI-1 -u root -p "##########" -l vmfs

My check

Code: Select all

define service {
        service_description     ESXI VMFS Check
        host_name               hostname
        check_command           check_esx3!root!#########!vmfs
        initial_state           u
        max_check_attempts      3
        notification_interval   1440
        check_interval          1440
        retry_interval          3
        active_checks_enabled   1
        check_period            24x7
        servicegroups           VMWarevmfs
        register                1
}
My command

Code: Select all

define command{
        command_name check_esx3
        command_line $USER1$/check_esx3.pl -H $HOSTADDRESS$ -u $ARG1$ -p "$ARG2$" -l "$ARG3$"
}

The exact same check and command are working on 8 other ESXI hosts no problem.
Just this one ESXI Host the error as above.

Any thoughts?

Tom
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Check_VMWARE_API Plugin not working

Post by lmiltchev »

Is this the same version of ESXi/VSphere server as the rest of them (that are working)? Are the permissions of the user the same? Do any other checks work?

Try running:

Code: Select all

./check_vmware_api.pl -H TGCSESXI-1 -u root -p "##########" -l RUNTIME
./check_vmware_api.pl -H TGCSESXI-1 -u root -p "##########" -l CPU
./check_vmware_api.pl -H TGCSESXI-1 -u root -p "##########" -l MEM
Do you see the datastores when you log in the server with the same credentials?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked