check_vmware_api.pl

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.
Locked
koehae
Posts: 4
Joined: Wed Jan 11, 2017 9:50 am

check_vmware_api.pl

Post by koehae »

Hi, I'm trying to monitor my VSphere.
Had some problems getting this plugin to work (nothing with the plugin, rather the VMware vSphere SDK).
So I was very happy when eventually I got it working:
perl /usr/local/nagios/libexec/check_vmware_api.pl -H VCenter -u user -p password -l MEM
CHECK_VMWARE_API.PL OK - mem usage=20132.40 MB (49.19%), overhead.....
BUT when I created it in Nagios it broke down again????
my command:
define command {
command_name check_vm
command_line perl $USER1$/check_vmware_api.pl -H VCenter -u user -p password -l $ARG1$
}

my service definition ..... check_command check_vm!MEM

The response I get:
Current Status: UNKNOWN (for 0d 0h 32m 47s)
Status Information: VMWARE_API UNKNOWN - Missing perl module VMware::VIRuntime. Download and install 'VMware vSphere SDK for Perl', available at https://my.vmware.com/group/vmware/downloads

Download the latest version of the vSphere SDK for Perl from VMware.
In this example we use VMware-vSphere-Perl-SDK-5.1.0-780721.x86_64.tar.gz,
but the instructions should apply to other ve.....
Can anybody tell me what's going wrong?
Last edited by dwhitfield on Mon Jan 16, 2017 10:18 am, edited 1 time in total.
Reason: marking with green check mark
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: check_vmware_api.pl

Post by dwhitfield »

Please force a check and then run tail -50 /usr/local/nagios/var/nagios.log | grep "IPUSEDINCHECK" and post output. If that doesn't work, used the FQDN.

If still nothing shows up, can you post your objects.cache? If you are concerned about posting your objects.cache publicly, you can PM it to me. If you choose to PM, please make sure you update this forum thread as that is the only way for it to appear on our support dashboard. Thanks!
koehae
Posts: 4
Joined: Wed Jan 11, 2017 9:50 am

Re: check_vmware_api.pl

Post by koehae »

I didn't see anything in the logging (except the same message : VMWARE_API UNKNOWN - Missing perl module VMware::VIRu...)
I'm checking other services on the same machine and they work so I don't think there's a problem with finding the machine.
When I perform the command outside of nagios it works, no remarks on missing module... just in Nagios.
Thanks for trying to help though
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: check_vmware_api.pl

Post by tgriep »

First thing to try is to remove the perl command for the nagios check and see if that works.
Edit your command and change the following from

Code: Select all

command_line perl $USER1$/check_vmware_api.pl -H VCenter -u user -p password -l $ARG1$
to

Code: Select all

command_line $USER1$/check_vmware_api.pl -H VCenter -u user -p password -l $ARG1$
Try that and see if it works for you.

The other cause for that error is that the plugin runs as the nagios user and not as root so if the VMWare perl modules were installed with permissions that only the root user can access, that would cause the error.
Make sure the nagios user can assess them.
Be sure to check out our Knowledgebase for helpful articles and solutions!
koehae
Posts: 4
Joined: Wed Jan 11, 2017 9:50 am

Re: check_vmware_api.pl

Post by koehae »

Thanks, the nagios user didn't have the rights.
I reinstalled VMware perl SDK...
and now it works
(not really - just get another error 'CHECK_VMWARE_API.PL CRITICAL - Server version unavailable at '
I'm looking into that one...

Thanks for the help
koehae
Posts: 4
Joined: Wed Jan 11, 2017 9:50 am

Re: check_vmware_api.pl

Post by koehae »

:D Everything works, installed a different version (6.5) of VMware perl SDK

Thanks
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: check_vmware_api.pl

Post by dwhitfield »

Thanks so much for posting your fix! I'm sure it will help others.

I'm going to go ahead and lock this up.
Locked