Search code examples
nagiosdisk

nagios check_disk returns "not accessible: No such file or directory" for mounted paths


My Nagios works with check_disk on "/" but failed for mounted paths. My command definition looks like this:

define command{
    command_name    check_local_disk
    command_line    $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
    }

And in client.cfg it looks like this:

define service{
    use                             local-service
    host_name                       10.62.81.166
    service_description             /storage/disk1
    check_command                   check_local_disk!20%!10%!/storage/disk1
    }

The /etc/fstab looks like this:

/dev/sdb /storage/disk1 ext4 rw 0 0 

I tried pass value like /dev/sdb or /storage/disk1 but error all same - not accessible: No such file or directory

I tried running command in nagios user in remote client and it works fine.

Any possible clues?

Thanks.


Solution

  • For the check_disk command to work, the target must both 'exist' AND be 'accessible' by the user running check_disk (perhaps user 'nagios' in your case?). There is likely a security setting on the mount point that is preventing the Nagios user from running the 'stat' command against that specific mount point. If this is the case, the easiest solution would be to add the Nagios user to a shared group with the owner of the partition. The Nagios user would require 'read' access.