1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

Merge pull request #647 from jmdh/jenkins_fixes

Jenkins fixes
This commit is contained in:
Stig Sandbeck Mathisen 2015-09-11 09:54:03 +02:00
commit b02fe4e8e7

View file

@ -66,8 +66,20 @@ my $wgetBin = "/usr/bin/wget";
my $type = basename($0);
$type =~ s/jenkins_//;
my %states = ('blue' =>'stable', 'blue_anime' =>'stable', 'yellow'=>'unstable', 'yellow_anime'=>'unstable', 'red'=>'failing', 'red_anime'=>'failing', 'disabled'=>'disabled', 'notbuilt_anime' =>'disabled', 'aborted'=>'failing', 'aborted_anime'=>'failing' );
my %counts = ('blue' => 0, 'yellow'=>0, 'red'=>0, 'disabled'=>0);
my %states = (
'blue' =>'stable',
'blue_anime' =>'stable',
'yellow'=>'unstable',
'yellow_anime'=>'unstable',
'red'=>'failing',
'red_anime'=>'failing',
'disabled'=>'disabled',
'notbuilt' => 'disabled',
'notbuilt_anime' =>'disabled',
'aborted'=>'failing',
'aborted_anime'=>'failing'
);
my %counts = ('stable' => 0, 'unstable'=>0, 'failing'=>0, 'disabled'=>0);
if ( exists $ARGV[0] and $ARGV[0] eq "config" ) {
if( $type eq "results" ) {
@ -123,11 +135,15 @@ if ( exists $ARGV[0] and $ARGV[0] eq "config" ) {
my $result = `$cmd/api/json`;
my $parsed = decode_json($result);
foreach my $cur(@{$parsed->{'jobs'}}) {
$counts{$cur->{'color'}} += 1;
if (defined $states{$cur->{'color'}}) {
$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;
}