Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 61 lines (50 sloc) 1.17 KB
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;
use Net::FCP::Tiny;
=head1 NAME
freenet_network_io_bytes - Graph Freenet's network I/O throughput
=cut
given ($ARGV[0]) {
when ("config") {
print <<"END";
graph_title Freenet total I/O
graph_args --base 1024 --lower-limit 0
graph_vlabel bytes per \${graph_period} input (-) / output (+)
graph_category freenet
graph_info The total I/O of Freenet in bytes for this session
input.label input
input.type GAUGE
input.draw LINE
input.graph no
input.info Input
output.label total I/O
output.type GAUGE
output.draw LINE
output.negative input
output.info Output
END
}
default {
my $fcp = Net::FCP::Tiny->new(
name => 'Freenet Munin Plugin',
host => $ENV{FREENET_HOST},
port => $ENV{FREENET_PORT},
);
my ($input, $output) = (0,0);
if ($fcp) {
my $info = $fcp->array2hash($fcp->send_msg(<<'END'));
GetNode
WithPrivate=false
WithVolatile=true
EndMessage
END
($input, $output) = @$info{qw(volatile.totalInputBytes volatile.totalOutputBytes)};
}
print <<"END";
input.value $input
output.value $output
END
}
}