check_vmfs command

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.
scheema31
Posts: 90
Joined: Wed Jun 06, 2012 1:11 pm

check_vmfs command

Post by scheema31 »

Hi,

I am trying to setup check on my datastore through my esxi host using the vmfs command.
i have installed the plugin and created the commands, however im getting the following error in my command output:

Code: Select all

[root@myserver01 ~]# /usr/local/nagios/libexec/check_vmfs.sh -S #.#.#.# -V /vmfs/volumes/VM-10GDATASTORE-1
which: no vmkfstools in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
CRITICAL - /usr/local/nagios/libexec/check_vmfs.sh: line 161: --username: command not found
Thanks
Last edited by dwhitfield on Thu Oct 06, 2016 1:58 pm, edited 1 time in total.
Reason: adding code blocks
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: check_vmfs command

Post by avandemore »

From check_vmfs.sh:

Code: Select all

# We need Vmware VCLI installed in Nagios machine
VMKFSTOOLS=`which vmkfstools`
It seems the relevant instructions from the plugins README.txt weren't executed.

Can you ensure the following instructions are completed?

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.
Previous Nagios employee
scheema31
Posts: 90
Joined: Wed Jun 06, 2012 1:11 pm

Re: check_vmfs command

Post by scheema31 »

Thanks avandemore! i think im on the right track here but still at a roadblock, here is where i am:

Code: Select all

• # tar xzf VMware-vSphere-CLI-5.1.0-780721.i386.tar.gz (in/root/home)
	• # cd vmware-vsphere-cli-distrib/
	• # ./vmware-install.pl
		○ CPAN module not installed on the system.
		CPAN module is required to install missing pre-requisite Perl modules. Please
		install CPAN.
	• # yum search perl | grep -i mime-base64
		○ No result
	• # wget http://search.cpan.org/CPAN/authors/id/G/GA/GAAS/MIME-Base64-3.15.tar.gz
		--2016-10-07 09:56:59--  http://search.cpan.org/CPAN/authors/id/G/GA/GAAS/MIME-Base64-3.15.tar.gz
		Resolving search.cpan.org (search.cpan.org)... 207.171.7.59, 199.15.176.188
		Connecting to search.cpan.org (search.cpan.org)|207.171.7.59|:80... connected.
		HTTP request sent, awaiting response... 302 Found
		Location: http://www.cpan.org/authors/id/G/GA/GAAS/MIME-Base64-3.15.tar.gz [following]
		--2016-10-07 09:56:59--  http://www.cpan.org/authors/id/G/GA/GAAS/MIME-Base64-3.15.tar.gz
		Resolving www.cpan.org (www.cpan.org)... 151.101.52.249
		Connecting to www.cpan.org (www.cpan.org)|151.101.52.249|:80... connected.
		HTTP request sent, awaiting response... 200 OK
		Length: 18438 (18K) [application/x-gzip]
		Saving to: ‘MIME-Base64-3.15.tar.gz’
		
		100%[=================================================================>] 18,438      --.-K/s   in 0.004s
		
		2016-10-07 09:56:59 (4.17 MB/s) - ‘MIME-Base64-3.15.tar.gz’ saved [18438/18438]
		
	• #tar xzf MIME-Base64-3.15.tar.gz
	• #cd MIME-Base64-3.15/
	• #perl Makefile.PL
	Checking if your kit is complete...
	Looks good
	Writing Makefile for MIME::Base64
	• # make
	cp QuotedPrint.pm blib/lib/MIME/QuotedPrint.pm
	cp Base64.pm blib/lib/MIME/Base64.pm
	/usr/bin/perl /usr/share/perl5/vendor_perl/ExtUtils/xsubpp  -typemap /usr/share/perl5/ExtUtils/typemap  Base64.xs > Base64.xsc && mv Base64.xsc Base64.c
	gcc -c   -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic   -DVERSION=\"3.15\" -DXS_VERSION=\"3.15\" -fPIC "-I/usr/lib64/perl5/CORE"   Base64.c
	Running Mkbootstrap for MIME::Base64 ()
	chmod 644 Base64.bs
	rm -f blib/arch/auto/MIME/Base64/Base64.so
	gcc  -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -Wl,-z,relro  Base64.o  -o blib/arch/auto/MIME/Base64/Base64.so       \
	        \
	chmod 755 blib/arch/auto/MIME/Base64/Base64.so
	cp Base64.bs blib/arch/auto/MIME/Base64/Base64.bs
	chmod 644 blib/arch/auto/MIME/Base64/Base64.bs
	Manifying blib/man3/MIME::QuotedPrint.3pm
	Manifying blib/man3/MIME::Base64.3pm
	• # make install
	Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
	Installing /usr/local/lib64/perl5/auto/MIME/Base64/Base64.so
	Installing /usr/local/lib64/perl5/auto/MIME/Base64/Base64.bs
	Installing /usr/local/lib64/perl5/MIME/Base64.pm
	Installing /usr/local/lib64/perl5/MIME/QuotedPrint.pm
	Installing /usr/local/share/man/man3/MIME::QuotedPrint.3pm
	Installing /usr/local/share/man/man3/MIME::Base64.3pm
	Appending installation info to /usr/lib64/perl5/perllocal.pod
