keeps going.
+Munin plugins:
+
+These can be dropped directly into /etc/munin/plugins. If you don't put
+the files in the expected default locations, you probably want some
+configuration in /etc/munin/plugin-conf.d/cubemap or similar, like this:
+
+[cubemap*]
+user <something>
+env.cubemap_config /etc/cubemap/cubemap.config
+env.cubemap_stats /var/lib/cubemap/cubemap.stats
+env.cubemap_input_stats /var/lib/cubemap/cubemap-input.stats
+
+
Legalese:
Copyright 2013 Steinar H. Gunderson <sgunderson@bigfoot.com>.
--- /dev/null
+#! /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 viewers\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;
+}