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?


Well, I found a solution for this:

  1. I've compiled and installed the check_file plugin.
  2. Created a file on the NAS root: .nagioscheck.
  3. 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:

This version of df cannot show the space available on unmounted file systems, because on most kinds of systems doing so requires very nonportable intimate knowledge of file system structures.

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:

sudo tune2fs -l /dev/sdb1

Is there any way for the nagios server to query the NAS directly? That would be the most direct course of action.

  • 1
    Good point I think, a good NAS should have SNMP support. – Kyle Brandt Jun 18 '09 at 15:33
  • 1
    Exactly. The disk usage should be monitored on the file server, not the clients. – Kamil Kisiel Jul 22 '09 at 23:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.