Page 1 of 1

Check disk error

Posted: Thu Nov 18, 2010 1:00 pm
by jovin
Hi, first thing first - I'm new to nagios and to Linux - sorry.

I've setup nagios and it seems to be working. But, when I setup a definition to check hard drive space on one of my test linux box and run nagios -v. I get an error message.

Error: Service check command 'check_disk -w 10% -c 5% /tmp -p /var -C -w 100000 -c 50000 -p /' specified in service 'linux1.test.com' for host 'linux1' not defined anywhere!

I found this link - http://nagiosplugins.org/man/check_disk
And, this sample below.
check_disk -w 10% -c 5% -p /tmp -p /var -C -w 100000 -c 50000 -p /
Checks /tmp and /var at 10% and 5%, and / at 100MB and 50MB

This is where I got the idea from.

I've also tried this
define service {
use local-service
host_name localhost
service_description Root Partition
check_command check_local_disk!20%!10%!/
}
After defining this and running nagios -v - I get no errors. But, when I tested it by filling up the hd with dummy files. It doesn't alert me of the status of the filled HD. So, that's when I tried the "check_disk".

Please help - thanks.

Re: Check disk error

Posted: Thu Nov 18, 2010 1:51 pm
by jovin
Failed to mention that I've added this on the command.cfg

define command{
command_name check_disk
command_line $USER1$/check_disk -w $ARG1$ -c $ARG2 -C -p $ARG3$ -p $ARG4$ -C -w $ARG5$ -c $ARG6$
}

I don't think it helps to solve it but I thought I'd bring it up.

Thx.

Re: Check disk error

Posted: Wed Dec 08, 2010 2:59 am
by bharti
Hi,

Check_disk plug-in is used to check the used space of a mounted partition .
If you like to check your local machine disk space then you have to write a command in command.cfg like:
define command{
command_name check_local_disk
command_line $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
}
along with this you need to create one localhost.cfg file to define service for each and every command
so service would be
define service{
use local-service ; Name of service template to use
host_name localhost
service_description Root Partition
check_command check_local_disk!20%!10%!/
}
remember this solution is for only localhost.
Now If you like to show disk space of remote machine, after installation of nrpe on remote desktop, modify /usr/local/nagios/etc/nrpe.cfg file
and add following command inside nrpe.cfg file
command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1

Now do some settings in nagios server , go to /usr/local/nagios/etc/objects and create one file remotehost.cfg to prepare service defination like add following code inside remotehost.cfg
# Define a service to check the disk space of the root partition
# on the local machine. Warning if < 20% free, critical if
# < 10% free space on partition.

define service{
use generic-service ; Name of service template to use
host_name remotehost
service_description Root Partition
check_command check_nrpe!check_disk
}
now run the command to check nagios configuration.