mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-25 18:38:30 +00:00
Fixing shoutcast2_multi plugin
This commit is contained in:
parent
208bfbedb3
commit
8be793e822
1 changed files with 27 additions and 6 deletions
|
@ -32,6 +32,7 @@ use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use LWP::UserAgent;
|
use LWP::UserAgent;
|
||||||
use XML::Simple;
|
use XML::Simple;
|
||||||
|
use Data::Dumper;
|
||||||
use Munin::Plugin;
|
use Munin::Plugin;
|
||||||
|
|
||||||
need_multigraph();
|
need_multigraph();
|
||||||
|
@ -146,12 +147,22 @@ sub main {
|
||||||
}
|
}
|
||||||
my $streamConfigRef = $adminRef->{STREAMCONFIGS}->{STREAMCONFIG};
|
my $streamConfigRef = $adminRef->{STREAMCONFIGS}->{STREAMCONFIG};
|
||||||
my $sidDataRef;
|
my $sidDataRef;
|
||||||
foreach my $sid (keys %{$streamConfigRef}) {
|
if ($adminRef->{STREAMCONFIGS}->{TOTALCONFIGS} == 1) {
|
||||||
|
my $sid = $streamConfigRef->{id};
|
||||||
my ($return,$tmpSidRef) = fetch_sid_data($sid);
|
my ($return,$tmpSidRef) = fetch_sid_data($sid);
|
||||||
if ($return == 0) {
|
if ($return == 0) {
|
||||||
next;
|
# Only one stream, and we didn't get a good response.
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
$sidDataRef->{$sid} = $tmpSidRef;
|
$sidDataRef->{$sid} = $tmpSidRef;
|
||||||
|
} else {
|
||||||
|
foreach my $sid (keys %{$streamConfigRef}) {
|
||||||
|
my ($return,$tmpSidRef) = fetch_sid_data($sid);
|
||||||
|
if ($return == 0) {
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
$sidDataRef->{$sid} = $tmpSidRef;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
print_active_data($sidDataRef);
|
print_active_data($sidDataRef);
|
||||||
print_listener_data($adminRef->{STREAMCONFIGS}->{SERVERMAXLISTENERS}, $sidDataRef);
|
print_listener_data($adminRef->{STREAMCONFIGS}->{SERVERMAXLISTENERS}, $sidDataRef);
|
||||||
|
@ -209,12 +220,22 @@ sub config {
|
||||||
}
|
}
|
||||||
my $streamConfigRef = $adminRef->{STREAMCONFIGS}->{STREAMCONFIG};
|
my $streamConfigRef = $adminRef->{STREAMCONFIGS}->{STREAMCONFIG};
|
||||||
my $sidDataRef;
|
my $sidDataRef;
|
||||||
foreach my $sid (keys %{$streamConfigRef}) {
|
if ($adminRef->{STREAMCONFIGS}->{TOTALCONFIGS} == 1) {
|
||||||
|
my $sid = $streamConfigRef->{id};
|
||||||
my ($return,$tmpSidRef) = fetch_sid_data($sid);
|
my ($return,$tmpSidRef) = fetch_sid_data($sid);
|
||||||
if ($return == 0) {
|
if ($return == 0) {
|
||||||
next;
|
# Only one stream, and we didn't get a good response.
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
$sidDataRef->{$sid} = $tmpSidRef;
|
$sidDataRef->{$sid} = $tmpSidRef;
|
||||||
|
} else {
|
||||||
|
foreach my $sid (keys %{$streamConfigRef}) {
|
||||||
|
my ($return,$tmpSidRef) = fetch_sid_data($sid);
|
||||||
|
if ($return == 0) {
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
$sidDataRef->{$sid} = $tmpSidRef;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
print_active_config($sidDataRef);
|
print_active_config($sidDataRef);
|
||||||
print_listener_config($sidDataRef);
|
print_listener_config($sidDataRef);
|
||||||
|
@ -244,7 +265,7 @@ sub print_active_config {
|
||||||
print "graph_title ".$graphsRef->{active}->{config}->{title}."\n";
|
print "graph_title ".$graphsRef->{active}->{config}->{title}."\n";
|
||||||
print "graph_args ".$graphsRef->{active}->{config}->{args}."\n";
|
print "graph_args ".$graphsRef->{active}->{config}->{args}."\n";
|
||||||
print "graph_vlabel ".$graphsRef->{active}->{config}->{vlabel}."\n";
|
print "graph_vlabel ".$graphsRef->{active}->{config}->{vlabel}."\n";
|
||||||
print "graph_category".$graphsRef->{active}->{config}->{category}."\n";
|
print "graph_category ".$graphsRef->{active}->{config}->{category}."\n";
|
||||||
print "graph_info ".$graphsRef->{active}->{config}->{info}."\n";
|
print "graph_info ".$graphsRef->{active}->{config}->{info}."\n";
|
||||||
# Print the Data Value Info
|
# Print the Data Value Info
|
||||||
foreach my $dsrc (@{$graphsRef->{active}->{datasrc}}) {
|
foreach my $dsrc (@{$graphsRef->{active}->{datasrc}}) {
|
||||||
|
@ -279,7 +300,7 @@ sub print_listener_config {
|
||||||
print "graph_title ".$graphsRef->{listeners}->{config}->{title}."\n";
|
print "graph_title ".$graphsRef->{listeners}->{config}->{title}."\n";
|
||||||
print "graph_args ".$graphsRef->{listeners}->{config}->{args}."\n";
|
print "graph_args ".$graphsRef->{listeners}->{config}->{args}."\n";
|
||||||
print "graph_vlabel ".$graphsRef->{listeners}->{config}->{vlabel}."\n";
|
print "graph_vlabel ".$graphsRef->{listeners}->{config}->{vlabel}."\n";
|
||||||
print "graph_category".$graphsRef->{listeners}->{config}->{category}."\n";
|
print "graph_category ".$graphsRef->{listeners}->{config}->{category}."\n";
|
||||||
print "graph_info ".$graphsRef->{listeners}->{config}->{info}."\n";
|
print "graph_info ".$graphsRef->{listeners}->{config}->{info}."\n";
|
||||||
# Print the Data Value Info
|
# Print the Data Value Info
|
||||||
foreach my $dsrc (@{$graphsRef->{listeners}->{datasrc}}) {
|
foreach my $dsrc (@{$graphsRef->{listeners}->{datasrc}}) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue