VMWare

check_vmfs.sh – Check vmfs datastores through VMware VCLI

Description:

Hello, guys!

This is a Nagios Plugin that monitorws the size (Kb, Mb, Gb) of the vmfs volumes (datastores) of a VMWare Server Esxi 4/5.1, using the Vmware VCLI (Linux version).

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).

Current Version

1.5.1

Last Release Date

2017-08-28

Compatible With

  • Nagios 3.x
  • Nagios 4.x

Owner

License

GPL


Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
Project Files
Project Photos
Project Notes
Fixed error Server version unavailable at 'https://$IP/sdk/vimService.wsdl' which was present in 5.x versions (not in 4.x versions which plugin was made for).
Reviews (11) Add a Review
Incorrect username or password
by Rookie23, February 28, 2017
IS the check compatible with ESXi 6.0?
I am getting the following error
Error: Cannot complete login due to an incorrect user name or password.
when the password is completely right , since I can use it with vmware-cmd through vCLI 6 on the same nagios host (which is a prerequisite to make this check work)
My .txt file is in format:
IP root password

and I have 9 servers defined in it, tried them all in the check, all get the same error
Owner's Reply:

As said in description, this scripts is JUST compatible with ESXi 4.x (old versions) and 5.x (last versions).
That's what I've got here to test and try it. I havent upgraded to Esxi 6.x yet, sorry.


Helpful? Yes  No 
check_vmfs issue
by gqma0, November 30, 2016
check_vmfs doesn't reflect the results and I'm not sure where the problem lies


[root@monitoring1 admin]# grep -E -i ';check_esxi_vmfs_prod-vspp-PvDC1' /usr/local/nagios/var/nagios.log | perl -pe 's/CRITICAL/e[1;31;43m$&e[0m/g; s/(d+)/localtime($1)/e'
[Tue Nov 29 00:00:00 2016] CURRENT SERVICE STATE: prod-vspp-ESXi01;check_esxi_vmfs_prod-vspp-PvDC1;WARNING;HARD;3;WARNING - /vmfs/volumes/prod-vspp-PvDC1 - total: 8191.75 Gb - used: 7456.31 Gb (91%)- free: 735.43 Gb (9%)
[Tue Nov 29 00:00:00 2016] CURRENT SERVICE STATE: prod-vspp-ESXi02;check_esxi_vmfs_prod-vspp-PvDC1;WARNING;HARD;3;WARNING - /vmfs/volumes/prod-vspp-PvDC1 - total: 8191.75 Gb - used: 7456.31 Gb (91%)- free: 735.43 Gb (9%)
[Tue Nov 29 00:00:00 2016] CURRENT SERVICE STATE: prod-vspp-ESXi03;check_esxi_vmfs_prod-vspp-PvDC1;CRITICAL;HARD;3;CRITICAL - /vmfs/volumes/prod-vspp-PvDC1 - total: 8191.75 Gb - used: 7822.53 Gb (95%)- free: 369.21 Gb (5%)
[Tue Nov 29 00:00:00 2016] CURRENT SERVICE STATE: prod-vspp-ESXi04;check_esxi_vmfs_prod-vspp-PvDC1;WARNING;HARD;3;WARNING - /vmfs/volumes/prod-vspp-PvDC1 - total: 8191.75 Gb - used: 7456.31 Gb (91%)- free: 735.43 Gb (9%)
[Tue Nov 29 00:00:00 2016] CURRENT SERVICE STATE: prod-vspp-ESXi05;check_esxi_vmfs_prod-vspp-PvDC1;WARNING;HARD;3;WARNING - /vmfs/volumes/prod-vspp-PvDC1 - total: 8191.75 Gb - used: 7456.31 Gb (91%)- free: 735.43 Gb (9%)
[Tue Nov 29 00:00:00 2016] CURRENT SERVICE STATE: prod-vspp-ESXi06;check_esxi_vmfs_prod-vspp-PvDC1;WARNING;HARD;3;WARNING - /vmfs/volumes/prod-vspp-PvDC1 - total: 8191.75 Gb - used: 7191.70 Gb (87%)- free: 1000.04 Gb (13%)

