I'm trying to graph the cummulative bandwidth on an interface using Munin.

Apparently there is a bandwidth_ plugin for this (see http://munin-monitoring.org/browser/munin-contrib/plugins/network/bandwidth_), which I installed and is running since a few weeks now.

I was expecting to see some nice graphs, but everything is set to '0'.

When doing a munin-run, I get null values as well:

# munin-run bandwidth_br0
average.value  0
monthly.value 0
30dayusage.value  0

So I tried to have a look what the code says:

open( my $rx, "<", "/sys/class/net/$interface/statistics/rx_bytes" )
     || die "Unable to read: $!";
$counter_input = <$rx>;
chomp $counter_input;

... and that outputs an ever increasing value like it should:

# cat /sys/class/net/br0/statistics/rx_bytes

My state file contains following info:


Would anyone know where the issue lays or how to debug this further?

Using munin 2.0.17 on Ubuntu Saucy.


I wrote the plugin.

Here is a script I use to dump out the contents of the store file. I'm also interested in knowing if the self discovery identified the correct interface for you.


use Storable;
use Data::Dumper;
my $file="/var/lib/munin-node/plugin-state/nobody/bandwidth_eth1.state";
my $dump;
my $perf_ref;

my $store_ref = retrieve($file);
while (my ($key, $value) = each(%$store_ref) ) {
    $perf_ref->{$key} = $value;

foreach $key (sort keys %$perf_ref) {
if ($key =~ /last/) {
       print "$key\n";
    } else { 
   print scalar(localtime($key)) . "\n";
print Dumper($perf_ref->{$key}) . "\n";

It looks like you are trying to measure br0 which is a virtual interface. It might be better to monitor the physical interface instead. I looked at a bridged interface I had and the results were strange. The receive counter was incrementing nicely while the transmit never changed, even when I pinged it.


I had the same issue with the revision 1.37 of the plugin using Ubuntu 14.04.

I tried to track it down by having perl check the script:

perl -Mstrict -cw bandwidth_

It complained about some strange use of split. I believe split needs a variable to assign the return value to. Probably this was changed in perl in one of the recent versions. The script is a bit dated.

Useless use of split in void context at bandwidth_ line 130.
Useless use of split in void context at bandwidth_ line 132.
Scalar value @_[0] better written as $_[0] at bandwidth_ line 212.
Useless use of split in void context at bandwidth_ line 211.

I do not care about the suggest function as i have already symlinked the plugin to the eth0 interface. Likely that part needs to be changed as well if you need it. The problem in my case was $uptime always being undefined, resulting in the return of 0.

So I changed the subroutine uptime to assign the return value to a variable and then use that.

sub uptime {
    my $puptime = "/proc/uptime";
    open( TIME, "<", $puptime ) || die "Unable to read $puptime: $!";
    while (<TIME>) {
        my @arr = split;
        $uptime = $arr[0];
    chomp $uptime;

Now the plugin return values looking quite plausible.

  • I have submitted a patch to github. You also try updating your script instead of self-patching. – user228505 Jul 21 '14 at 20:02
  • Hello @user228505 where is the github patch? Thanks – eLBati May 3 '16 at 14:32
  • Hello @eLBati the patch was merged Jul 2014, so if you have a similar issue, try updating your plugins. github.com/munin-monitoring/contrib/pull/504 – user228505 May 7 '16 at 8:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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