1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 02:51:03 +00:00

jenkins_: emit warning in case of unknown 'mode'

This commit is contained in:
Lars Kruse 2018-06-10 13:34:09 +02:00
parent dec7c0c879
commit c2522f5bd2

View file

@ -107,9 +107,7 @@ if ( exists $ARGV[0] and $ARGV[0] eq "config" ) {
print "build_stable.label stable\n"; print "build_stable.label stable\n";
print "build_stable.type GAUGE\n"; print "build_stable.type GAUGE\n";
print "build_stable.colour 294D99\n"; print "build_stable.colour 294D99\n";
exit; } elsif( $type eq "queue" ) {
}
if( $type eq "queue" ) {
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_title Jenkins Queue Length\n"; print "graph_title Jenkins Queue Length\n";
print "graph_vlabel Number of Jobs in Queue\n"; print "graph_vlabel Number of Jobs in Queue\n";
@ -117,9 +115,7 @@ if ( exists $ARGV[0] and $ARGV[0] eq "config" ) {
print "graph_info The Graph shows the Number of Jobs in the Build Queue\n"; print "graph_info The Graph shows the Number of Jobs in the Build Queue\n";
print "build_count.label Jobs in Queue\n"; print "build_count.label Jobs in Queue\n";
print "build_count.type GAUGE\n"; print "build_count.type GAUGE\n";
exit; } elsif( $type eq "running" ) {
}
if( $type eq "running" ) {
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_title Jenkins Builds Running\n"; print "graph_title Jenkins Builds Running\n";
print "graph_vlabel Builds currently running\n"; print "graph_vlabel Builds currently running\n";
@ -127,7 +123,8 @@ if ( exists $ARGV[0] and $ARGV[0] eq "config" ) {
print "graph_info The Graph shows the Number of Builds, currently running\n"; print "graph_info The Graph shows the Number of Builds, currently running\n";
print "build_running.label running Builds\n"; print "build_running.label running Builds\n";
print "build_running.type GAUGE\n"; print "build_running.type GAUGE\n";
exit; } else {
warn "Unknown mode requested: $type\n";
} }
} else { } else {
my $cmd = "$wgetBin $auth -qO- $url:$port$context"; my $cmd = "$wgetBin $auth -qO- $url:$port$context";
@ -145,22 +142,17 @@ if ( exists $ARGV[0] and $ARGV[0] eq "config" ) {
foreach my $status (keys %{$counts}) { foreach my $status (keys %{$counts}) {
print "build_$status.value $counts->{$status}\n"; print "build_$status.value $counts->{$status}\n";
} }
exit; } elsif( $type eq "running" ) {
}
if( $type eq "running" ) {
my $result = `$cmd'/api/json?depth=$jobDepth&tree=$tree'`; my $result = `$cmd'/api/json?depth=$jobDepth&tree=$tree'`;
my $parsed = decode_json($result); my $parsed = decode_json($result);
my $count = parse_running_builds($parsed->{'jobs'}); my $count = parse_running_builds($parsed->{'jobs'});
print "build_running.value ", $count, "\n"; print "build_running.value ", $count, "\n";
exit; } elsif( $type eq "queue" ) {
}
if( $type eq "queue" ) {
my $result = `$cmd/queue/api/json`; my $result = `$cmd/queue/api/json`;
my $parsed = decode_json($result); my $parsed = decode_json($result);
print "build_count.value ", scalar( @{$parsed->{'items'}} ), "\n"; print "build_count.value ", scalar( @{$parsed->{'items'}} ), "\n";
exit; } else {
warn "Unknown mode requested: $type\n";
} }
} }