Page 1 of 2
check free disk space
Posted: Fri Jan 25, 2013 5:16 pm
by happy
Hi
I am using Nagios command (check_nt!USEDDISKSPACE!-l f -w 90 -c 95) to send alert if used space is over 90% / 95%).
I am now looking into setting up alerts if free disk space is lower than say 5GB. I believe Nagios core is not able to do it but a script or plug-in could be used to do that.
I wonder if anyone has a script/ plug-in that they can share which can send alerts based on free disk space integer.
Thanks.
Re: check free disk space
Posted: Mon Jan 28, 2013 12:42 am
by scottwilkerson
You cannot do this with check_nt but you can with check_nrpe (using NSClient). You would use something like this
Code: Select all
check_nrpe -H IP -p 5666 -c CheckDriveSize -a ShowAll MinWarnFree=10% MinCritFree=5G Drive=c:
http://www.nsclient.org/nscp/wiki/Check ... ze/samples
Re: check free disk space
Posted: Wed Mar 06, 2013 7:06 pm
by happy
Hi scottwilkerson
Thank you for taking time to reply - apologies that it took me a while to work on this.
When I run the command you provided from the terminal I get the following:
# ./check_nrpe -H <xxx.xxx.xxx.xxx> -p 5666 -c CheckDriveSize -a ShowAll MinWarnFree=10% MinCritFree=5% Drive=c:
Exception processing request: Request contained arguments (not currently allowed, check the allow arguments option).
# ./check_nrpe -H <xxx.xxx.xxx.xxx> -p 5666
I (0,4,1,66 2012-11-18) seem to be doing fine...
verifies that check_nrpe is available is is able to reach the host.
Do you know which option may not be allowed and how to fix it?
THANKS!
Re: check free disk space
Posted: Thu Mar 07, 2013 10:45 am
by slansing
Exception processing request: Request contained arguments (not currently allowed, check the allow arguments option).
Have you checked the allow arguments option? It is located within the configuration file "NSC/nsclient.ini" and should be titled along the lines of:
Re: check free disk space
Posted: Thu Mar 07, 2013 2:40 pm
by happy
Hi
Thank you for replying and pointing me to the correct direction. I was able to made necessary changes to the config file and now I am able to run the following command from terminal and get the expected output.
Code: Select all
./check_nrpe -H <my host ip address> -p 5666 -c CheckDriveSize -a ShowAll MinWarnFree=10% MinCritFree=5G Drive=f:
I am fairly new to Nagios and when I try to integrate it into Nagios I run into issues. Do you know what is the missing part of the puzzle?
In my command.ini file I have added
Code: Select all
define command {
command_name CheckDriveSize
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckDriveSize -a ShowAll MinWarnFree=$ARG2$ MinCritFree=5G Drive=c:
}
in my windows.cfg file I have added
Code: Select all
define service{
use generic-service
host_name <my host name>
service_description C:\ Drive Space
check_command CheckDriveSize c:,5G!10%
}
To above Nagios is not happy. Do you know what is needed?
Re: check free disk space
Posted: Thu Mar 07, 2013 4:47 pm
by slansing
I think I have spotted the problem, in your command definition change the command_line to the following:
Code: Select all
$USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ -a ShowAll MinWarnFree=$ARG2$ MinCritFree=5G Drive=c:
Code: Select all
check_command check_nrpe!CheckDriveSize!15!
Re: check free disk space
Posted: Fri Mar 15, 2013 4:11 pm
by happy
Hi Slansing
The changes you recommended has not fixed the issue. After making the changes when I run pre flight test I get the error:
Error: Service check command 'check_nrpe' specified in service 'C:\ Drive Space' for host '<myhostname>' not defined anywhere!
If I commend out the service_description line in the windows.cfg then I don't get any error but I don't receive any alerts either.
Do you know if I need to define service_description at another place first?
Thanks!!!
Re: check free disk space
Posted: Mon Mar 18, 2013 4:37 am
by gshergill
Hi happy,
In your command.ini (command.ini is on the nagios server?) you have the following, correct?
Code: Select all
define command {
command_name CheckDriveSize
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ -a ShowAll MinWarnFree=$ARG2$ MinCritFree=5G Drive=c:
}
So in your windows.cfg you should have the following:
Code: Select all
define service{
use generic-service
host_name <my host name>
service_description C:\ Drive Space
check_command CheckDriveSize!CheckDriveSize!10%
}
In command.ini you define a "command_name", which is used for the "check_command" in the windows.cfg. The format of "check_command" is normally "command_name!<ARG1>!<ARG2>.....".
I hope this is helpful, I'm assuming your command.ini is on your nagios machine.
Kind Regards,
Gary Shergill
Re: check free disk space
Posted: Mon Mar 18, 2013 10:53 am
by slansing
Doh! How did I not see that... I must have ran out of coffee. Thank's for the input as always Gshergill!
Re: check free disk space
Posted: Thu Mar 21, 2013 5:48 pm
by happy
Hi gshergill and Slansing
Thank you for all your help. I was able to get the required results and configured it as required. I currently have:
Code: Select all
define command {
command_name CheckDriveSize
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ -a ShowAll MinWarnFree=$ARG2$ MinCritFree=5G Drive=c:
}
define service{
use generic-service
host_name <myhostname>
service_description C:\ Drive Space
check_command CheckDriveSize!CheckDriveSize!5G
}
How can I change the command_line 'Drive=c' into argument so that I am able to check multiple drive letters with the same command_line?
I tried the following but it did not work and I am not able to figure it out
Code: Select all
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ -a ShowAll MinWarnFree=$ARG2$ Drive=$ARG3$ MinCritFree=5G
check_command CheckDriveSize!CheckDriveSize!c:!CheckDriveSize!5G
I appreciate your time!