Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using Munin on my Ubuntu Jaunty laptop. It shows great graphs for everything, except ppp0, which I use to connect to internet. So I need to configure munin to show ppp0 usage graphs.

I tried going through the documentation and some tutorials, and added if_ppp0 and if_error_ppp0 in the munin-node plugin directory. Created two symlinks, as I am suppossed to, that points to the right plugins, if_ and if_error (just tracked what is done for if_eth0 and if_error_eth0, and done same for ppp0). But it is not sufficient. ppp0 is not amongst the graphs.

I cannot find any config line that suggest editing that will include ppp0 in the monitoring pool. It is a bit surprising that there is nothing written anywhere about ppp considering how popular munin is.

I am good with Perl and bash, also programmed rrd before. So I edited the plugin for if_ and if_error perl file and changed the regex that looks like "eth|wlan|...." to "eth|ppp|wlan|....". Nothing is broken by that, nothing is fixed either. It seems I have to do something else somewhere else, but dont know what it is. Please help.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

The default eth script uses ethtool which won't work on a ppp link.

Also the eth script uses COUNTER instead of DERIVE which will give you a bad spikes every time you reconnect the ppp link.

Here's my script(change up.max, down.max to your ppp links bandwidth)...

#!/bin/sh

INTERFACE=`basename $0 | sed 's/^if_//g'`

if [ "$1" = "autoconf" ]; then
    if [ -r /proc/net/dev ]; then
        echo yes
        exit 0
    else
        echo "no (/proc/net/dev not found)"
        exit 1
    fi
fi

if [ "$1" = "suggest" ]; then
    if [ -r /proc/net/dev ]; then
        egrep '^ *(ppp|eth|wlan|ath|ra|msh|venet|veth)[0-9]+:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'
        exit 0
    else
        exit 1
    fi
fi

if [ "$1" = "config" ]; then

    echo "graph_order down up" 
    echo "graph_title $INTERFACE traffic"
    echo 'graph_args --base 1000'
    echo 'graph_vlabel bits in (-) / out (+) per ${graph_period}'
    echo 'graph_category network'
    echo "graph_info This graph shows the traffic of the $INTERFACE network interface. Please note that the traffic is shown in bits per second, not bytes. IMPORTANT: Since the data source for this plugin use 32bit counters, this plugin is really unreliable and unsuitable for most 100Mb (or faster) interfaces, where bursts are expected to exceed 50Mbps. This means that this plugin is unsuitable for most production environments. To avoid this problem, use the ip_ plugin instead."
    echo 'down.label received'
        echo 'down.type DERIVE'
        echo 'down.graph no'
        echo 'down.cdef down,8,*'
        echo 'up.label bps'
    echo 'up.type DERIVE'
    echo 'up.negative down'
    echo 'up.cdef up,8,*'
    case "$INTERFACE" in
        ath*|wlan*|ra*)
            echo -n "up.info Traffic of the $INTERFACE interface. Maximum speed is "
            which iwlist >/dev/null 2>/dev/null || echo "undeterminable (please install iwlist)."
            iwlist $INTERFACE rate 2>/dev/null | awk '/Current Bit Rate/ { split ($0, arr, "[=:]"); split (arr[2], arr2, "M"); print (arr2[1]*1000000) " bits per second.\nup.max " (arr2[1]*1000000) "\ndown.max "(arr2[1]*1000000); }'
            ;;
        *)
            #echo -n "up.info Traffic of the $INTERFACE interface. Maximum speed is "
            #which ethtool >/dev/null 2>/dev/null || echo "undeterminable (please install ethtool)."
            #ethtool $INTERFACE 2>/dev/null | awk '/Speed/ { split ($2, arr2, "M"); print (arr2[1]*1000000) " bits per second.\nup.max " (arr2[1]*1000000) "\ndown.max "(arr2[1]*1000000); }'
            echo "up.info Traffic of the $INTERFACE interface. Maximum speed is 100000000 bits per second."
            echo "up.min 0"
            echo "down.min 0"
            echo "up.max 100000000"
            echo "down.max 100000000"

            ;;
    esac
    exit 0
fi;

# Escape dots in the interface name (eg. vlans) before using it as a regex
awk -v interface="$INTERFACE" \
    'BEGIN { gsub(/\./, "\\.", interface) } \
    $1 ~ "^" interface ":" {
        split($0, a, /: */); $0 = a[2]; \
        print "down.value " $1 "\nup.value " $9 \
    }' \
    /proc/net/dev
share|improve this answer
    
Thanks mate. I wish someone posted something like this a year ago. May be Munin isn't that popular? –  vulcan_hacker Jan 25 '11 at 4:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.