[root@monitoring1 admin]# grep -E -i ';check_esxi_vmfs_prod-vspp-PvDC2' /usr/local/nagios/var/nagios.log | perl -pe 's/CRITICAL/e[1;31;43m$&e[0m/g; s/(d+)/localtime($1)/e'
[Tue Nov 29 00:00:00 2016] CURRENT SERVICE STATE: prod-vspp-ESXi01;check_esxi_vmfs_prod-vspp-PvDC2;WARNING;HARD;3;WARNING - /vmfs/volumes/prod-vspp-PvDC2 - total: 8191.75 Gb - used: 7567.78 Gb (92%)- free: 623.96 Gb (8%)
[Tue Nov 29 00:00:00 2016] CURRENT SERVICE STATE: prod-vspp-ESXi02;check_esxi_vmfs_prod-vspp-PvDC2;WARNING;HARD;3;WARNING - /vmfs/volumes/prod-vspp-PvDC2 - total: 8191.75 Gb - used: 7736.15 Gb (94%)- free: 455.59 Gb (6%)
[Tue Nov 29 00:00:00 2016] CURRENT SERVICE STATE: prod-vspp-ESXi03;check_esxi_vmfs_prod-vspp-PvDC2;CRITICAL;HARD;3;CRITICAL - /vmfs/volumes/prod-vspp-PvDC2 - total: 8191.75 Gb - used: 7859.84 Gb (95%)- free: 331.90 Gb (5%)
[Tue Nov 29 00:00:00 2016] CURRENT SERVICE STATE: prod-vspp-ESXi04;check_esxi_vmfs_prod-vspp-PvDC2;WARNING;HARD;3;WARNING - /vmfs/volumes/prod-vspp-PvDC2 - total: 8191.75 Gb - used: 7736.22 Gb (94%)- free: 455.52 Gb (6%)
[Tue Nov 29 00:00:00 2016] CURRENT SERVICE STATE: prod-vspp-ESXi05;check_esxi_vmfs_prod-vspp-PvDC2;WARNING;HARD;3;WARNING - /vmfs/volumes/prod-vspp-PvDC2 - total: 8191.75 Gb - used: 7567.81 Gb (92%)- free: 623.93 Gb (8%)
[Tue Nov 29 00:00:00 2016] CURRENT SERVICE STATE: prod-vspp-ESXi06;check_esxi_vmfs_prod-vspp-PvDC2;CRITICAL;HARD;3;CRITICAL - /vmfs/volumes/prod-vspp-PvDC2 - total: 8191.75 Gb - used: 7859.84 Gb (95%)- free: 331.90 Gb (5%)

[root@monitoring1 admin]# ssh root@prod-vspp-esxi01 'df -h|grep -E "PvDC1|PvDC2"'
Password:
VMFS-5 8.0T 7.3T 735.4G 91% /vmfs/volumes/prod-vspp-PvDC1
VMFS-5 8.0T 7.4T 623.9G 92% /vmfs/volumes/prod-vspp-PvDC2
[root@monitoring1 admin]# ssh root@prod-vspp-esxi02 'df -h|grep -E "PvDC1|PvDC2"'
Password:
VMFS-5 8.0T 7.3T 735.4G 91% /vmfs/volumes/prod-vspp-PvDC1
VMFS-5 8.0T 7.4T 623.9G 92% /vmfs/volumes/prod-vspp-PvDC2
[root@monitoring1 admin]# ssh root@prod-vspp-esxi03 'df -h|grep -E "PvDC1|PvDC2"'
Password:
VMFS-5 8.0T 7.3T 735.4G 91% /vmfs/volumes/prod-vspp-PvDC1
VMFS-5 8.0T 7.4T 623.9G 92% /vmfs/volumes/prod-vspp-PvDC2
[root@monitoring1 admin]# ssh root@prod-vspp-esxi04 'df -h|grep -E "PvDC1|PvDC2"'
Password:
VMFS-5 8.0T 7.3T 735.4G 91% /vmfs/volumes/prod-vspp-PvDC1
VMFS-5 8.0T 7.4T 623.9G 92% /vmfs/volumes/prod-vspp-PvDC2
[root@monitoring1 admin]# ssh root@prod-vspp-esxi05 'df -h|grep -E "PvDC1|PvDC2"'
Password:
VMFS-5 8.0T 7.3T 735.4G 91% /vmfs/volumes/prod-vspp-PvDC1
VMFS-5 8.0T 7.4T 623.9G 92% /vmfs/volumes/prod-vspp-PvDC2
[root@monitoring1 admin]# ssh root@prod-vspp-esxi06 'df -h|grep -E "PvDC1|PvDC2"'
Password:
VMFS-5 8.0T 7.3T 735.4G 91% /vmfs/volumes/prod-vspp-PvDC1
VMFS-5 8.0T 7.4T 623.9G 92% /vmfs/volumes/prod-vspp-PvDC2

Also checked with v1.5

[root@monitoring1 admin]# check_vmfs_1.5/check_vmfs.sh -C /usr/local/nagios/libexec/vmware_esxi_conf.txt -S 172.17.166.13 -V /vmfs/volumes/prod-vspp-PvDC2 -w 85 -c 95 -u Gb
CRITICAL - /vmfs/volumes/prod-vspp-PvDC2 - total: 8191.75 Gb - used: 7859.84 Gb (95%)- free: 331.90 Gb (5%) | /vmfs/volumes/prod-vspp-PvDC2=7859.84Gb;6962.98;7782.16;;8191.75
Helpful? Yes  No 
Very nice plugin
by whutest, February 29, 2016
Thank you!

