1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41: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_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( $type eq "results" ) {
@ -136,14 +136,14 @@ if ( exists $ARGV[0] and $ARGV[0] eq "config" ) {
my $parsed = decode_json($result);
foreach my $cur(@{$parsed->{'jobs'}}) {
if (defined $states{$cur->{'color'}}) {
$counts{$cur->{'color'}} += 1;
$counts{$states{$cur->{'color'}}} += 1;
} else {
warn "Ignoring unknown color " . $cur->{'color'} . "\n"
}
}
foreach my $status (keys %counts) {
print "build_$states{$status}.value $counts{$status}\n";
print "build_$status.value $counts{$status}\n";
}
exit;
}