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

if1sec: fixes

This commit is contained in:
Steve Schnepp 2013-02-04 10:18:40 +01:00
parent 208874d74d
commit 63d61bc52e

View File

@ -7,8 +7,15 @@ cache="$MUNIN_PLUGSTATE/munin.$plugin.value"
IFACE="${0##*/if1sec_}" # interface IFACE="${0##*/if1sec_}" # interface
if [ ! -r "/sys/class/net/$IFACE/statistics/tx_bytes" ]
then
echo "# Unknown Interface : $IFACE"
exit 1
fi
if [ "$1" = "acquire" ] if [ "$1" = "acquire" ]
then then
(
while sleep 1 while sleep 1
do do
echo $( echo $(
@ -19,7 +26,8 @@ then
done | awk "{ done | awk "{
print \"${IFACE}_tx.value \" \$1 \":\" \$2; print \"${IFACE}_tx.value \" \$1 \":\" \$2;
print \"${IFACE}_rx.value \" \$1 \":\" \$3; print \"${IFACE}_rx.value \" \$1 \":\" \$3;
}" >> $cache & }" >> $cache
) &
echo $! > $pidfile echo $! > $pidfile
exit 0 exit 0
fi fi
@ -32,13 +40,16 @@ graph_title Interface 1sec stats for ${IFACE}
graph_category 1sec::network graph_category 1sec::network
graph_data_size custom 1d, 10s for 1w, 1m for 1t, 5m for 1y graph_data_size custom 1d, 10s for 1w, 1m for 1t, 5m for 1y
update_rate 1 update_rate 1
${IFACE}_tx.type DERIVE
${IFACE}_tx.min 0
${IFACE}_rx.type DERIVE
${IFACE}_rx.min 0
EOF EOF
exit 0 exit 0
fi fi
# values # values
cat ${FILE_VALUES} cat ${cache}
> ${FILE_VALUES} > ${cache}
exit 0 exit 0