https://communities.vmware.com/message/2169320#2169320

Here is solution if you got the error:
CRITICAL - Server version unavailable at 'https://vmgsa:443/sdk/vimService.wsdl' at /usr/share/perl5/VMware/VICommon.pm line 545.
Helpful? Yes  No 
vmware new versions
by Tasslehoff, October 31, 2015
Hi, first of all thanks for this plugin.
I have a problem, I tried to use it with some ESXi servers 5.5, if I try to check the datastores it returns "Server version unavailable" error.

===
[root@drakaris check_vmfs_1.4]# ./check_vmfs.sh -C ./check_vmfs.conf -S vmgsa -V datastore1 -w 80 -c 90
CRITICAL - Server version unavailable at 'https://vmgsa:443/sdk/vimService.wsdl' at /usr/share/perl5/VMware/VICommon.pm line 545.
===
where check_vmfs.conf have a line with hostname, username and password for the vmware server (vmgsa in the example).

Do you think it's possibile to update the plugin for working with same on the latest vmware esxi versions?

Another question, this plugin needs virtualcenter or works also with the free version of esxi?

Thanks

Tasslehoff Burrfoot
Owner's Reply:

Hi!
Your first question about Server version unavailable was answered in next review. For Esxi 5.x versions it is necessary to export this variable:
export PERL_LWP_SSL_VERIFY_HOSTNAME=0
Anyway I am going to upload 5 version which export this variable inside script.
And about second question this plugins doesnt need virtualcenter. Indeed I have no virtualcenter, I am working with free versino of Esxi.


Helpful? Yes  No 
CRITICAL - /usr/local/nagios/libexec/check_vmfs.sh: 161: /usr/local/nagios/libexec/check_vmfs.sh: --username: not found
by jonathanbaird, June 30, 2014
Hi,

I am really struggling to get this to work. I am getting the following error.

CRITICAL - /usr/local/nagios/libexec/check_vmfs.sh: 161: /usr/local/nagios/libexec/check_vmfs.sh: --username: not found

Below are my configs...

define service{
use generic-service
host_name AIT-VM01
service_description Datastore1 Space
check_command check_vmfs.sh!vmware_esxi_conf.txt!10.10.10.6!/vmfs/volumes/datastore1!80!90!Gb
}

define command{
command_name check_vmfs.sh
command_line $USER1$/check_vmfs.sh -C ./$ARG1$ -S $ARG1$ -V $ARG2$ -w $ARG3$ -c $ARG4$ -u $ARG5$
}

I have got vmware_esxi_conf.txt in /usr/local/nagios/libexec. The contents of this file are below...

10.10.10.6 root password

I have installed all the dependencies and cannot get this to work, any ideas?
Helpful? Yes  No 
Can't see results on Web Interface
by DukeHazord, April 30, 2014
The script works great via CLI but when I can't seem to view the output on the Nagios Web Interface. I tried the above method that you suggested but that doesn't work either. All I get is "Critical - " nothing else no total, used or free info.
Helpful? Yes  No 
Working Fine with Nagios 4.0.2
by aravikumar48, February 28, 2014
It is working fine excellent Job.. Can you please Upload to Monitor the CPU and Memory of ESX
Helpful? Yes  No 
vCenter
by tazinblack, May 31, 2013
How can I use this against a vCenter instead of using a host directly.

Could you write some more details please?
Helpful? Yes  No 
VMFS
by mudricd, March 31, 2013
Great plugin!

I have just set up my nagios and finaly I have free overview of my esxi's datastores.

Thanks Javier
Helpful? Yes  No 
kehindegb
by kehindegb, December 31, 2012
This script is fantastic !!! does the job.
1 of 1 found this review helpful.
Helpful? Yes 1 No 0
How to create a command for this plugin.
by sunnysthakur, January 31, 2012
I go through this tool and is very useful for verifying and monitor the VMFS usage on ESXi environments.

But how to use this plugin with nagios with so that it displays the data on Web interface.

I tried with couple of tricks but didn't succeed.
Owner's Reply:

Sorry for answering so late but I havent checked my account until now that I'm going to upload another plugin.
It's very easy to use this plugin with nagios. In commands.cfg you can add, by example:

define command{
command_name check_vmfs
command_line $USER1$/check_vmfs.sh -V $ARG1$ -w $ARG2$ -c $ARG3$ -u $ARG4$
}

And in services.cfg by example:
define service{
use generic-service
host_name svrvirtual
service_description Espacio Sauron
check_command check_vmfs!/vmfs/volumes/Sauron!80!90!Gb
}


1 of 2 found this review helpful.
Helpful? Yes 1 No 1
Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
4.9 (16)
Favorites
0
Views
141,444