/usr/share/munin/plugins/cubemap_input is in cubemap 1.3.2-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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | #! /usr/bin/perl
use strict;
use warnings;
use Munin::Plugin;
need_multigraph();
my $input_stats_filename = $ENV{"cubemap_input_stats"} // "/var/lib/cubemap/cubemap-input.stats";
my $mode = $ARGV[0] // "print";
if ($mode eq 'config') {
print "multigraph cubemap_input\n";
print "graph_title Cubemap inputs\n";
print "graph_category network\n";
print "graph_vlabel bits/sec\n";
print "multigraph cubemap_input_latency\n";
print "graph_title Cubemap input latency\n";
print "graph_category network\n";
print "graph_vlabel ms\n";
}
open my $stats, "<", $input_stats_filename
or die "$input_stats_filename: $!";
while (<$stats>) {
chomp;
my ($url, $bytes_received, $data_bytes_received, $connection_time, $metadata_bytes_received, $latency) =
/^(\S+) (\d+) (\d+) (-|\d+) (\d+) (-|\d+\.\d+)/ or die "Invalid stats format";
my $stream_name = stream_name($url);
if ($mode eq 'config') {
print "multigraph cubemap_input\n";
print "${stream_name}.label Data input bitrate of $url\n";
print "${stream_name}.type DERIVE\n";
print "${stream_name}.min 0\n";
print "multigraph cubemap_input_latency\n";
print "${stream_name}.label Encoder-to-reflector latency $url (seconds)\n";
print "${stream_name}.type GAUGE\n";
print "${stream_name}.min 0\n";
} else {
print "multigraph cubemap_input\n";
printf "${stream_name}.value %d\n", $data_bytes_received * 8;
if ($latency ne '-') {
print "multigraph cubemap_input_latency\n";
printf "${stream_name}.value %f\n", $latency * 1000;
}
}
}
close $stats;
sub stream_name {
my $stream = shift;
$stream =~ y/a-z0-9/_/c;
return $stream;
}
|