Re: Script to give summarized df report (above n% used...)

From: Janet Jackson (janet@cs.uwa.oz.au)
Date: Thu Jan 30 1992 - 02:49:38 CST


In <1992Jan29.212656.22593@almserv.uucp> s4uhkm@almserv.uucp (Howie Michalski) writes:

>I wrote the following script to mail a list of disk stats to me...

...

>I would like the same report format but I only want to see dev's that are
>over 70% full.

Here is my dfcheck and netdf, which I have run from cron every morning
since August 1990.

netdf host1 host2 ...
   reports 'df' for 4.2 filesystems on host1, host2 ..., using awk to format
   it nicely.

dfcheck
   runs ${HOME}/bin/netdf on all systems in netgroup 'suns', piping through
   egrep to check for filesystems with 90% or more usage. Hack it as you
   please.

Janet Jackson
<janet@cs.uwa.oz.au>
Systems Administrator
Department of Computer Science
The University of Western Australia

--->cut here<---
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
# dfcheck
# netdf
# This archive created: Thu Jan 30 16:54:37 1992
export PATH; PATH=/bin:$PATH
if test -f 'dfcheck'
then
        echo shar: will not over-write existing file "'dfcheck'"
else
sed 's/^X//' << \SHAR_EOF > 'dfcheck'
X#!/bin/sh
X#
X# dfcheck - uses netdf to check for any disks that are >=90% full
X#
X# Janet Jackson (janet@cs.uwa.oz.au), 1990-08-22
X
XSUNS=`ypmatch suns netgroup | sed -e 's/(//g' -e 's/,-,cs\.uwa\.oz\.au)//g'`
X#VAXES="karri"
XVAXES=
XHOSTS="${SUNS} ${VAXES}"
X
X${HOME}/bin/netdf ${HOSTS} | egrep 'Filesystem|9.%|1..%'
SHAR_EOF
chmod +x 'dfcheck'
fi # end of overwriting check
if test -f 'netdf'
then
        echo shar: will not over-write existing file "'netdf'"
else
sed 's/^X//' << \SHAR_EOF > 'netdf'
X#!/bin/sh
X#
X# netdf - show disk usage for the given machines
X#
X# Janet Jackson (janet@cs.uwa.oz.au), 1990-08-22
X#
X# note: I haven't used "df -t 4.2" because that doesn't work on the Vaxen.
X#
X
Xif [ $# -eq 0 ]
Xthen
X echo Usage: netdf host1 host2 ...
Xelse
X awk 'BEGIN { printf( "%-10s%-12s%9s%9s%9s%10s %s\n", \
X "Host", "Filesystem", "Kbytes", "Used", "Avail", \
X "Capacity", "Mounted On" ) }' </dev/null
X for HOST
X do
X rsh -n ${HOST} df | grep '^\/' | \
X awk '{ printf( "%-10s%-12s%9s%9s%9s%10s %s\n", \
X "'$HOST'",$1,$2,$3,$4,$5,$6 ) }'
X done
Xfi
SHAR_EOF
chmod +x 'netdf'
fi # end of overwriting check
# End of shell archive
exit 0



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:35 CDT