• Tried reinstalling the ./vmware-install.pl but still gave me the NO CPANEL INSTALLED error
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: check_vmfs command

Post by lmiltchev »

Try running:

Code: Select all

yum install perl-CPAN -y
If CPAN is installed, but you are still getting these errors, it is possible that it got corrupted. You could try to reinstall it:

Code: Select all

perl -MCPAN -e shell
o conf init
Enter "yet" when prompted. Run through the configuration utility. Type "exit", and hit "Enter" to leave CPAN.

Let us know if this helped.
Be sure to check out our Knowledgebase for helpful articles and solutions!
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: check_vmfs command

Post by dwhitfield »

What OS are you running?
scheema31
Posts: 90
Joined: Wed Jun 06, 2012 1:11 pm

Re: check_vmfs command

Post by scheema31 »

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

Re: check_vmfs command

Post by dwhitfield »

ok, great. The yum command given above should work. I just wanted to make sure since this was in the Core forum and not the XI forum.
Last edited by dwhitfield on Fri Oct 07, 2016 12:50 pm, edited 1 time in total.
Reason: added a word
scheema31
Posts: 90
Joined: Wed Jun 06, 2012 1:11 pm

Re: check_vmfs command

Post by scheema31 »

okay so some progress :)
i ran #yum install perl-CPAN -y
then reran the ./vmware-install.pl, this time it ran but returned a different error
"http_proxy not set. please set environment variable 'http_proxy' e.g. export
http_proxy=http://myproxy.mydomain.com:0000 .

ftp_proxy not set. please set environment variable 'ftp_proxy' e.g. export
ftp_proxy=http://myproxy.mydomain.com:0000."
does this need to be set?

and running the check_vmfs.sh command still gives an error:
/usr/local/nagios/libexec/check_vmfs.sh -S 10.10.10.81 -V /vmfs/volumes/VM-10GDATASTORE-1
which: no vmkfstools in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
CRITICAL - /usr/local/nagios/libexec/check_vmfs.sh: line 161: --username: command not found
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: check_vmfs command

Post by dwhitfield »

Please comment open up vmware-install.pl and add comments "#" per below:

Code: Select all

        if ( !( $ftpproxy && $httpproxy)) {
-          uninstall_file($gInstallerMainDB);
-         exit 1;
+#          uninstall_file($gInstallerMainDB);
+#        exit 1;
        }
        require CPAN;
scheema31
Posts: 90
Joined: Wed Jun 06, 2012 1:11 pm

Re: check_vmfs command

Post by scheema31 »

then re-run it?
Locked