check free disk space
check free disk space
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.
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.
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: check free disk space
You cannot do this with check_nt but you can with check_nrpe (using NSClient). You would use something like this
http://www.nsclient.org/nscp/wiki/Check ... ze/samples
Code: Select all
check_nrpe -H IP -p 5666 -c CheckDriveSize -a ShowAll MinWarnFree=10% MinCritFree=5G Drive=c:
Re: check free disk space
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!
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!
-
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: check free disk space
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:Exception processing request: Request contained arguments (not currently allowed, check the allow arguments option).
Code: Select all
allow_arguments
Re: check free disk space
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.
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
in my windows.cfg file I have added
To above Nagios is not happy. Do you know what is needed?
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:
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:
}
Code: Select all
define service{
use generic-service
host_name <my host name>
service_description C:\ Drive Space
check_command CheckDriveSize c:,5G!10%
}
-
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: check free disk space
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
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!!!
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
Hi happy,
In your command.ini (command.ini is on the nagios server?) you have the following, correct?
So in your windows.cfg you should have the following:
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
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:
}
Code: Select all
define service{
use generic-service
host_name <my host name>
service_description C:\ Drive Space
check_command CheckDriveSize!CheckDriveSize!10%
}
I hope this is helpful, I'm assuming your command.ini is on your nagios machine.
Kind Regards,
Gary Shergill
-
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: check free disk space
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
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:
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
I appreciate your time!
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
}
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