Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from k0ste/newfeature
Support for Eltex MES Managed Switches.
- Loading branch information
Showing
9 changed files
with
266 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package Classes::Eltex; | ||
our @ISA = qw(Classes::Device); | ||
use strict; | ||
|
||
sub init { | ||
my $self = shift; | ||
if ($self->{productname} =~ /(MES2324B)|(MES2324F)|(MES31)|(MES53)/i) { | ||
bless $self, 'Classes::Eltex::Aggregation'; | ||
$self->debug('using Classes::Eltex::Aggregation'); | ||
} elsif ($self->{productname} =~ /(MES21)|(MES23)/i) { | ||
bless $self, 'Classes::Eltex::Access'; | ||
$self->debug('using Classes::Eltex::Access'); | ||
} | ||
if (ref($self) ne "Classes::Eltex") { | ||
$self->init(); | ||
} else { | ||
$self->no_such_mode(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package Classes::Eltex::Access; | ||
our @ISA = qw(Classes::Eltex); | ||
use strict; | ||
|
||
# MES2100: 1 PSU, no FAN | ||
# MES2124P: 1 PSU, 2 FAN | ||
# MES2308: 1 PSU, no FAN | ||
# MES2324: 1 PSU, no FAN | ||
# MES2326: 1 PSU, no FAN | ||
# MES2348: 1 PSU, 2 FAN | ||
|
||
sub init { | ||
my $self = shift; | ||
if ($self->mode =~ /device::hardware::load/) { | ||
$self->analyze_and_check_cpu_subsystem('Classes::Eltex::MES::Component::CpuSubsystem'); | ||
} elsif ($self->mode =~ /device::hardware::health/) { | ||
$self->analyze_and_check_environmental_subsystem('Classes::Eltex::Access::Component::EnvironmentalSubsystem'); | ||
if (! $self->check_messages()) { | ||
$self->clear_messages(0); | ||
$self->add_ok('environmental hardware working fine'); | ||
} | ||
} elsif ($self->mode =~ /device::ha::status/) { | ||
$self->analyze_and_check_ha_subsystem('Classes::Eltex::MES::Component::HaSubsystem'); | ||
} else { | ||
$self->no_such_mode(); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
plugins-scripts/Classes/Eltex/Access/Component/EnvironmentalSubsystem.pm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package Classes::Eltex::Access::Component::EnvironmentalSubsystem; | ||
our @ISA = qw(Monitoring::GLPlugin::SNMP::Item); | ||
use strict; | ||
|
||
sub init { | ||
my $self = shift; | ||
$self->get_snmp_tables('ELTEX-MIB', [ | ||
['fans', 'eltexFanTable', 'Classes::Eltex::Access::Component::EnvironmentalSubsystem::Fan'], | ||
['temperatures', 'eltexSensorTable', 'Classes::Eltex::Access::Component::EnvironmentalSubsystem::Temperature'] | ||
]); | ||
} | ||
|
||
sub check { | ||
my $self = shift; | ||
foreach (@{$self->{fans}}, @{$self->{temperatures}}) { | ||
$_->check(); | ||
} | ||
} | ||
package Classes::Eltex::Access::Component::EnvironmentalSubsystem::Fan; | ||
our @ISA = qw(Monitoring::GLPlugin::SNMP::TableItem); | ||
use strict; | ||
|
||
sub check { | ||
my $self = shift; | ||
$self->add_info(sprintf '%s is %s', | ||
$self->{eltexFanDescription}, $self->{eltexFanStatus}); | ||
if ($self->{eltexFanStatus} eq 'normal') { | ||
$self->add_ok(); | ||
} elsif ($self->{eltexFanStatus} eq 'notPresent') { | ||
$self->add_warning(); | ||
} elsif ($self->{eltexFanStatus} eq 'unknown') { | ||
$self->add(); # Actually fan is not present on device, but in index... | ||
} | ||
} | ||
|
||
package Classes::Eltex::Access::Component::EnvironmentalSubsystem::Temperature; | ||
our @ISA = qw(Monitoring::GLPlugin::SNMP::TableItem); | ||
use strict; | ||
|
||
sub check { | ||
my $self = shift; | ||
$self->add_info(sprintf 'sensor %s is %s°C', | ||
$self->{eltexSensorDescription}, $self->{eltexSensorStatus}); | ||
$self->set_thresholds(warning => 55, critical => 65); | ||
$self->add_message($self->check_thresholds($self->{eltexSensorStatus})); | ||
$self->add_perfdata( | ||
label => 'sensor_'.$self->{eltexSensorDescription}.'_temp', | ||
value => $self->{eltexSensorStatus}, | ||
uom => '°C', | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package Classes::Eltex::Aggregation; | ||
our @ISA = qw(Classes::Eltex); | ||
use strict; | ||
|
||
# MES2324B: 2 PSU, no FAN | ||
# MES2324F, MES2324FB: 2 PSU, 4 FAN | ||
# MES3108, MES3116, MES3124, MES3224: 2 PSU, 4 FAN | ||
# MES5324: 2 PSU, 4 FAN | ||
|
||
sub init { | ||
my $self = shift; | ||
if ($self->mode =~ /device::hardware::load/) { | ||
$self->analyze_and_check_cpu_subsystem('Classes::Eltex::MES::Component::CpuSubsystem'); | ||
} elsif ($self->mode =~ /device::hardware::health/) { | ||
$self->analyze_and_check_environmental_subsystem('Classes::Eltex::Aggregation::Component::EnvironmentalSubsystem'); | ||
if (! $self->check_messages()) { | ||
$self->clear_messages(0); | ||
$self->add_ok('environmental hardware working fine'); | ||
} | ||
} elsif ($self->mode =~ /device::ha::status/) { | ||
$self->analyze_and_check_ha_subsystem('Classes::Eltex::MES::Component::HaSubsystem'); | ||
} else { | ||
$self->no_such_mode(); | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
plugins-scripts/Classes/Eltex/Aggregation/Component/EnvironmentalSubsystem.pm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package Classes::Eltex::Aggregation::Component::EnvironmentalSubsystem; | ||
our @ISA = qw(Monitoring::GLPlugin::SNMP::Item); | ||
use strict; | ||
|
||
sub init { | ||
my $self = shift; | ||
$self->get_snmp_tables('ELTEX-MIB', [ | ||
['fans', 'eltexFanTable', 'Classes::Eltex::Aggregation::Component::EnvironmentalSubsystem::Fan'], | ||
['temperatures', 'eltexSensorTable', 'Classes::Eltex::Aggregation::Component::EnvironmentalSubsystem::Temperature'], | ||
['power', 'eltexPowerSupplyTable', 'Classes::Eltex::Aggregation::Component::EnvironmentalSubsystem::Power'], | ||
]); | ||
} | ||
|
||
sub check { | ||
my $self = shift; | ||
foreach (@{$self->{fans}}, @{$self->{temperatures}}, @{$self->{power}}) { | ||
$_->check(); | ||
} | ||
} | ||
|
||
package Classes::Eltex::Aggregation::Component::EnvironmentalSubsystem::Fan; | ||
our @ISA = qw(Monitoring::GLPlugin::SNMP::TableItem); | ||
use strict; | ||
|
||
sub check { | ||
my $self = shift; | ||
$self->add_info(sprintf '%s is %s', | ||
$self->{eltexFanDescription}, $self->{eltexFanStatus}); | ||
if ($self->{eltexFanStatus} eq 'normal') { | ||
$self->add_ok(); | ||
} elsif ($self->{eltexFanStatus} eq 'notPresent') { | ||
$self->add_warning(); | ||
} | ||
} | ||
|
||
package Classes::Eltex::Aggregation::Component::EnvironmentalSubsystem::Temperature; | ||
our @ISA = qw(Monitoring::GLPlugin::SNMP::TableItem); | ||
use strict; | ||
|
||
sub check { | ||
my $self = shift; | ||
$self->add_info(sprintf 'sensor %s is %s°C', | ||
$self->{eltexSensorDescription}, $self->{eltexSensorStatus}); | ||
$self->set_thresholds(warning => 55, critical => 65); | ||
$self->add_message($self->check_thresholds($self->{eltexSensorStatus})); | ||
$self->add_perfdata( | ||
label => 'sensor_'.$self->{eltexSensorDescription}.'_temp', | ||
value => $self->{eltexSensorStatus}, | ||
uom => '°C', | ||
); | ||
} | ||
|
||
package Classes::Eltex::Aggregation::Component::EnvironmentalSubsystem::Power; | ||
our @ISA = qw(Monitoring::GLPlugin::SNMP::TableItem); | ||
use strict; | ||
|
||
sub check { | ||
my $self = shift; | ||
$self->add_info(sprintf '%s is %s', | ||
$self->{eltexPowerSupplyDescription}, $self->{eltexPowerSupplyStatus}); | ||
if ($self->{eltexPowerSupplyStatus} eq 'normal') { | ||
$self->add_ok(); | ||
} elsif ($self->{eltexPowerSupplyStatus} eq 'notPresent') { | ||
$self->add_warning(); | ||
} elsif ($self->{eltexPowerSupplyStatus} eq 'notFunctioning') { | ||
$self->add_critical(); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
plugins-scripts/Classes/Eltex/MES/Component/CpuSubsystem.pm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package Classes::Eltex::MES::Component::CpuSubsystem; | ||
our @ISA = qw(Monitoring::GLPlugin::SNMP::Item); | ||
use strict; | ||
|
||
sub init { | ||
my $self = shift; | ||
$self->get_snmp_objects('ELTEX-MIB', (qw( | ||
eltexCpuUtilisationLastSecond eltexCpuUtilisationOneMinute | ||
eltexCpuUtilisationFiveMinutes))); | ||
} | ||
|
||
sub check { | ||
my $self = shift; | ||
$self->add_info(sprintf 'cpu usage is %s%%', | ||
$self->{eltexCpuUtilisationLastSecond}); | ||
$self->set_thresholds(warning => 50, critical => 90); | ||
$self->add_message($self->check_thresholds( | ||
$self->{eltexCpuUtilisationLastSecond})); | ||
$self->add_perfdata( | ||
label => 'cpu_usage', | ||
value => $self->{eltexCpuUtilisationLastSecond}, | ||
uom => '%', | ||
); | ||
$self->add_perfdata( | ||
label => 'cpu_usage_one_minute', | ||
value => $self->{eltexCpuUtilisationOneMinute}, | ||
uom => '%', | ||
); | ||
$self->add_perfdata( | ||
label => 'cpu_usage_five_minutes', | ||
value => $self->{eltexCpuUtilisationFiveMinutes}, | ||
uom => '%', | ||
); | ||
} |
29 changes: 29 additions & 0 deletions
29
plugins-scripts/Classes/Eltex/MES/Component/HaSubsystem.pm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package Classes::Eltex::MES::Component::HaSubsystem; | ||
our @ISA = qw(Monitoring::GLPlugin::SNMP::Item); | ||
use strict; | ||
|
||
sub init { | ||
my $self = shift; | ||
$self->get_snmp_objects('ELTEX-MIB', (qw(eltexStackUnitsNumber))); | ||
} | ||
|
||
# Specify threshold values, so that you understand when the number of units | ||
# decreases, for example we have only 2 units in stack, so we should get | ||
# warning state if one of unit goes down: | ||
# ./check_nwc_health --hostname 10.10.10.2 --mode ha-status --warning 2: | ||
# OK - stack have 2 units | 'units'=2;2:;0:;; | ||
# and when only one unit left: | ||
# WARNING - stack have 1 units | 'units'=1;2:;0:;; | ||
|
||
sub check { | ||
my $self = shift; | ||
$self->add_info(sprintf 'stack have %s units', | ||
$self->{eltexStackUnitsNumber}); | ||
$self->set_thresholds(warning => '0:', critical => '0:'); | ||
$self->add_message($self->check_thresholds( | ||
$self->{eltexStackUnitsNumber})); | ||
$self->add_perfdata( | ||
label => 'units', | ||
value => $self->{eltexStackUnitsNumber}, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters