check_vmware_api.pl

This forum is intended for the discussion of Nagios plugin development. Feature requests, patches, bug fixes, and all types of development-related discussions are welcome!

NOTE: The SourceForge.net nagiosplug-devel mailing list has been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

check_vmware_api.pl

Postby koehae » Wed Jan 11, 2017 10:22 am

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

Re: check_vmware_api.pl

Postby dwhitfield » Wed Jan 11, 2017 12:00 pm

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!
User avatar
dwhitfield
Support Tech
 
Posts: 1465
Joined: Wed Sep 21, 2016 10:29 am
Location: Nagios Enterprises, LLC

Re: check_vmware_api.pl

Postby koehae » Fri Jan 13, 2017 8:34 am

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

Re: check_vmware_api.pl

Postby tgriep » Fri Jan 13, 2017 2:35 pm

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!
User avatar
tgriep
Madmin
 
Posts: 3961
Joined: Thu Oct 30, 2014 9:02 am

Re: check_vmware_api.pl

Postby koehae » Mon Jan 16, 2017 9:46 am

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

Postby koehae » Mon Jan 16, 2017 9:57 am

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

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

Re: check_vmware_api.pl

Postby dwhitfield » Mon Jan 16, 2017 10:18 am

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

I'm going to go ahead and lock this up.
User avatar
dwhitfield
Support Tech
 
Posts: 1465
Joined: Wed Sep 21, 2016 10:29 am
Location: Nagios Enterprises, LLC


Return to Nagios Plugin Development

Who is online

Users browsing this forum: No registered users and 2 guests