echocat / nagios-plugin-check_mountpoints Goto Github PK
View Code? Open in Web Editor NEWNagios check if all specified nfs/cifs/davfs mounts exist and if they are correct implemented.
Nagios check if all specified nfs/cifs/davfs mounts exist and if they are correct implemented.
I'm trying this script on CentOS7.1, and while it's working correctly with one server, but not another. On investigation on the non-working server the CIFS mounts had trailing /'s on both the source and mountpoint. Removing the trailing / fixed the issue - but perhaps the script can catch this and not error?
What is wrong here?! :-O
root@nfsclnt ~ # grep -i nfsserver /etc/vfstab
nfsserver:/mnt - /mnt nfs - yes rw,xattr
root@nfsclnt ~ # grep -i nfsserver /etc/mnttab
nfsserver:/mnt /mnt nfs rw,xattr,dev=9300001 1507803587
root@nfsclnt ~ # ./check_mountpoints.sh /mnt
CRITICAL: /mnt is not mounted ;
Hi,
any prevision to check local mountpoints also?
Hello
No really an issue, here is a request for improvement. ^^
In this script, how can I prevent the display of the first two lines? I think it would be better without these two lines.
when i redirect stderr, all is good but i need this directly in script.
what do you think about it ?
Thanks
.
nagios@mycomputer:/home/nagios$ perl check_mountpoints -a
check_mountpoints: line 88: 21397 Terminated df -k ${MP} &>/dev/null
check_mountpoints: line 280: 21406 Terminated df -k ${MP} &>/dev/null
CRITICAL: /srv/spam/toto did not respond in 3 sec. Seems to be stale. ; /srv/spam/titi did not respond in 3 sec. Seems to be stale. ;
nagios@mycomputer:/home/nagios$ perl check_mountpoints -a 2>/dev/null
CRITICAL: /srv/spam/pushit/NotiftoSend did not respond in 3 sec. Seems to be stale. ; /srv/spam/pushit/feedbacks did not respond in 3 sec. Seems to be stale. ;
Hi,
First, thanks for the code check. I wish that the script work on FreeBSD with ZFS.
The code is actually running on several machines (Linux CentOS (XFS and FreeBSD) without problems.
I've done several changes (bash => sh) and some tweaks to be compliant with zfs (no fstab) and readonly filesystem for zfs send snapshot purpose.
Could you check my changes and tell it's enough clean to integrate it to the main tree of the project ?
I think it could be a good feature added :)
Thanks
Bertrand
Some options needs a second parameter.
If it's omitted, no check/error .. script waits
Hello, I have same problem like here: #41
when runnig locally as nrpe user:
su nrpe
[nrpe@srv]
/ # /usr/lib64/nagios/plugins/check_mountpoints.sh -a
OK: all mounts were found ( /boot /fbdata /home /tmp /usr /var /mnt/backup )
/mnt/backup is fully accessible for nrpe user, tested and works!
even this work when root:
[root@srv]
/ # sudo -u nrpe /usr/lib64/nagios/plugins/check_mountpoints.sh -a
OK: all mounts were found ( /boot /fbdata /home /tmp /usr /var /mnt/backup )
but, when I call with nrpe:
[root@srv]
/ # /usr/lib64/nagios/plugins/check_nrpe -H 127.0.0.1 -c check_mntpoints
CRITICAL: /mnt/backup doesn't exist on filesystem ;
and
[nrpe@srv]
/ # /usr/lib64/nagios/plugins/check_nrpe -H 127.0.0.1 -c check_mntpoints
CRITICAL: /mnt/backup doesn't exist on filesystem ;
ps | grep nrpe
nrpe 10551 0.0 0.0 41492 1480 ? Ss 10:47 0:00 /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d
nrpe.cfg:
log_facility=daemon
nrpe_user=nrpe
nrpe_group=nrpe
command[check_mntpoints]=sudo /usr/lib64/nagios/plugins/check_mountpoints.sh -a
/mnt/backup is nfs mountpoint
ls -la /mnt/
drwxr-xr-x. 3 root root 4096 Nov 22 2016 .
drwxr-xr-x. 23 root root 4096 Sep 15 11:04 ..
drwxr-xr-x. 20 root root 4096 Oct 25 09:40 backup
/etc/fstab
192.168.101.130:/backup /mnt/backup nfs auto 0 0
Any idea?
Thanx for help
VicC
Hi,
Found a bug in that when calling the script with a -w option it will only work if -a or -A is used. Appears to be a bug with the logic here -> https://github.com/echocat/nagios-plugin-check_mountpoints/blob/master/check_mountpoints.sh#L363
Hi,
I've been using this to great success for some time, via nrpe. However, I recently deployed this check to a newly built server, and am getting strange results irrespective as to how it's configured/run.
Basically, if I run the check locally on the server I get:
[root@hostname123 ~]# su - nrpe -s /bin/bash -bash-4.1$ /usr/lib64/nagios/plugins/check_mountpoints.sh -m /etc/mtab -f /etc/fstab -N 3 -M 2 -T 3 -i -w /data/mysql/backups OK: all mounts were found ( /data/mysql/backups) -bash-4.1$ /usr/lib64/nagios/plugins/check_mountpoints.sh -m /etc/mtab -A -wOK: all mounts were found (/data/mysql/backups ) -bash-4.1$ /usr/lib64/nagios/plugins/check_mountpoints.sh -m /etc/mtab -a -w OK: all mounts were found (/data/mysql/backups )However, whenever I run this from my nagios server (just for this one host: It works just fine on every other box I'm checking) I get the following:
[nagios@nagios_server ~]$ /usr/local/nagios/libexec/check_nrpe -H hostname123 -c check_nfs_mounts CRITICAL: /data/mysql/backups don't exists in filesystem ;That path most certainly exists, and all other nrpe checks are working just fine.
Any help is greatly appreciated.
Thanks.
I have a lot of snapshots (every 15 min) and always enable listsnapshots.
This script needs very long for testing all snapshots and meanwhile a lot of snapshots expire:
The fix is:
- for DS in $(zfs list -H -o name); do
+ for DS in $(zfs list -H -o name -t filesystem); do
Hi,
I have a few NFS mounts, on a Centos 6.4 2.6.32-358.el6.x86_64. They are mounted and working, but when executing the check :
$ df -h
Filesystem Size Used Avail Use% Mounted on
[...]
192.168.3.65:/var/sharedServices/web/images 239G 70G 157G 31% /var/sharedServices/web/images``$ /usr/lib64/nagios/plugins/check_mountpoints.sh -a
CRITICAL: /var/sharedServices/web/images/ is not mounted ;
Hi
If I check the script via check_nrpe I get a critical back
check_nrpe -H server1 -c check_mounts
CRITICAL: /data/dir1 doesn't exist on filesystem
but if I run the script locally (@server1) it gives back the correct information
/usr/lib/nagios/plugins/check_mountpoints.sh -a
OK: all mounts were found ( /data/dir1 )
my nrpe.cfg on the checked server1 is
command[check_mounts]=/usr/lib/nagios/plugins/check_mountpoints.sh -a
/data/dir1 is a NFS mountpoint
Any idea why I get this?
Many thanks!!
Hello
Nice plugin but i have an issue.
I use -a option to check all mountpoints and -w to write file but manytimes machines are ro mountpoints and touch don't work, its normal.
I suggest you to insert a condition in line 266, but i think my code is not the better way to exclude RO mountpoints for this test.
elif [ ${WRITETEST} -eq 1 ] && egrep -q "${MP}.*rw" ${FSTAB}; then
## if wanted an RW, check if it is writable
TOUCHFILE=${MP}/.mount_test_from_$(hostname)
touch ${TOUCHFILE} &>/dev/null
if [ $? -ne 0 ]; then
log "CRIT: ${TOUCHFILE} is not writable."
ERR_MESG[${#ERR_MESG[*]}]="${TOUCHFILE} is not writable."
else
rm ${TOUCHFILE} &>/dev/null
fi
Hi Folks,
Thought it might be worth floating the idea of contributing this check to the folks at Monitoring Plugins .org. That way it could get bundled up into package releases and maintained more centrally.
According to the fstab man page, spaces in target mount point directories should be replaced with \040
. This isn't correctly handled and generates an error saying that the directory doesn't exist. I was hoping a simple ${MP/\\040/ }
replacement at the top of the MPS for loop would fix it but just causes issues elsewhere.
If a mountpoint in fstab contains a trailing slash the check for that mount will fail to find the correctly mounted filesystem since the slash is not included in /proc/mounts
I've got obviously the case that the variable ISFW gets no value, thus "",
having this line 368 the if cannot be interpreted correctly.
In line 351 I set the value to 0 which helped.
Hello I've got a problem with autodetection from fstab.
Version 2.0 have found only
/
/backup
/replica
But my actual mountpoints in fstab are:
/ = ext4
/boot = ext2
/backup = ext4
/replica = ext4
so I've tried adding /boot mount manually and it said that /boot is not in /etc/fstab and is not mounted at all
So I've updated to the newest version and result of my command with autodetection is:
/usr/lib64/nagios/plugins/check_mountpoints.sh -a
OK: all mounts were found ( /backup /replica )
But when I manually added / /boot /backup and /replica:
/usr/lib64/nagios/plugins/check_mountpoints.sh / /boot /backup /replica
OK: all mounts were found ( / /boot /backup /replica)
Is there any solution to this? :) I've tried also the -f option with no results
Regards,
vasiliev
Hello,
where should I insert a delete so it doesn't screw up the script.
I monitor a bunch of windows-shares and the amount of .mount_test_files is huge.
Thank you
hello i've integred the nagios plaguin on opsview , testing it locally it's working but the pluguin is not working on my Opsview server.
this is the configuration made : -H
the error i get is :
Status Information | NRPE: Unable to read output
by troubleshooting i got : Caught exception in Opsview: :Web::Controller::REST::TestServiceCheck->do_testservicecheck "Unhandled macros"
Any ideas ?
Thanks
Every now and then, we get this output:
which: no logger in ((null))
It's erratic, and cannot be reproduced manually. Any idea what might cause this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.