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

jenkins_: Accumulate build result counts correctly

The previous behaviour ignored initial statuses other than blue, yellow,
red, disabled
This commit is contained in:
Dominic Hargreaves 2015-09-10 14:26:51 +01:00
parent 8ad8e1b9e2
commit 3e70ec3803

View file

@ -79,7 +79,7 @@ my %states = (
'aborted'=>'failing', 'aborted'=>'failing',
'aborted_anime'=>'failing' 'aborted_anime'=>'failing'
); );
my %counts = ('blue' => 0, 'yellow'=>0, 'red'=>0, 'disabled'=>0); my %counts = ('stable' => 0, 'unstable'=>0, 'failing'=>0, 'disabled'=>0);
if ( exists $ARGV[0] and $ARGV[0] eq "config" ) { if ( exists $ARGV[0] and $ARGV[0] eq "config" ) {
if( $type eq "results" ) { if( $type eq "results" ) {
@ -136,14 +136,14 @@ if ( exists $ARGV[0] and $ARGV[0] eq "config" ) {
my $parsed = decode_json($result); my $parsed = decode_json($result);
foreach my $cur(@{$parsed->{'jobs'}}) { foreach my $cur(@{$parsed->{'jobs'}}) {
if (defined $states{$cur->{'color'}}) { if (defined $states{$cur->{'color'}}) {
$counts{$cur->{'color'}} += 1; $counts{$states{$cur->{'color'}}} += 1;
} else { } else {
warn "Ignoring unknown color " . $cur->{'color'} . "\n" warn "Ignoring unknown color " . $cur->{'color'} . "\n"
} }
} }
foreach my $status (keys %counts) { foreach my $status (keys %counts) {
print "build_$states{$status}.value $counts{$status}\n"; print "build_$status.value $counts{$status}\n";
} }
exit; exit;
} }