From 208874d74d128f856ff9ed1c1a24090d480c2898 Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Sun, 3 Feb 2013 21:34:36 +0100 Subject: [PATCH] if1sec_: initial version --- plugins/network/if1sec_ | 44 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 plugins/network/if1sec_ diff --git a/plugins/network/if1sec_ b/plugins/network/if1sec_ new file mode 100755 index 00000000..fe07f4a9 --- /dev/null +++ b/plugins/network/if1sec_ @@ -0,0 +1,44 @@ +#! /bin/sh + +pluginfull="$0" # full name of plugin +plugin="${0##*/}" # name of plugin +pidfile="$MUNIN_PLUGSTATE/munin.$plugin.pid" +cache="$MUNIN_PLUGSTATE/munin.$plugin.value" + +IFACE="${0##*/if1sec_}" # interface + +if [ "$1" = "acquire" ] +then + while sleep 1 + do + echo $( + date +%s + cat /sys/class/net/$IFACE/statistics/tx_bytes + cat /sys/class/net/$IFACE/statistics/rx_bytes + ) + done | awk "{ + print \"${IFACE}_tx.value \" \$1 \":\" \$2; + print \"${IFACE}_rx.value \" \$1 \":\" \$3; + }" >> $cache & + echo $! > $pidfile + exit 0 +fi + + +if [ "$1" = "config" ] +then + cat < ${FILE_VALUES} + +exit 0 +