/usr/share/munin/plugins/cubemap_input is in cubemap 1.2.1-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | #! /usr/bin/perl
use strict;
use warnings;
use Munin::Plugin;
my $input_stats_filename = $ENV{"cubemap_input_stats"} // "/var/lib/cubemap/cubemap-input.stats";
my $mode = $ARGV[0] // "print";
if ($mode eq 'config') {
print "graph_title Cubemap inputs\n";
print "graph_category network\n";
print "graph_vlabel bits/sec\n";
}
open my $stats, "<", $input_stats_filename
or die "$input_stats_filename: $!";
while (<$stats>) {
chomp;
my ($url, $bytes_received, $data_bytes_received, $connection_time) =
/^(\S+) (\d+) (\d+) (-|\d+)/ or die "Invalid stats format";
my $stream_name = stream_name($url);
if ($mode eq 'config') {
print "${stream_name}.label Data input bitrate of $url\n";
print "${stream_name}.type DERIVE\n";
print "${stream_name}.min 0\n";
} else {
printf "${stream_name}.value %d\n", $data_bytes_received * 8;
}
}
close $stats;
sub stream_name {
my $stream = shift;
$stream =~ y/a-z0-9/_/c;
return $stream;
}
|