Skip to content

Instantly share code, notes, and snippets.

@edavis
Created January 21, 2024 04:40
Show Gist options
  • Save edavis/bec5d22be3cd3c2bf70de2769f7375b9 to your computer and use it in GitHub Desktop.
Save edavis/bec5d22be3cd3c2bf70de2769f7375b9 to your computer and use it in GitHub Desktop.
Graph rx and tx separately in munin. Taken from the core if_ plugin but simplified down.
#!/bin/bash
INTERFACE="eth0"
case $1 in
config)
echo "graph_title $INTERFACE rx traffic"
echo 'graph_args --base 1000'
echo 'graph_category network'
echo 'traffic.label rx'
echo 'traffic.type DERIVE'
echo 'traffic.cdef traffic,8,*'
exit 0
;;
esac
echo "traffic.value $(cat "/sys/class/net/$INTERFACE/statistics/rx_bytes")"
#!/bin/bash
INTERFACE="eth0"
case $1 in
config)
echo "graph_title $INTERFACE tx traffic"
echo 'graph_args --base 1000'
echo 'graph_category network'
echo 'traffic.label tx'
echo 'traffic.type DERIVE'
echo 'traffic.cdef traffic,8,*'
exit 0
;;
esac
echo "traffic.value $(cat "/sys/class/net/$INTERFACE/statistics/tx_bytes")"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment