Getting error check_vmfs

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
bosecorp
Posts: 929
Joined: Thu Jun 26, 2014 1:00 pm

Getting error check_vmfs

Post by bosecorp »

Getting error while running the below plugin. Looks like perl is not able to load the files.

root@nagmonusdev1:(05-11 10:10): /tmp/check_vmfs_1.5
# ./check_vmfs.sh -C vmware_esxi_conf.txt -S 10.101.28.21 -V dce-App_1 -w 75 -c 90 -u Gb
CRITICAL - Can't locate VMware/VIRuntime.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/bin/vmkfstools line 33.
BEGIN failed--compilation aborted at /usr/local/bin/vmkfstools line 33.

# locate VIRuntime.pm
/root/vmware-viperl-distrib/lib/VMware/share/VMware/VIRuntime.pm
/root/vmware-vsphere-cli-distrib/lib/VMware/share/VMware/VIRuntime.pm
/usr/local/lib64/perl5/VMWARE/VIRuntime.pm

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

Re: Getting error check_vmfs

Post by dwhitfield »

The first thing to do is to go back through the instructions. For clarity, is this ESX 4, 5, or 6?

Code: Select all

==============
WHAT
===============
This Nagios Plugin gets the size (Kb, Mb, Gb)  of the vmfs volumes (datastores) of a VMWare Server Esxi 4.x/5.x.

The VMWare VCLI must be installed and configured on the Nagios server (in my case, an Ubuntu server guest, inside the VMWare Server ESxi host), because we do use of the binary "vmkfstools" for getting the data.

Warning and critical levels can be set, and plugin gives us perfdata output too, so it can be graphed with graphical tools as pnp4nagios,  besides the usual Nagios states (OK, WARNING and CRITICAL).

============================
PREREQUISITES & INSTALLATION
============================

VMWare Esxi 4.x/5.x
-------------------

1) For the check_vmfs.sh plugin to work, it needs VMWare VCLI installed. You can get it for free, after registration, here:

https://my.vmware.com/web/vmware/details?downloadGroup=VSP510-VCLI-510&productId=285

2) Besides the standard commands of any Linux's flavours (grep, cut, cat, rm & awk) we need to install the bc application, which
is used to work with fractionnary numbers in unit conversion tasks. it's found in standard repositories so, in a debian based Linux
just type:

$ apt-get install bc

3) To check into the server automatically, we need the credentials of the VMWare ESXi servers stored in a single config file.
By default it could be stored in nagios plugin path:

/usr/local/nagios/libexec/vmware_esxi_conf.txt

and this txt file should have, at least, these fields:

# VMWARE_SERVER1 USER1 PASSWORD1
# VMWARE_SERVER2 USER2 PASSWORD2

This file should be, by security, in 600 mode, and owner and group of Nagios user.

By Example:
chown vmware_esxi_conf.txt
chmod 600 vmware_esxi_conf.txt

4) check_vmfs.sh is placed in plugins Nagios path=>/usr/local/nagios/libexec

5) Checking if nagios default path is /usr/local/nagios/var. Script needs to create a file there called check_vmfs.err to handle errors.
If Nagios is installed in other place, just change this line in script:
ERR_LOG=/usr/local/nagios/var/check_vmfs.err
to your default nagios installation directory.
These perl issues can be tedious, but also make sure you have CPAN installed: yum install perl-CPAN -y
bosecorp
Posts: 929
Joined: Thu Jun 26, 2014 1:00 pm

Re: Getting error check_vmfs

Post by bosecorp »

This is for ESX version 5.1.0

CPAN is installed, as per the prereq vmkfstools is installed, but i'm getting the same error while running the command.

# /usr/local/bin/vmkfstools
Can't locate VMware/VIRuntime.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/bin/vmkfstools line 33.
BEGIN failed--compilation aborted at /usr/local/bin/vmkfstools line 33.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Getting error check_vmfs

Post by dwhitfield »

What's the output of ll /usr/local/lib64/perl5/VMWARE/VIRuntime.pm?

Also, just because sometimes people name different plugins the same thing, could you upload your /usr/local/bin/vmkfstools so we know exactly what we're working with here. Thanks!
SteveBeauchemin
Posts: 524
Joined: Mon Oct 14, 2013 7:19 pm

Re: Getting error check_vmfs

Post by SteveBeauchemin »

When I locate I get this:

Code: Select all

locate VIRuntime.pm
/usr/lib/vmware-vcli/VMware/share/VMware/VIRuntime.pm
/usr/share/perl5/VMware/VIRuntime.pm
In your locate, you have

Code: Select all

/usr/local/lib64/perl5/VMWARE/VIRuntime.pm
Upper Case VMWARE is not VMware
Can't locate VMware/VIRuntime.pm in @INC (@INC cont...
is a true statement...
Maybe you can rename the directory to lower case?

Steve B
XI 5.7.3 / Core 4.4.6 / NagVis 1.9.8 / LiveStatus 1.5.0p11 / RRDCached 1.7.0 / Redis 3.2.8 /
SNMPTT / Gearman 0.33-7 / Mod_Gearman 3.0.7 / NLS 2.0.8 / NNA 2.3.1 /
NSClient 0.5.0 / NRPE Solaris 3.2.1 Linux 3.2.1 HPUX 3.2.1
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Getting error check_vmfs

Post by dwhitfield »

Great catch!

For clarity, you don't need it where Steve has it, because it's looking in /usr/local/lib64/perl5, where your VMWARE directory is.
bosecorp
Posts: 929
Joined: Thu Jun 26, 2014 1:00 pm

Re: Getting error check_vmfs

Post by bosecorp »

i was able to fix that by installing the correct perl modules..

Getting different error now. I have confirmed that the Volume on the esx server exists.

root@nagmonusdev1:(05-11 10:10): /tmp/check_vmfs_1.5
# ./check_vmfs.sh -C vmware_esxi_conf.txt -S 10.101.28.21 -V /vmfs/volumes/dce-Sys_1 -w 75 -c 90 -u Gb
CRITICAL - Undefined subroutine &HostMountInfo::mounted called at /usr/local/bin/vmkfstools line 757
SteveBeauchemin
Posts: 524
Joined: Mon Oct 14, 2013 7:19 pm

Re: Getting error check_vmfs

Post by SteveBeauchemin »

This is a subroutine in the /usr/share/perl5/VMware directory on my system

package HostMountInfo;

Did you rename VMWARE to VMware yet?

Steve B
XI 5.7.3 / Core 4.4.6 / NagVis 1.9.8 / LiveStatus 1.5.0p11 / RRDCached 1.7.0 / Redis 3.2.8 /
SNMPTT / Gearman 0.33-7 / Mod_Gearman 3.0.7 / NLS 2.0.8 / NNA 2.3.1 /
NSClient 0.5.0 / NRPE Solaris 3.2.1 Linux 3.2.1 HPUX 3.2.1
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Getting error check_vmfs

Post by dwhitfield »

What kind of mounts are these? My understand is that you cannot check NFS mounts this way.

In addition to Steve's suggestion, can you upload your check_vmfs_1.5? That's what I meant earlier when I mentioned vmkfstools.
Locked