[Xymon] Question on df processing for xymonclient-linux.sh
Deiss, Mark
Mark.Deiss at acs-inc.com
Thu Apr 12 16:11:43 CEST 2012
In looking df processing in the Linux Xymon client module in
client/xymonclient-linux.sh:
echo "[df]"
EXCLUDES=`cat /proc/filesystems | grep nodev | awk '{print $2}' | xargs
echo | sed -e 's! ! -x !g'`
df -Pl -x iso9660 -x $EXCLUDES | sed -e '/^[^ ][^ ]*$/{
N
s/[ ]*\n[ ]*/ /
}'
A bit concerned that the df line can have a dangling "-x" option if the
EXCLUDES variable is not populated. With a dangling "-x", the df command
will abort with a syntax error and the df status will probably end up
with a green status with no rrd history being populated. Users would not
be aware unless they specifically brought up the green disk display or
were reviewing disk trends and noticing the gap.
The EXCLUDES variable can become null if the xymon client account loses
read access to /proc/filesystems, for some reason the Linux flavor quit
using the nodev tag (maybe started using NODEV or Nodev after a patch
update....) or the xymon client went onto an (older) Linux version that
did not use the /proc system.
Suggest a revision either using sed or awk to build the EXCLUDES
variable and a modification of the df command to eliminate the dangling
"-x" option
EXCLUDES=`cat /proc/filesystems 2>/dev/null | awk ' $1 ~ /nodev/ {
printf("-x %s ", $2) }'`
Or
EXCLUDES=`cat /proc/filesystems 2>/dev/null | sed -ne '
/nodev/{
s/nodev[ ]*/ -x /
H
}
${
x
s/\n//g
p
}'`
df -Pl -x iso9660 $EXCLUDES 2>/dev/null | sed -e '/^[^ ][^ ]*$/{
N
s/[ ]*\n[ ]*/ /
}'
If the parsing for nondev entries in /proc/filesystems now blows up for
whatever reason (EXCLUDES is null), the df command will be capturing
more than is desired which I believe would be preferred over missing the
important file systems. Would like to use "2>&1" rather than
"2>/dev/null" in the df line except any captured error lines may cause
some downstream havoc with the rrd database processing.
More information about the Xymon
mailing list