A Nagios-plugin to check if a device is mounted.
Those of you that have a bigger NFS infrastructure may know the problem, that some shares may unmount itself or won’t be mount correctly after reboot. This plugin checks whether a device a mounted on a specific mount point.
To run it just give it the mount point you’re looking for:
If you additionally define which mount type you expect, this plugin will check whether your expectation matches. Just try it out ;)
Maybe you have to modify the location of your
utils.pm by updating the
lib -path in line 13.
Please consider to take a look at my general setup notes.
Download: Perl: check_mount.pl (Please take a look at the man-page. Browse bugs and feature requests.)
Leave a comment
There are multiple options to leave a comment:
- send me an email
- submit a comment through the feedback page (anonymously via TOR)
- Fork this repo at GitHub, add your comment to the _data/comments directory and send me a pull request
- Fill the following form and Staticman will automagically create a pull request for you:
I’m strugging to set this plugin up. I can execute it correctly from the CLI but nrpe is showing
NRPE: Unable to read output
This is the error I’m getting
Can you pls guide me how could I make it work ?
Thanks in advance Liju
Make it worked by adding nagios plug-ins directory in that script file like this
use lib '/usr/local/nagios/libexec';
I expected to find the Nagios’
/usr/lib/nagios/plugins. I’ll update my articles to supplement it with a note about this variable ;-)
Thanks for your advice!
First off, sane exiting from the usage statement, in the event someone adds a check, but forgets the mount point..
In case of a mount point sitting under another like this:
then you actually catch both in your $erg grep … To only catch the one filesystem you are looking for is doing something like this (ugly) hack ..
Also CIFS mounts may lose connectivity to the server sharing the folder, but will recover on its own. In the meantime you’ll not be able (of course) to do anything with data in that mountpoint. What distinguishes things is simply a directory listing which will contain nothing but a number of question marks if you do a long listing (
ls -l) ..
So, I’ve added a little bit of code, for this specific case (and changed a regexp along the way) …
Appears to be working nicely during initial tests. YMMV…
Thanks for your efforts, I’ll upgrade my version! ;-)
Hi. Thank you for this plugin. P.S. For getting this plugin work with SELnux you should set at least
nagios_unconfined_plugin_exec_ttype. for e.g.
semanage fcontext -a -s system_u -t nagios_unconfined_plugin_exec_t -f -- '/etc/nagios/plugins/check_mount.pl'
Thank you for this tiny but extremely useful script! Works like a charm for me and does what check_disk isn’t any use.
Hello. First of all thank you for supplying very nice plugin though.
I’m the newbie of using nagios. I’d like to suggest you how about to change the line number 14 from
use utils qw(%ERRORS);to
use Nagios::Plugin qw(%ERRORS);
Development doc says that
utils.pmis gonna deprecated soon or later.
Where did you read that
utils.pmis going to be deprecated? The website of that perl module Nagios::Plugin links to the guidelines in which they recommend the usage of