7 my $input_stats_filename = $ENV{"cubemap_input_stats"} // "/var/lib/cubemap/cubemap-input.stats";
9 my $mode = $ARGV[0] // "print";
10 if ($mode eq 'config') {
11 print "graph_title Cubemap inputs\n";
12 print "graph_category network\n";
13 print "graph_vlabel viewers\n";
16 open my $stats, "<", $input_stats_filename
17 or die "$input_stats_filename: $!";
20 my ($url, $bytes_received, $data_bytes_received, $connection_time) =
21 /^(\S+) (\d+) (\d+) (-|\d+)/ or die "Invalid stats format";
22 my $stream_name = stream_name($url);
23 if ($mode eq 'config') {
24 print "${stream_name}.label Data input bitrate of $url\n";
25 print "${stream_name}.type DERIVE\n";
26 print "${stream_name}.min 0\n";
28 printf "${stream_name}.value %d\n", $data_bytes_received * 8;
35 $stream =~ y/a-z0-9/_/c;