I've been using check_disk
without problems until yesterday to check the free space in some partitions.
Now we just added a NAS service from our hosting and I could mount it without problems, and, since we have a fixed amount of space, I would like to check the free space with Nagios for not being overcharged.
The problem is sometimes when check_disk
goes to check then I get "unknown" status since of course autofs don't maintain the partition mounted 100% of the time. (Nagios-users) check_disk and autofs recommends making a wrapper for the plugin, but I don't feel comfortable with that.
Any idea about a better solution?
Edit:
Well, I found a solution for this:
- I've compiled and installed the check_file plugin.
- Created a file on the NAS root:
.nagioscheck
. - Configured Nagios to check often if this file exists, rather than check the space.
So I can check if the NAS is mounted and the free space.
SERVICE STATUS: OK file or directory /mnt/backup/.nagioscheck exists
Why not make a static entry in fstab instead using automount so it is always mounted?
In the GNU df manual:
So I would guess if GNU df is not going to show the free space of a partition that is not mounted, a Nagios plugin probably won't either. But I could be wrong :-)
Maybe if you are using ext2/3 , by parsing out free blocks, block count, and block size out of tune2f you might be able to quickly write a plugin that will accomplish this:
Is there any way for the nagios server to query the NAS directly? That would be the most direct course of action.