2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Changed how tempory filename is created and handled. Now follows example in mktemp documentation.

This commit is contained in:
Finn Andersen 2014-11-01 22:06:51 +01:00
parent b25acb9a2d
commit 678fb563f1

View File

@ -115,9 +115,9 @@ config)
esac
# Location and name of tempfile to parse
FILENAME=$(mktemp /tmp/cisco_epc3010-XXXX.dump) || exit 1
FILENAME=$(mktemp -q) && {
# Safe to use $FILENAME only within this block. Use quotes,
# since $TMPDIR, and thus $FILENAME, may contain whitespace.
# Get statuspage from the modem
curl -s -o $FILENAME http://192.168.100.1/Docsis_system.asp
@ -128,6 +128,8 @@ SNR_ARRAY=( 0 $(awk -F'[<>]' '/ ch_snr/{print $3}' $FILENAME) )
PWR_ARRAY=( 0 $(awk -F'[<>]' '/ ch_pwr/{print $3}' $FILENAME) )
UP_PWR_ARRAY=( 0 $(awk -F'[<>]' '/ up_pwr/{print $3}' $FILENAME) )
rm -f "$FILENAME"
}
#
@ -146,12 +148,10 @@ if [ "$DIRECTION" == "downstream" ]; then
do
printf "channel_%d_snr.value %s\n" $index ${SNR_ARRAY[$index]}
done
exit 0
fi
#
# Upstream info - Modem outputs Power Levels
#
@ -164,11 +164,3 @@ if [ "$DIRECTION" == "upstream" ]; then
done
exit 0
fi
#
# Remove tempory file, used for parsing data
#
trap "rm -rf $FILENAME" EXIT