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


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



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



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.



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



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?



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.



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



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?



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



kehindegb
by kehindegb, December 31, 2012

This script is fantastic !!! does the job.



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.



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,482