Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

check_disc_usage

Hits
147858
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
No longer maintained. Do it with SNMP using the pathced version from the Manubulon plugins.
https://github.com/dnsmichi/manubulon-snmp
By Martin Fuerstenau
The problem: Monitor discusage on all Unix/Linux-Maschines
Unfortunately on some older maschines (Reliant Unix) there was no net-snmp and the standard SNMP supported only the standard network features.



Using ssh for monitoring was no option due to security issues and some legal issues like SOX (Sarbanes Oxley Act).



Solution: Running df -kl as a service through inetd or xinetd.

You need netcat as a tool First you have to add a line like



diskusage stream tcp nowait root /bin/df df -kl



to inetd.conf. For xinetd you have to add a file to the config-directory (/etc/xinetd.d) containing the following:



service diskusage

{

socket_type = stream

protocol = tcp

wait = no

user = root

server = /bin/df

server_args = -kl

}



Usually I name the file diskusage. Next you have to assign a port in /etc/services as
well as on the monitored server as on the monitor host. I call the port diskusage,
but the name and the port number are not mandatory.



/etc/services:



diskusage 59990/tcp



If you type in "netcat hostname diskusage" on a shell prompt you should get the output of the df -kl. If it will not work check firewall settings and so on.



This script takes the output and does the rest. But beware. The "percentage used" of the output will differ from the real usage. the an amount of space reserved for root and/or as a security. This amount differs from system to system (Linux, Solaris...).



Why do I mention that? On some systems like Reliant Unix you can see more than 100 % used. On other systems in some special situations 100% will not be a problem (i.e. Oracle tablespaces). Thereforethis script looks for the usage displayed. If it is greater or equal 100% the real usage will be calculated and displayed as output together with the one displayed by df -kl.
Reviews (1)
byeuqnoj, June 11, 2011
As was said you will need "netcat" that isn't part of the base build and if you install from source you will need to modify the script with the location of netcat.

All else is fat, dumb and happy. Works like a charm and you can modify the output message to fit your needs. Great work man!