mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-25 18:38:30 +00:00
if1sec_: initial version
This commit is contained in:
parent
8fbe0ebe27
commit
208874d74d
1 changed files with 44 additions and 0 deletions
44
plugins/network/if1sec_
Executable file
44
plugins/network/if1sec_
Executable file
|
@ -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 <<EOF
|
||||||
|
graph_title Interface 1sec stats for ${IFACE}
|
||||||
|
graph_category 1sec::network
|
||||||
|
graph_data_size custom 1d, 10s for 1w, 1m for 1t, 5m for 1y
|
||||||
|
update_rate 1
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# values
|
||||||
|
cat ${FILE_VALUES}
|
||||||
|
> ${FILE_VALUES}
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue