[SunHELP] filesystem monitor script

Ledger, David sunhelp at sunhelp.org
Tue Apr 3 02:41:57 CDT 2001


A one-liner:
df -k | awk '$1 ~ /^\/dev\//{sub(/%/,"",$5);if ($5 > 75) {printf("%s is %d%%
full\n", $NF, $5)}}'

Expanded for visibility:
df -k | awk '
	# On those df lines that refer to local devices
	$1 ~ /^\/dev\// {
		# chop the '%'
		sub(/%/,"",$5)
		# Check against 75%
		if ($5 > 75) {
			# Report (NF is awk var for no of fields. $NF
returns last field contents).
			printf("%s is %d%% full\n", $NF, $5)
		}
	}'

v v v v v v v v
> Can anybody get me a monitoring script that will report when the
filesystem 
> is over 75%
> Thanks
> Wally
=====================================================================
This email and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they   
are addressed. If you have received this email in error please notify 
gpupower.co.uk or postmaster at npower.com

This outgoing e-mail (and any attachments) has been checked
(using Sophos Sweep 3.43 + patches) before leaving us (UK 08457 353637),
and has been found to be clean from any virus infection.

=====================================================================



More information about the SunHELP mailing list