diff --git a/ChangeLog b/ChangeLog index 325235f1..c97c1397 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ -* 4.4! - - add rapid-city-mib +* 2015-09-06 4.4 + add rapid-city-mib + add entity-mib for cisco asa * 2015-08-18 4.3.1 add ha-role for Aruba * 2015-08-17 4.3 diff --git a/configure.ac b/configure.ac index a280eece..75362fc1 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. AC_REVISION ($Revision: 1.150 $) AC_PREREQ(2.58) -AC_INIT(check_nwc_health,4.3.1) +AC_INIT(check_nwc_health,4.4) AM_INIT_AUTOMAKE([1.9 tar-pax]) AM_MAINTAINER_MODE([disable]) AC_CANONICAL_HOST diff --git a/plugins-scripts/Classes/ENTITYSENSORMIB/Component/EnvironmentalSubsystem.pm b/plugins-scripts/Classes/ENTITYSENSORMIB/Component/EnvironmentalSubsystem.pm index 3e15f492..90f18fbb 100644 --- a/plugins-scripts/Classes/ENTITYSENSORMIB/Component/EnvironmentalSubsystem.pm +++ b/plugins-scripts/Classes/ENTITYSENSORMIB/Component/EnvironmentalSubsystem.pm @@ -10,8 +10,11 @@ sub init { $self->get_snmp_tables('ENTITY-SENSOR-MIB', [ ['sensors', 'entPhySensorTable', 'Classes::ENTITYSENSORMIB::Component::EnvironmentalSubsystem::Sensor' ], ]); + if (! @{$self->{entities}}) { + $self->fake_names(); + } foreach (@{$self->{sensors}}) { - $_->{entPhySensorEntityName} = shift(@{$self->{entities}})->{entPhysicalName}; + $_->{entPhySensorEntityName} = shift(@{$self->{entities}})->{entPhysicalName} unless $_->{entPhySensorEntityName};; } delete $self->{entities}; } @@ -33,11 +36,38 @@ sub dump { } } +sub fake_names { + # das ist hoffentlich ein ausnahmefall. + # z.b. cisco asa hat keine entPhysicalTable, aber entPhySensorTable + my $self = shift; + my $no_has_entities_names = {}; + foreach (@{$self->{sensors}}) { + if (! exists $no_has_entities_names->{$_->{entPhySensorType}}) { + $no_has_entities_names->{$_->{entPhySensorType}} = {}; + } + if (! exists $no_has_entities_names->{$_->{entPhySensorType}}->{$_->{entPhySensorUnitsDisplay}}) { + $no_has_entities_names->{$_->{entPhySensorType}}->{$_->{entPhySensorUnitsDisplay}} = 1; + } else { + $no_has_entities_names->{$_->{entPhySensorType}}->{$_->{entPhySensorUnitsDisplay}}++; + } + if ($_->{entPhySensorType} eq "truthvalue") { + $_->{entPhySensorEntityName} = sprintf "%s %s", + $_->{entPhySensorUnitsDisplay}, + $_->{entPhySensorValue}; + } else { + $_->{entPhySensorEntityName} = sprintf "%s %s", + $_->{entPhySensorUnitsDisplay}, + $no_has_entities_names->{$_->{entPhySensorType}}->{$_->{entPhySensorUnitsDisplay}}; + } + $_->{entPhySensorEntityName} =~ s/\s+/_/g; + } +} package Classes::ENTITYSENSORMIB::Component::EnvironmentalSubsystem::Sensor; our @ISA = qw(Monitoring::GLPlugin::SNMP::TableItem); use strict; + sub finish { my $self = shift; if ($self->{entPhySensorType} eq 'rpm') { @@ -50,8 +80,9 @@ sub finish { sub check { my $self = shift; if ($self->{entPhySensorOperStatus} ne 'ok') { - $self->add_info(sprintf '%s has status %s\n', - $self->{entity}->{entPhysicalName}, + $self->add_info(sprintf '%s sensor %s has status %s', + $self->{entPhySensorType}, + $self->{entPhySensorEntityName}, $self->{entPhySensorOperStatus}); if ($self->{entPhySensorOperStatus} eq 'nonoperational') { $self->add_critical(); @@ -59,7 +90,8 @@ sub check { $self->add_unknown(); } } else { - $self->add_info(sprintf "%s reports %s%s", + $self->add_info(sprintf "%s sensor %s reports %s%s", + $self->{entPhySensorType}, $self->{entPhySensorEntityName}, $self->{entPhySensorValue}, $self->{entPhySensorUnitsDisplay}