2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Check node offline status using boolean

The previous behaviour checked offline status using a regular
expression. Jenkins 2 uses a boolean value
This commit is contained in:
Henti Smith 2017-11-09 09:56:20 +00:00
parent 50e8e27722
commit 6d50ab4900

18
plugins/jenkins/jenkins_nodes_ Normal file → Executable file
View File

@ -51,7 +51,7 @@ if ( exists $ARGV[0] and $ARGV[0] eq "config" ) {
my $result = `$cmd/computer/api/json`;
my $parsed = decode_json($result);
foreach my $cur(@{$parsed->{'computer'}}) {
if( $cur->{'offline'} =~ /false$/ ) {
if( !$cur->{'offline'} ) {
my $cat = $cur->{'displayName'};
$cat =~ s/\./\_/g;
if( $lcount > 0 ){
@ -77,7 +77,7 @@ if ( exists $ARGV[0] and $ARGV[0] eq "config" ) {
my $result = `$cmd/computer/api/json`;
my $parsed = decode_json($result);
foreach my $cur(@{$parsed->{'computer'}}) {
if( $cur->{'offline'} =~ /false$/ ) {
if( !$cur->{'offline'} ) {
my $cat = $cur->{'displayName'};
$cat =~ s/\./\_/g;
if( $lcount > 0 ){
@ -103,7 +103,7 @@ if ( exists $ARGV[0] and $ARGV[0] eq "config" ) {
my $result = `$cmd/computer/api/json`;
my $parsed = decode_json($result);
foreach my $cur(@{$parsed->{'computer'}}) {
if( $cur->{'offline'} =~ /false$/ ) {
if( !$cur->{'offline'} ) {
my $cat = $cur->{'displayName'};
$cat =~ s/\./\_/g;
if( $lcount > 0 ){
@ -130,7 +130,7 @@ if ( exists $ARGV[0] and $ARGV[0] eq "config" ) {
my %archs = ();
my $cat;
foreach my $cur(@{$parsed->{'computer'}}) {
if( $cur->{'offline'} =~ /false$/ ) {
if( !$cur->{'offline'} ) {
$cat = $cur->{'monitorData'}{'hudson.node_monitors.ArchitectureMonitor'};
if (exists $archs{$cat} ) {} else {
$archs{$cat} = 0;
@ -178,7 +178,7 @@ if ( exists $ARGV[0] and $ARGV[0] eq "config" ) {
my $total_mem = 0;
my $used_mem = 0;
foreach my $cur(@{$parsed->{'computer'}}) {
if( $cur->{'offline'} =~ /false$/ ) {
if( !$cur->{'offline'} ) {
$monitor = $cur->{'monitorData'}{'hudson.node_monitors.SwapSpaceMonitor'};
$avail_mem += $monitor->{'availablePhysicalMemory'};
$total_mem += $monitor->{'totalPhysicalMemory'};
@ -193,7 +193,7 @@ if ( exists $ARGV[0] and $ARGV[0] eq "config" ) {
my $result = `$cmd/computer/api/json`;
my $parsed = decode_json($result);
foreach my $cur(@{$parsed->{'computer'}}) {
if( $cur->{'offline'} =~ /false$/ ) {
if( !$cur->{'offline'} ) {
$monitor = $cur->{'monitorData'}{'hudson.node_monitors.SwapSpaceMonitor'};
my $cat = $cur->{'displayName'};
$cat =~ s/\./\_/g;
@ -206,7 +206,7 @@ if ( exists $ARGV[0] and $ARGV[0] eq "config" ) {
my $result = `$cmd/computer/api/json`;
my $parsed = decode_json($result);
foreach my $cur(@{$parsed->{'computer'}}) {
if( $cur->{'offline'} =~ /false$/ ) {
if( !$cur->{'offline'} ) {
$monitor = $cur->{'monitorData'}{'hudson.node_monitors.TemporarySpaceMonitor'};
my $cat = $cur->{'displayName'};
$cat =~ s/\./\_/g;
@ -219,7 +219,7 @@ if ( exists $ARGV[0] and $ARGV[0] eq "config" ) {
my $result = `$cmd/computer/api/json`;
my $parsed = decode_json($result);
foreach my $cur(@{$parsed->{'computer'}}) {
if( $cur->{'offline'} =~ /false$/ ) {
if( !$cur->{'offline'} ) {
$monitor = $cur->{'monitorData'}{'hudson.node_monitors.DiskSpaceMonitor'};
my $cat = $cur->{'displayName'};
$cat =~ s/\./\_/g;
@ -233,7 +233,7 @@ if ( exists $ARGV[0] and $ARGV[0] eq "config" ) {
my %archs = ();
my $cat;
foreach my $cur(@{$parsed->{'computer'}}) {
if( $cur->{'offline'} =~ /false$/ ) {
if( !$cur->{'offline'} ) {
$cat = $cur->{'monitorData'}{'hudson.node_monitors.ArchitectureMonitor'};
if (exists $archs{$cat} ) {
$archs{$cat} += 1;