Home Directory Plugins Operating Systems Linux VMWare ESX vdf Virtual File System Check

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

VMWare ESX vdf Virtual File System Check

Rating
0 votes
Favoured:
0
Hits
161028
Files:
FileDescription
check_vdisk.shThe bash script
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!
Checks free space on VMWare ESX 3.5 vmfs datastores using /usr/sbin/vdf -h.
+++ check_vdisk.sh
This script was made for ESX 3.5. I imagine this will work on future and past version of ESX but I don't know.

++++ Summary
df does not include vmfs volumes in ESX (at least not in 3.5). I wrote this plugin to check vmfs datastores after I ran into a redo.log full error that cause my virtual machine to shut down!

It's a bit different than the official nagios disk checker. It doesn't use percentages for checking disk space. You specify the free space remaining (in Gigabytes) that will trigger a warning, and a critical alarm. Also when specify the volume, use the "Mounted on" information and not "device". And there are no command line options, just put the numbers after the shell script.

++++ Installing
Example

(output from df -h)

Filesystem Size Used Avail Use% Mounted on

/dev/sda3 27G 17G 8.7G 67% /home

/dev/sda1 99M 26M 69M 28% /boot



Let's say I want to check the /home drive. I want it to alarm me when I have 5 GB available with a warning, and I want a critical alarm when I have 2 GB available. Here is how my command would look like


/usr/local/nagios/libexec/check_vdisk.sh 5 2 /home


Now, we want this to run with NRPE right? but /usr/sbin/vdf will only work as root in ESX so we need to use 'sudo'! Your nrpe.cfg might have a line that looks like this


commandcheck_home_volume=sudo /usr/local/nagios/libexec/check_vdisk.sh 5 2 /home


Now we need to edit the /etc/sudoers file. Use '/usr/sbin/visudo' or else you might mess up your /etc/sudoers file!

Right below where it says (maybe your distribution differs)

# User privilege specification
root ALL=(ALL) ALL


Enter this:

nagios ALL = (ALL) NOPASSWD: /usr/local/nagios/libexec/check_vdisk.sh


As I understand it, this means allow the user nagios, on 'ALL' servers (where this sudoers file is used) to execute as root without using a password (very important!) on the following command '/usr/local/nagios/libexec/check_vdisk.sh'

Restart NRPE (Hey I have a script for this in my projects) and test. It should work unless I've forgotten something, or you screwed up, or my script doesn't work on your system!!

++++ Caveats/gotchas
*If you are trying to check your "/" it isn't going to work because it will match all of your volumes. Use the nagios official plugin for this!
*If you have a datastore that is so low on disk space that it is reporting in MB, then this script will just report it as having no space left. This is due to integer math in bash. I don't think it's such a big deal (At least not to me, and I did write this script for myself =o)
*You can probably accomplish this easier by editing the c files that come with the official nagios plugins? I don't know. I just wanted to learn something about scripting so please don't bash me if you don't like my script. I have at least tried to give you a lot of documentation which not every does!!