Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_vmfs.sh - Check vmfs datastores through VMware VCLI
- Nagios 3.x
- Nagios 4.x
File | Description |
---|---|
check_vmfs_1.5.1.tar.gz | 1.5.1 Fixing awk multiple matching (Thanks to Martin Niedworok) |
check_vmfs_1.4.tar.gz | 1.4: Fixed some mistakes in script when some parameter is missing |
check_vmfs_1.5.tar.gz | 1.5: Working with Esxi 5.x |
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).
which was present in 5.x versions (not in 4.x versions which plugin was made for).
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
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.
[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
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.
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
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.
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?
Could you write some more details please?
I have just set up my nagios and finaly I have free overview of my esxi's datastores.
Thanks Javier
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.
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
}