completed the new Wowza Media Server graph

This commit is contained in:
Jordi Sanfeliu 2013-06-20 17:04:22 +02:00
parent 3f18557055
commit 8456efa056
1 changed files with 33 additions and 30 deletions

View File

@ -282,26 +282,31 @@ sub wowza_update {
my $conntrej = 0; my $conntrej = 0;
my $msginbytes = 0; my $msginbytes = 0;
my $msgoutbytes = 0; my $msgoutbytes = 0;
my $str;
if($entry->{Name} eq trim($an)) { if($entry->{Name} eq trim($an)) {
$conntacc = $entry->{ConnectionsTotalAccepted} - ($config->{wowza_hist}->{'conntacc'} || 0); $str = $e . $e2 . "conntacc";
$conntacc = $entry->{ConnectionsTotalAccepted} - ($config->{wowza_hist}->{$str} || 0);
$conntacc = 0 unless $conntacc != $entry->{ConnectionsTotalAccepted}; $conntacc = 0 unless $conntacc != $entry->{ConnectionsTotalAccepted};
$conntacc /= 60; $conntacc /= 60;
$config->{wowza_hist}->{'conntacc'} = $entry->{ConnectionsTotalAccepted}; $config->{wowza_hist}->{$str} = $entry->{ConnectionsTotalAccepted};
$conntrej = $entry->{ConnectionsTotalRejected} - ($config->{wowza_hist}->{'conntrej'} || 0); $str = $e . $e2 . "conntrej";
$conntrej = $entry->{ConnectionsTotalRejected} - ($config->{wowza_hist}->{$str} || 0);
$conntrej = 0 unless $conntrej != $entry->{ConnectionsTotalRejected}; $conntrej = 0 unless $conntrej != $entry->{ConnectionsTotalRejected};
$conntrej /= 60; $conntrej /= 60;
$config->{wowza_hist}->{'conntrej'} = $entry->{ConnectionsTotalRejected}; $config->{wowza_hist}->{$str} = $entry->{ConnectionsTotalRejected};
$msginbytes = $entry->{MessagesInBytesRate} - ($config->{wowza_hist}->{'msginbytes'} || 0); $str = $e . $e2 . "msginbytes";
$msginbytes = $entry->{MessagesInBytesRate} - ($config->{wowza_hist}->{$str} || 0);
$msginbytes = 0 unless $msginbytes != $entry->{MessagesInBytesRate}; $msginbytes = 0 unless $msginbytes != $entry->{MessagesInBytesRate};
$msginbytes /= 60; $msginbytes /= 60;
$config->{wowza_hist}->{'msginbytes'} = $entry->{MessagesInBytesRate}; $config->{wowza_hist}->{$str} = $entry->{MessagesInBytesRate};
$msgoutbytes = $entry->{MessagesOutBytesRate} - ($config->{wowza_hist}->{'msgoutbytes'} || 0); $str = $e . $e2 . "msgoutbytes";
$msgoutbytes = $entry->{MessagesOutBytesRate} - ($config->{wowza_hist}->{$str} || 0);
$msgoutbytes = 0 unless $msgoutbytes != $entry->{MessagesOutBytesRate}; $msgoutbytes = 0 unless $msgoutbytes != $entry->{MessagesOutBytesRate};
$msgoutbytes /= 60; $msgoutbytes /= 60;
$config->{wowza_hist}->{'msgoutbytes'} = $entry->{MessagesOutBytesRate}; $config->{wowza_hist}->{$str} = $entry->{MessagesOutBytesRate};
$rrdata .= ":" . $entry->{TimeRunning}; $rrdata .= ":" . $entry->{TimeRunning};
$rrdata .= ":" . $entry->{ConnectionsTotal}; $rrdata .= ":" . $entry->{ConnectionsTotal};
@ -425,21 +430,21 @@ sub wowza_cgi {
my $line4; my $line4;
print(" <pre style='font-size: 12px; color: $colors->{fg_color}';>\n"); print(" <pre style='font-size: 12px; color: $colors->{fg_color}';>\n");
print(" "); print(" ");
for($n = 0; $n < scalar(my @il = split(',', $wowza->{list})); $n++) { for($n = 0; $n < scalar(my @wl = split(',', $wowza->{list})); $n++) {
my $l = trim($il[$n]); my $l = trim($wl[$n]);
$line1 = " "; $line1 = " ";
$line2 .= " "; $line2 .= " ";
$line3 .= " "; $line3 .= " ";
$line4 .= "--"; $line4 .= "-";
foreach my $i (split(',', $wowza->{desc}->{$l})) { foreach my $i (split(',', $wowza->{desc}->{$l})) {
$line1 .= " "; $line1 .= " ";
$line2 .= sprintf(" %10s", trim($i)); $line2 .= sprintf(" %30s", trim($i));
$line3 .= " List BitR"; $line3 .= " Con/s MRate Acc/s Rej/s Strms";
$line4 .= "-----------"; $line4 .= "-------------------------------";
} }
if($line1) { if($line1) {
my $i = length($line1); my $i = length($line1);
printf(sprintf("%${i}s", sprintf("Wowza Media Server %2d", $n))); printf(sprintf("%${i}s", $l));
} }
} }
print("\n"); print("\n");
@ -451,23 +456,21 @@ sub wowza_cgi {
my @row; my @row;
my $time; my $time;
my $n2; my $n2;
my $n3;
my $from; my $from;
my $to; my $to;
for($n = 0, $time = $tf->{tb}; $n < ($tf->{tb} * $tf->{ts}); $n++) { for($n = 0, $time = $tf->{tb}; $n < ($tf->{tb} * $tf->{ts}); $n++) {
$line = @$data[$n]; $line = @$data[$n];
$time = $time - (1 / $tf->{ts}); $time = $time - (1 / $tf->{ts});
printf(" %2d$tf->{tc}", $time); printf(" %2d$tf->{tc}", $time);
for($n2 = 0; $n2 < scalar(my @il = split(',', $wowza->{list})); $n2++) { for($n2 = 0; $n2 < scalar(my @wl = split(',', $wowza->{list})); $n2++) {
my $ls = trim($il[$n2]); my $ls = trim($wl[$n2]);
print(" "); print(" ");
$n3 = 0; foreach (split(',', $wowza->{desc}->{$ls})) {
foreach my $i (split(',', $wowza->{desc}->{$ls})) { $from = $n2 * 130 + (10);
$from = $n2 * 36 + ($n3++ * 4); $to = $from + 15;
$to = $from + 4; my (undef, undef, $conncur, $conntacc, $conntrej, $minbrt, $moutbrt, undef, undef, undef, undef, undef, $sestot) = @$line[$from..$to];
my ($l, $b, undef, undef) = @$line[$from..$to]; @row = ($conncur, $conntacc, $conntrej, $minbrt + $moutbrt, $sestot);
@row = ($l, $b); printf(" %5d %5d %5d %5d %5d", @row);
printf(" %4d %4d", @row);
} }
} }
print("\n"); print("\n");