1
0

- do also check for churned state on lacp interfaces and warn

OBS-URL: https://build.opensuse.org/package/show/server:monitoring/monitoring-plugins-bonding?expand=0&rev=9
This commit is contained in:
Ruediger Oertel 2018-07-12 11:05:33 +00:00 committed by Git OBS Bridge
parent c4e4161757
commit 859a598b6f
3 changed files with 25 additions and 4 deletions

View File

@ -52,6 +52,8 @@ sub read_proc_bond {
while (($_ = <F>||"") !~ /^$/) {
$data->{'slaves'}->{$slave}->{'mii'} = $1 if /^MII Status: (.+)$/;
$data->{'slaves'}->{$slave}->{'failure-count'} = $1 if /^Link Failure Count: (.+)$/;
$data->{'slaves'}->{$slave}->{'actor-churn'} = $1 if /^Actor Churn State: (.+)$/;
$data->{'slaves'}->{$slave}->{'partner-churn'} = $1 if /^Partner Churn State: (.+)$/;
}
}
}
@ -67,17 +69,31 @@ sub check_bond {
return (0, "Unable to read bond information") unless $data;
my $error = 0;
my $config_str;
my $status = $data->{'status'};
if (defined $data->{'slaves'}) {
foreach (keys %{$data->{'slaves'}}) {
$status = "warn" if $data->{'slaves'}->{$_}->{'actor-churn'}
&& $data->{'slaves'}->{$_}->{'actor-churn'} eq "churned";
$status = "warn" if $data->{'slaves'}->{$_}->{'partner-churn'}
&& $data->{'slaves'}->{$_}->{'partner-churn'} eq "churned";
}
}
if (defined $data->{'active'}) {
$config_str = sprintf "$interface_name %s on %s: members =", $data->{'status'}, $data->{'active'} ;
} elsif (defined $data->{'slaves'}) {
$config_str = sprintf "$interface_name %s: members =", $data->{'status'};
$config_str = sprintf "$interface_name %s: members =", $status;
} else {
$config_str = sprintf "$interface_name %s has no physical devices", $data->{'status'};
$error = 1;
}
foreach (keys %{$data->{'slaves'}}) {
$config_str.= " $_ (" . $data->{'slaves'}->{$_}->{'mii'} . ")";
my $result = $data->{'slaves'}->{$_}->{'mii'};
$result = "churned" unless $data->{'slaves'}->{$_}->{'actor-churn'} eq 'none';
$result = "churned" unless $data->{'slaves'}->{$_}->{'partner-churn'} eq 'none';
$config_str.= " $_ (" . $result . ")";
$error = 1 unless $data->{'slaves'}->{$_}->{'mii'} eq 'up';
$error = 1 unless $data->{'slaves'}->{$_}->{'actor-churn'} eq 'none';
$error = 1 unless $data->{'slaves'}->{$_}->{'partner-churn'} eq 'none';
$error = 2 if ($data->{'status'} ne 'up');
}
return $error, $config_str;

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu Jul 12 13:04:59 CEST 2018 - ro@suse.de
- do also check for churned state on lacp interfaces and warn
-------------------------------------------------------------------
Fri Apr 21 15:00:43 CEST 2017 - ro@suse.de

View File

@ -1,7 +1,7 @@
#
# spec file for package monitoring-plugins-bonding
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -20,7 +20,7 @@ Name: monitoring-plugins-bonding
Version: 0.002
Release: 0
Summary: Nagios Network Bonding Check
License: GPL-2.0+ or Artistic-1.0
License: GPL-2.0-or-later OR Artistic-1.0
Group: System/Monitoring
Url: http://www.monitoringexchange.org/inventory/Check-Plugins/Operating-Systems/Linux/Network-Bonding
Source0: check_bonding.pl