Update check_nwc_health to 3.4.2.2
This commit is contained in:
parent
17038528de
commit
b964123fd1
|
@ -1,63 +0,0 @@
|
||||||
package Classes::Cisco::NXOS;
|
|
||||||
our @ISA = qw(Classes::Cisco);
|
|
||||||
use strict;
|
|
||||||
|
|
||||||
sub init {
|
|
||||||
my $self = shift;
|
|
||||||
if ($self->mode =~ /device::hardware::health/) {
|
|
||||||
$self->analyze_and_check_environmental_subsystem("Classes::Cisco::NXOS::Component::EnvironmentalSubsystem");
|
|
||||||
} elsif ($self->mode =~ /device::cisco::fex::watch/) {
|
|
||||||
$self->analyze_fex_subsystem();
|
|
||||||
$self->check_fex_subsystem();
|
|
||||||
} elsif ($self->mode =~ /device::hardware::load/) {
|
|
||||||
$self->analyze_and_check_cpu_subsystem("Classes::Cisco::NXOS::Component::CpuSubsystem");
|
|
||||||
} elsif ($self->mode =~ /device::hardware::memory/) {
|
|
||||||
$self->analyze_and_check_mem_subsystem("Classes::Cisco::NXOS::Component::MemSubsystem");
|
|
||||||
} elsif ($self->mode =~ /device::hsrp/) {
|
|
||||||
$self->analyze_and_check_hsrp_subsystem("Classes::HSRP::Component::HSRPSubsystem");
|
|
||||||
} else {
|
|
||||||
$self->no_such_mode();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub analyze_fex_subsystem {
|
|
||||||
my $self = shift;
|
|
||||||
$self->{components}->{fex_subsystem} = Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem->new();
|
|
||||||
@{$self->{fexes}} = grep {
|
|
||||||
$_->{entPhysicalName} =~ /^fex.*chassis$/i;
|
|
||||||
} map {
|
|
||||||
$_->{entPhysicalName} ||= $_->{entPhysicalDescr}; $_;
|
|
||||||
} grep {
|
|
||||||
$_->{entPhysicalClass} eq "chassis"
|
|
||||||
} @{$self->{components}->{fex_subsystem}->{entities}};
|
|
||||||
}
|
|
||||||
|
|
||||||
sub check_fex_subsystem {
|
|
||||||
my $self = shift;
|
|
||||||
$self->add_info('counting fexes');
|
|
||||||
$self->{numOfFexes} = scalar (@{$self->{fexes}});
|
|
||||||
$self->{fexNameList} = [map { $_->{entPhysicalName} } @{$self->{fexes}}];
|
|
||||||
if (scalar (@{$self->{fexes}}) == 0) {
|
|
||||||
$self->add_unknown('no FEXes found');
|
|
||||||
} else {
|
|
||||||
$self->opts->override_opt('lookback', 1800) if ! $self->opts->lookback;
|
|
||||||
$self->valdiff({name => $self->{name}, lastarray => 1},
|
|
||||||
qw(fexNameList numOfFexes));
|
|
||||||
if (scalar(@{$self->{delta_found_fexNameList}}) > 0) {
|
|
||||||
$self->add_warning(sprintf '%d new FEX(es) (%s)',
|
|
||||||
scalar(@{$self->{delta_found_fexNameList}}),
|
|
||||||
join(", ", @{$self->{delta_found_fexNameList}}));
|
|
||||||
}
|
|
||||||
if (scalar(@{$self->{delta_lost_fexNameList}}) > 0) {
|
|
||||||
$self->add_critical(sprintf '%d FEXes missing (%s)',
|
|
||||||
scalar(@{$self->{delta_lost_fexNameList}}),
|
|
||||||
join(", ", @{$self->{delta_lost_fexNameList}}));
|
|
||||||
}
|
|
||||||
$self->add_ok(sprintf 'found %d FEXes', scalar (@{$self->{fexes}}));
|
|
||||||
$self->add_perfdata(
|
|
||||||
label => 'num_fexes',
|
|
||||||
value => $self->{numOfFexes},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,79 +0,0 @@
|
||||||
package Classes::Cisco::NXOS::Component::CpuSubsystem;
|
|
||||||
our @ISA = qw(GLPlugin::SNMP::Item);
|
|
||||||
use strict;
|
|
||||||
|
|
||||||
sub init {
|
|
||||||
my $self = shift;
|
|
||||||
my $type = 0;
|
|
||||||
foreach ($self->get_snmp_table_objects(
|
|
||||||
'CISCO-PROCESS-MIB', 'cpmCPUTotalTable')) {
|
|
||||||
$_->{cpmCPUTotalIndex} ||= $type++;
|
|
||||||
push(@{$self->{cpus}},
|
|
||||||
Classes::Cisco::NXOS::Component::CpuSubsystem::Cpu->new(%{$_}));
|
|
||||||
}
|
|
||||||
if (scalar(@{$self->{cpus}}) == 0) {
|
|
||||||
# maybe too old. i fake a cpu. be careful. this is a really bad hack
|
|
||||||
my $response = $self->get_request(
|
|
||||||
-varbindlist => [
|
|
||||||
$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy1},
|
|
||||||
$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy5},
|
|
||||||
$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{busyPer},
|
|
||||||
]
|
|
||||||
);
|
|
||||||
if (exists $response->{$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy1}}) {
|
|
||||||
push(@{$self->{cpus}},
|
|
||||||
Classes::Cisco::NXOS::Component::CpuSubsystem::Cpu->new(
|
|
||||||
cpmCPUTotalPhysicalIndex => 0, #fake
|
|
||||||
cpmCPUTotalIndex => 0, #fake
|
|
||||||
cpmCPUTotal5sec => 0, #fake
|
|
||||||
cpmCPUTotal5secRev => 0, #fake
|
|
||||||
cpmCPUTotal1min => $response->{$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy1}},
|
|
||||||
cpmCPUTotal1minRev => $response->{$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy1}},
|
|
||||||
cpmCPUTotal5min => $response->{$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy5}},
|
|
||||||
cpmCPUTotal5minRev => $response->{$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy5}},
|
|
||||||
cpmCPUMonInterval => 0, #fake
|
|
||||||
cpmCPUTotalMonIntervalValue => 0, #fake
|
|
||||||
cpmCPUInterruptMonIntervalValue => 0, #fake
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
package Classes::Cisco::NXOS::Component::CpuSubsystem::Cpu;
|
|
||||||
our @ISA = qw(GLPlugin::SNMP::TableItem);
|
|
||||||
use strict;
|
|
||||||
|
|
||||||
sub new {
|
|
||||||
my $class = shift;
|
|
||||||
my %params = @_;
|
|
||||||
my $self = {};
|
|
||||||
foreach (keys %params) {
|
|
||||||
$self->{$_} = $params{$_};
|
|
||||||
}
|
|
||||||
bless $self, $class;
|
|
||||||
$self->{usage} = $params{cpmCPUTotal5minRev};
|
|
||||||
if ($self->{cpmCPUTotalPhysicalIndex}) {
|
|
||||||
my $entPhysicalName = '1.3.6.1.2.1.47.1.1.1.1.7';
|
|
||||||
$self->{entPhysicalName} = $self->get_request(
|
|
||||||
-varbindlist => [$entPhysicalName.'.'.$self->{cpmCPUTotalPhysicalIndex}]
|
|
||||||
);
|
|
||||||
$self->{entPhysicalName} = $self->{entPhysicalName}->{$entPhysicalName.'.'.$self->{cpmCPUTotalPhysicalIndex}};
|
|
||||||
} else {
|
|
||||||
$self->{entPhysicalName} = $self->{cpmCPUTotalIndex};
|
|
||||||
}
|
|
||||||
return $self;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub check {
|
|
||||||
my $self = shift;
|
|
||||||
$self->add_info(sprintf 'cpu %s usage (5 min avg.) is %.2f%%',
|
|
||||||
$self->{entPhysicalName}, $self->{usage});
|
|
||||||
$self->set_thresholds(warning => 80, critical => 90);
|
|
||||||
$self->add_message($self->check_thresholds($self->{usage}));
|
|
||||||
$self->add_perfdata(
|
|
||||||
label => 'cpu_'.$self->{entPhysicalName}.'_usage',
|
|
||||||
value => $self->{usage},
|
|
||||||
uom => '%',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
package Classes::SGOS::Component::SensorSubsystem;
|
|
||||||
our @ISA = qw(GLPlugin::SNMP::Item);
|
|
||||||
use strict;
|
|
||||||
|
|
||||||
sub init {
|
|
||||||
my $self = shift;
|
|
||||||
$self->get_snmp_tables('SENSOR-MIB', [
|
|
||||||
['sensors', 'deviceSensorValueTable', 'Classes::SGOS::Component::SensorSubsystem::Sensor'],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
package Classes::SGOS::Component::SensorSubsystem::Sensor;
|
|
||||||
our @ISA = qw(GLPlugin::SNMP::TableItem);
|
|
||||||
use strict;
|
|
||||||
|
|
||||||
sub check {
|
|
||||||
my $self = shift;
|
|
||||||
if ($self->{deviceSensorScale}) {
|
|
||||||
$self->{deviceSensorValue} *= 10 ** $self->{deviceSensorScale};
|
|
||||||
}
|
|
||||||
$self->add_info(sprintf 'sensor %s (%s %s) is %s',
|
|
||||||
$self->{deviceSensorName},
|
|
||||||
$self->{deviceSensorValue},
|
|
||||||
$self->{deviceSensorUnits},
|
|
||||||
$self->{deviceSensorCode});
|
|
||||||
if ($self->{deviceSensorCode} eq "not-installed") {
|
|
||||||
} elsif ($self->{deviceSensorCode} eq "unknown") {
|
|
||||||
} else {
|
|
||||||
if ($self->{deviceSensorCode} ne "ok") {
|
|
||||||
if ($self->{deviceSensorCode} =~ /warning/) {
|
|
||||||
$self->add_warning();
|
|
||||||
} else {
|
|
||||||
$self->add_critical();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$self->add_perfdata(
|
|
||||||
label => sprintf('sensor_%s', $self->{deviceSensorName}),
|
|
||||||
value => $self->{deviceSensorValue},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,6 +2,45 @@
|
||||||
# Changelog of the check_nwc_health plugin #
|
# Changelog of the check_nwc_health plugin #
|
||||||
############################################
|
############################################
|
||||||
|
|
||||||
|
2014-01-02 3.4.2.2
|
||||||
|
- fix lsmpi_io for cisco asr1000 (Thanks Andreas Schulz)
|
||||||
|
- fix Fritz!Box upnp control url (Thanks Bernd)
|
||||||
|
|
||||||
|
2014-12-23 3.4.2.1
|
||||||
|
- use fallbacks to find fexes (cefexConfigTable may not be populated)
|
||||||
|
|
||||||
|
2014-12-16 3.4.2
|
||||||
|
- use cefexConfigTable for mode watch-fexes
|
||||||
|
- bugfix in cisco nexus sensors (had undef perl warnings)
|
||||||
|
|
||||||
|
2014-12-12 3.4.1
|
||||||
|
- bugfix in bluecoat hardware (skip perfdata of missing psus)
|
||||||
|
|
||||||
|
2014-12-11 3.4
|
||||||
|
- add vpn-status for cisco asa
|
||||||
|
|
||||||
|
2014-12-08 3.3
|
||||||
|
- add windowslocal
|
||||||
|
|
||||||
|
2014-12-06 3.2.2
|
||||||
|
- unique names for cisco cpus pointing to the same physical entity
|
||||||
|
|
||||||
|
2014-11-29 3.2.1
|
||||||
|
- remove unnecessary use statement
|
||||||
|
- finalize paloalto ha
|
||||||
|
- make list-interfaces and update-cache faster
|
||||||
|
|
||||||
|
2014-11-18 3.2.0.1
|
||||||
|
- hide some debug printfs
|
||||||
|
|
||||||
|
2014-11-10 3.2
|
||||||
|
- add palo alto hardware, sensors, ha
|
||||||
|
- make nexus cpu names unique
|
||||||
|
|
||||||
|
2014-11-02 3.1.1
|
||||||
|
- bugfix my-modes
|
||||||
|
- add paloaltomib
|
||||||
|
|
||||||
2014-09-26 3.1
|
2014-09-26 3.1
|
||||||
- add Clavister Firewall (Thanks Dirk Goetz)
|
- add Clavister Firewall (Thanks Dirk Goetz)
|
||||||
- fix GLPluginSNMP, all timeout-like errors are UNKNOWN
|
- fix GLPluginSNMP, all timeout-like errors are UNKNOWN
|
|
@ -1,7 +1,7 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# From configure.ac .
|
# From configure.ac .
|
||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated by GNU Autoconf 2.69 for check_nwc_health 3.1.
|
# Generated by GNU Autoconf 2.69 for check_nwc_health 3.4.2.2.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
|
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
|
||||||
|
@ -577,8 +577,8 @@ MAKEFLAGS=
|
||||||
# Identity of this package.
|
# Identity of this package.
|
||||||
PACKAGE_NAME='check_nwc_health'
|
PACKAGE_NAME='check_nwc_health'
|
||||||
PACKAGE_TARNAME='check_nwc_health'
|
PACKAGE_TARNAME='check_nwc_health'
|
||||||
PACKAGE_VERSION='3.1'
|
PACKAGE_VERSION='3.4.2.2'
|
||||||
PACKAGE_STRING='check_nwc_health 3.1'
|
PACKAGE_STRING='check_nwc_health 3.4.2.2'
|
||||||
PACKAGE_BUGREPORT=''
|
PACKAGE_BUGREPORT=''
|
||||||
PACKAGE_URL=''
|
PACKAGE_URL=''
|
||||||
|
|
||||||
|
@ -1228,7 +1228,7 @@ if test "$ac_init_help" = "long"; then
|
||||||
# Omit some internal or obsolete options to make the list less imposing.
|
# Omit some internal or obsolete options to make the list less imposing.
|
||||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||||
cat <<_ACEOF
|
cat <<_ACEOF
|
||||||
\`configure' configures check_nwc_health 3.1 to adapt to many kinds of systems.
|
\`configure' configures check_nwc_health 3.4.2.2 to adapt to many kinds of systems.
|
||||||
|
|
||||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||||
|
|
||||||
|
@ -1299,7 +1299,7 @@ fi
|
||||||
|
|
||||||
if test -n "$ac_init_help"; then
|
if test -n "$ac_init_help"; then
|
||||||
case $ac_init_help in
|
case $ac_init_help in
|
||||||
short | recursive ) echo "Configuration of check_nwc_health 3.1:";;
|
short | recursive ) echo "Configuration of check_nwc_health 3.4.2.2:";;
|
||||||
esac
|
esac
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
|
|
||||||
|
@ -1385,7 +1385,7 @@ fi
|
||||||
test -n "$ac_init_help" && exit $ac_status
|
test -n "$ac_init_help" && exit $ac_status
|
||||||
if $ac_init_version; then
|
if $ac_init_version; then
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
check_nwc_health configure 3.1
|
check_nwc_health configure 3.4.2.2
|
||||||
generated by GNU Autoconf 2.69
|
generated by GNU Autoconf 2.69
|
||||||
|
|
||||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||||
|
@ -1402,7 +1402,7 @@ cat >config.log <<_ACEOF
|
||||||
This file contains any messages produced by compilers while
|
This file contains any messages produced by compilers while
|
||||||
running configure, to aid debugging if configure makes a mistake.
|
running configure, to aid debugging if configure makes a mistake.
|
||||||
|
|
||||||
It was created by check_nwc_health $as_me 3.1, which was
|
It was created by check_nwc_health $as_me 3.4.2.2, which was
|
||||||
generated by GNU Autoconf 2.69. Invocation command line was
|
generated by GNU Autoconf 2.69. Invocation command line was
|
||||||
|
|
||||||
$ $0 $@
|
$ $0 $@
|
||||||
|
@ -2265,7 +2265,7 @@ fi
|
||||||
|
|
||||||
# Define the identity of the package.
|
# Define the identity of the package.
|
||||||
PACKAGE='check_nwc_health'
|
PACKAGE='check_nwc_health'
|
||||||
VERSION='3.1'
|
VERSION='3.4.2.2'
|
||||||
|
|
||||||
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
@ -3351,7 +3351,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
||||||
# report actual input values of CONFIG_FILES etc. instead of their
|
# report actual input values of CONFIG_FILES etc. instead of their
|
||||||
# values after options handling.
|
# values after options handling.
|
||||||
ac_log="
|
ac_log="
|
||||||
This file was extended by check_nwc_health $as_me 3.1, which was
|
This file was extended by check_nwc_health $as_me 3.4.2.2, which was
|
||||||
generated by GNU Autoconf 2.69. Invocation command line was
|
generated by GNU Autoconf 2.69. Invocation command line was
|
||||||
|
|
||||||
CONFIG_FILES = $CONFIG_FILES
|
CONFIG_FILES = $CONFIG_FILES
|
||||||
|
@ -3404,7 +3404,7 @@ _ACEOF
|
||||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||||
ac_cs_version="\\
|
ac_cs_version="\\
|
||||||
check_nwc_health config.status 3.1
|
check_nwc_health config.status 3.4.2.2
|
||||||
configured by $0, generated by GNU Autoconf 2.69,
|
configured by $0, generated by GNU Autoconf 2.69,
|
||||||
with options \\"\$ac_cs_config\\"
|
with options \\"\$ac_cs_config\\"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
AC_REVISION ($Revision: 1.150 $)
|
AC_REVISION ($Revision: 1.150 $)
|
||||||
AC_PREREQ(2.58)
|
AC_PREREQ(2.58)
|
||||||
AC_INIT(check_nwc_health,3.1)
|
AC_INIT(check_nwc_health,3.4.2.2)
|
||||||
AM_INIT_AUTOMAKE([1.9 tar-pax])
|
AM_INIT_AUTOMAKE([1.9 tar-pax])
|
||||||
AC_CANONICAL_HOST
|
AC_CANONICAL_HOST
|
||||||
|
|
|
@ -20,6 +20,8 @@ sub init {
|
||||||
$self->analyze_and_check_config_subsystem("Classes::Cisco::IOS::Component::NatSubsystem");
|
$self->analyze_and_check_config_subsystem("Classes::Cisco::IOS::Component::NatSubsystem");
|
||||||
} elsif ($self->mode =~ /device::interfaces::nat::rejects/) {
|
} elsif ($self->mode =~ /device::interfaces::nat::rejects/) {
|
||||||
$self->analyze_and_check_config_subsystem("Classes::Cisco::IOS::Component::NatSubsystem");
|
$self->analyze_and_check_config_subsystem("Classes::Cisco::IOS::Component::NatSubsystem");
|
||||||
|
} elsif ($self->mode =~ /device::vpn::status/) {
|
||||||
|
$self->analyze_and_check_config_subsystem("Classes::Cisco::CISCOIPSECFLOWMONITOR::Component::VpnSubsystem");
|
||||||
} else {
|
} else {
|
||||||
$self->no_such_mode();
|
$self->no_such_mode();
|
||||||
}
|
}
|
|
@ -120,7 +120,7 @@ sub check {
|
||||||
$self->check_thresholds(metric => $label, value => $self->{entSensorValue}) == CRITICAL) ||
|
$self->check_thresholds(metric => $label, value => $self->{entSensorValue}) == CRITICAL) ||
|
||||||
(defined($warningx) &&
|
(defined($warningx) &&
|
||||||
$self->check_thresholds(metric => $label, value => $self->{entSensorValue}) == WARNING) ||
|
$self->check_thresholds(metric => $label, value => $self->{entSensorValue}) == WARNING) ||
|
||||||
$self->{entSensorThresholdEvaluation} eq "true") {
|
($self->{entSensorThresholdEvaluation} && $self->{entSensorThresholdEvaluation} eq "true")) {
|
||||||
}
|
}
|
||||||
if (defined($criticalx) &&
|
if (defined($criticalx) &&
|
||||||
$self->check_thresholds(metric => $label, value => $self->{entSensorValue}) == CRITICAL) {
|
$self->check_thresholds(metric => $label, value => $self->{entSensorValue}) == CRITICAL) {
|
||||||
|
@ -148,7 +148,7 @@ sub check {
|
||||||
critical => $criticalx,
|
critical => $criticalx,
|
||||||
warning => $warningx,
|
warning => $warningx,
|
||||||
);
|
);
|
||||||
} elsif ($self->{entSensorThresholdEvaluation} eq "true") {
|
} elsif ($self->{entSensorThresholdEvaluation} && $self->{entSensorThresholdEvaluation} eq "true") {
|
||||||
$self->add_warning(sprintf "%s sensor %s threshold evaluation is true (value: %s)",
|
$self->add_warning(sprintf "%s sensor %s threshold evaluation is true (value: %s)",
|
||||||
$self->{entSensorType},
|
$self->{entSensorType},
|
||||||
$self->{entPhysicalIndex},
|
$self->{entPhysicalIndex},
|
|
@ -0,0 +1,41 @@
|
||||||
|
package Classes::Cisco::CISCOIPSECFLOWMONITOR::Component::VpnSubsystem;
|
||||||
|
our @ISA = qw(GLPlugin::SNMP::Item);
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
sub init {
|
||||||
|
my $self = shift;
|
||||||
|
$self->get_snmp_tables('CISCO-IPSEC-FLOW-MONITOR-MIB', [
|
||||||
|
['ciketunnels', 'cikeTunnelTable', 'Classes::Cisco::CISCOIPSECFLOWMONITOR::Component::VpnSubsystem::CikeTunnel', sub { my $o = shift; $o->{parent} = $self; $self->filter_name($o->{cikeTunRemoteValue})}],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my $self = shift;
|
||||||
|
if (! @{$self->{ciketunnels}}) {
|
||||||
|
$self->add_critical(sprintf 'tunnel to %s does not exist',
|
||||||
|
$self->opts->name);
|
||||||
|
} else {
|
||||||
|
foreach (@{$self->{ciketunnels}}) {
|
||||||
|
$_->check();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
package Classes::Cisco::CISCOIPSECFLOWMONITOR::Component::VpnSubsystem::CikeTunnel;
|
||||||
|
our @ISA = qw(GLPlugin::SNMP::TableItem);
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my $self = shift;
|
||||||
|
# cikeTunRemoteValue per --name angegeben, muss active sein
|
||||||
|
# ansonsten watch-vpns, delta tunnels ueberwachen
|
||||||
|
$self->add_info(sprintf 'tunnel to %s is %s',
|
||||||
|
$self->{cikeTunRemoteValue}, $self->{cikeTunStatus});
|
||||||
|
if ($self->{cikeTunStatus} ne 'active') {
|
||||||
|
$self->add_critical();
|
||||||
|
} else {
|
||||||
|
$self->add_ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,112 @@
|
||||||
|
package Classes::Cisco::IOS::Component::CpuSubsystem;
|
||||||
|
our @ISA = qw(GLPlugin::SNMP::Item);
|
||||||
|
use strict;
|
||||||
|
use constant PHYS_NAME => 1;
|
||||||
|
use constant PHYS_ASSET => 2;
|
||||||
|
use constant PHYS_DESCR => 4;
|
||||||
|
|
||||||
|
{
|
||||||
|
our $cpmCPUTotalIndex = 0;
|
||||||
|
our $uniquify = PHYS_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub init {
|
||||||
|
my $self = shift;
|
||||||
|
$self->get_snmp_tables('CISCO-PROCESS-MIB', [
|
||||||
|
['cpus', 'cpmCPUTotalTable', 'Classes::Cisco::IOS::Component::CpuSubsystem::Cpu' ],
|
||||||
|
]);
|
||||||
|
if (scalar(@{$self->{cpus}}) == 0) {
|
||||||
|
# maybe too old. i fake a cpu. be careful. this is a really bad hack
|
||||||
|
my $response = $self->get_request(
|
||||||
|
-varbindlist => [
|
||||||
|
$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy1},
|
||||||
|
$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy5},
|
||||||
|
$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{busyPer},
|
||||||
|
]
|
||||||
|
);
|
||||||
|
if (exists $response->{$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy1}}) {
|
||||||
|
push(@{$self->{cpus}},
|
||||||
|
Classes::Cisco::IOS::Component::CpuSubsystem::Cpu->new(
|
||||||
|
cpmCPUTotalPhysicalIndex => 0, #fake
|
||||||
|
cpmCPUTotalIndex => 0, #fake
|
||||||
|
cpmCPUTotal5sec => 0, #fake
|
||||||
|
cpmCPUTotal5secRev => 0, #fake
|
||||||
|
cpmCPUTotal1min => $response->{$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy1}},
|
||||||
|
cpmCPUTotal1minRev => $response->{$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy1}},
|
||||||
|
cpmCPUTotal5min => $response->{$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy5}},
|
||||||
|
cpmCPUTotal5minRev => $response->{$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy5}},
|
||||||
|
cpmCPUMonInterval => 0, #fake
|
||||||
|
cpmCPUTotalMonIntervalValue => 0, #fake
|
||||||
|
cpmCPUInterruptMonIntervalValue => 0, #fake
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# same cpmCPUTotalPhysicalIndex found in multiple table rows
|
||||||
|
if (scalar(@{$self->{cpus}}) > 1) {
|
||||||
|
my %names = ();
|
||||||
|
foreach my $cpu (@{$self->{cpus}}) {
|
||||||
|
$names{$cpu->{name}}++;
|
||||||
|
}
|
||||||
|
foreach my $cpu (@{$self->{cpus}}) {
|
||||||
|
if ($names{$cpu->{name}} > 1) {
|
||||||
|
# more than one cpu points to the same physical entity
|
||||||
|
$cpu->{name} .= '.'.$cpu->{flat_indices};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
package Classes::Cisco::IOS::Component::CpuSubsystem::Cpu;
|
||||||
|
our @ISA = qw(GLPlugin::SNMP::TableItem);
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
sub finish {
|
||||||
|
my $self = shift;
|
||||||
|
$self->{cpmCPUTotalIndex} = $self->{flat_indices};
|
||||||
|
$self->{cpmCPUTotalPhysicalIndex} = exists $self->{cpmCPUTotalPhysicalIndex} ?
|
||||||
|
$self->{cpmCPUTotalPhysicalIndex} : 0;
|
||||||
|
if (exists $self->{cpmCPUTotal5minRev}) {
|
||||||
|
$self->{usage} = $self->{cpmCPUTotal5minRev};
|
||||||
|
} else {
|
||||||
|
$self->{usage} = $self->{cpmCPUTotal5min};
|
||||||
|
}
|
||||||
|
$self->protect_value($self->{cpmCPUTotalIndex}.$self->{cpmCPUTotalPhysicalIndex}, 'usage', 'percent');
|
||||||
|
if ($self->{cpmCPUTotalPhysicalIndex}) {
|
||||||
|
$self->{entPhysicalName} = $self->get_snmp_object('ENTITY-MIB', 'entPhysicalName', $self->{cpmCPUTotalPhysicalIndex});
|
||||||
|
# wichtig fuer gestacktes zeugs, bei dem entPhysicalName doppelt und mehr vorkommen kann
|
||||||
|
# This object is a user-assigned asset tracking identifier for the physical entity
|
||||||
|
# as specified by a network manager, and provides non-volatile storage of this
|
||||||
|
# information. On the first instantiation of an physical entity, the value of
|
||||||
|
# entPhysicalAssetID associated with that entity is set to the zero-length string.
|
||||||
|
# ...
|
||||||
|
# If write access is implemented for an instance of entPhysicalAssetID, and a value
|
||||||
|
# is written into the instance, the agent must retain the supplied value in the
|
||||||
|
# entPhysicalAssetID instance associated with the same physical entity for as long
|
||||||
|
# as that entity remains instantiated. This includes instantiations across all
|
||||||
|
# re-initializations/reboots of the network management system, including those
|
||||||
|
# which result in a change of the physical entity's entPhysicalIndex value.
|
||||||
|
$self->{entPhysicalAssetID} = $self->get_snmp_object('ENTITY-MIB', 'entPhysicalAssetID', $self->{cpmCPUTotalPhysicalIndex});
|
||||||
|
$self->{entPhysicalDescr} = $self->get_snmp_object('ENTITY-MIB', 'entPhysicalDescr', $self->{cpmCPUTotalPhysicalIndex});
|
||||||
|
$self->{name} = $self->{entPhysicalName} || $self->{entPhysicalDescr};
|
||||||
|
} else {
|
||||||
|
$self->{name} = $self->{cpmCPUTotalIndex};
|
||||||
|
# waere besser, aber dann zerlegts wohl zu viele rrdfiles
|
||||||
|
#$self->{name} = 'central processor';
|
||||||
|
}
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my $self = shift;
|
||||||
|
$self->{label} = $self->{name};
|
||||||
|
$self->add_info(sprintf 'cpu %s usage (5 min avg.) is %.2f%%',
|
||||||
|
$self->{name}, $self->{usage});
|
||||||
|
$self->set_thresholds(warning => 80, critical => 90);
|
||||||
|
$self->add_message($self->check_thresholds($self->{usage}));
|
||||||
|
$self->add_perfdata(
|
||||||
|
label => 'cpu_'.$self->{label}.'_usage',
|
||||||
|
value => $self->{usage},
|
||||||
|
uom => '%',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package Classes::Cisco::NXOS;
|
||||||
|
our @ISA = qw(Classes::Cisco);
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
sub init {
|
||||||
|
my $self = shift;
|
||||||
|
if ($self->mode =~ /device::hardware::health/) {
|
||||||
|
$self->mult_snmp_max_msg_size(10);
|
||||||
|
$self->analyze_and_check_environmental_subsystem("Classes::Cisco::NXOS::Component::EnvironmentalSubsystem");
|
||||||
|
} elsif ($self->mode =~ /device::cisco::fex::watch/) {
|
||||||
|
$self->analyze_and_check_environmental_subsystem("Classes::Cisco::NXOS::Component::FexSubsystem");
|
||||||
|
} elsif ($self->mode =~ /device::hardware::load/) {
|
||||||
|
$self->analyze_and_check_cpu_subsystem("Classes::Cisco::IOS::Component::CpuSubsystem");
|
||||||
|
} elsif ($self->mode =~ /device::hardware::memory/) {
|
||||||
|
$self->analyze_and_check_mem_subsystem("Classes::Cisco::NXOS::Component::MemSubsystem");
|
||||||
|
} elsif ($self->mode =~ /device::hsrp/) {
|
||||||
|
$self->analyze_and_check_hsrp_subsystem("Classes::HSRP::Component::HSRPSubsystem");
|
||||||
|
} else {
|
||||||
|
$self->no_such_mode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package Classes::Cisco::IOS::Component::CpuSubsystem;
|
package Classes::Cisco::NXOS::Component::CpuSubsystem;
|
||||||
our @ISA = qw(GLPlugin::SNMP::Item);
|
our @ISA = qw(GLPlugin::SNMP::Item);
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ use strict;
|
||||||
sub init {
|
sub init {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
$self->get_snmp_tables('CISCO-PROCESS-MIB', [
|
$self->get_snmp_tables('CISCO-PROCESS-MIB', [
|
||||||
['cpus', 'cpmCPUTotalTable', 'Classes::Cisco::IOS::Component::CpuSubsystem::Cpu' ],
|
['cpus', 'cpmCPUTotalTable', 'Classes::Cisco::NXOS::Component::CpuSubsystem::Cpu' ],
|
||||||
]);
|
]);
|
||||||
if (scalar(@{$self->{cpus}}) == 0) {
|
if (scalar(@{$self->{cpus}}) == 0) {
|
||||||
# maybe too old. i fake a cpu. be careful. this is a really bad hack
|
# maybe too old. i fake a cpu. be careful. this is a really bad hack
|
||||||
|
@ -22,7 +22,7 @@ sub init {
|
||||||
);
|
);
|
||||||
if (exists $response->{$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy1}}) {
|
if (exists $response->{$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy1}}) {
|
||||||
push(@{$self->{cpus}},
|
push(@{$self->{cpus}},
|
||||||
Classes::Cisco::IOS::Component::CpuSubsystem::Cpu->new(
|
Classes::Cisco::NXOS::Component::CpuSubsystem::Cpu->new(
|
||||||
cpmCPUTotalPhysicalIndex => 0, #fake
|
cpmCPUTotalPhysicalIndex => 0, #fake
|
||||||
cpmCPUTotalIndex => 0, #fake
|
cpmCPUTotalIndex => 0, #fake
|
||||||
cpmCPUTotal5sec => 0, #fake
|
cpmCPUTotal5sec => 0, #fake
|
||||||
|
@ -39,15 +39,15 @@ sub init {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
package Classes::Cisco::IOS::Component::CpuSubsystem::Cpu;
|
package Classes::Cisco::NXOS::Component::CpuSubsystem::Cpu;
|
||||||
our @ISA = qw(GLPlugin::SNMP::TableItem);
|
our @ISA = qw(GLPlugin::SNMP::TableItem);
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
sub finish {
|
sub finish {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
$self->{cpmCPUTotalIndex} = exists $self->{cpmCPUTotalIndex} ?
|
$self->{cpmCPUTotalIndex} = exists $self->{cpmCPUTotalIndex} ?
|
||||||
$self->{cpmCPUTotalIndex} :
|
$self->{cpmCPUTotalIndex} :
|
||||||
$Classes::Cisco::IOS::Component::CpuSubsystem::cpmCPUTotalIndex++;
|
$Classes::Cisco::NXOS::Component::CpuSubsystem::cpmCPUTotalIndex++;
|
||||||
$self->{cpmCPUTotalPhysicalIndex} = exists $self->{cpmCPUTotalPhysicalIndex} ?
|
$self->{cpmCPUTotalPhysicalIndex} = exists $self->{cpmCPUTotalPhysicalIndex} ?
|
||||||
$self->{cpmCPUTotalPhysicalIndex} : 0;
|
$self->{cpmCPUTotalPhysicalIndex} : 0;
|
||||||
if (exists $self->{cpmCPUTotal5minRev}) {
|
if (exists $self->{cpmCPUTotal5minRev}) {
|
||||||
|
@ -57,27 +57,41 @@ sub finish {
|
||||||
}
|
}
|
||||||
$self->protect_value($self->{cpmCPUTotalIndex}.$self->{cpmCPUTotalPhysicalIndex}, 'usage', 'percent');
|
$self->protect_value($self->{cpmCPUTotalIndex}.$self->{cpmCPUTotalPhysicalIndex}, 'usage', 'percent');
|
||||||
if ($self->{cpmCPUTotalPhysicalIndex}) {
|
if ($self->{cpmCPUTotalPhysicalIndex}) {
|
||||||
my $entPhysicalName = '1.3.6.1.2.1.47.1.1.1.1.7';
|
|
||||||
$self->{entPhysicalName} = $self->get_request(
|
|
||||||
-varbindlist => [$entPhysicalName.'.'.$self->{cpmCPUTotalPhysicalIndex}]
|
|
||||||
);
|
|
||||||
$self->{entPhysicalName} = $self->get_snmp_object('ENTITY-MIB', 'entPhysicalName', $self->{cpmCPUTotalPhysicalIndex});
|
$self->{entPhysicalName} = $self->get_snmp_object('ENTITY-MIB', 'entPhysicalName', $self->{cpmCPUTotalPhysicalIndex});
|
||||||
|
# This object is a user-assigned asset tracking identifier for the physical entity
|
||||||
|
# as specified by a network manager, and provides non-volatile storage of this
|
||||||
|
# information. On the first instantiation of an physical entity, the value of
|
||||||
|
# entPhysicalAssetID associated with that entity is set to the zero-length string.
|
||||||
|
# ...
|
||||||
|
# If write access is implemented for an instance of entPhysicalAssetID, and a value
|
||||||
|
# is written into the instance, the agent must retain the supplied value in the
|
||||||
|
# entPhysicalAssetID instance associated with the same physical entity for as long
|
||||||
|
# as that entity remains instantiated. This includes instantiations across all
|
||||||
|
# re-initializations/reboots of the network management system, including those
|
||||||
|
# which result in a change of the physical entity's entPhysicalIndex value.
|
||||||
|
$self->{entPhysicalAssetID} = $self->get_snmp_object('ENTITY-MIB', 'entPhysicalAssetID', $self->{cpmCPUTotalPhysicalIndex});
|
||||||
|
$self->{name} = $self->{entPhysicalName};
|
||||||
|
$self->{name} .= ' '.$self->{entPhysicalAssetID} if $self->{entPhysicalAssetID};
|
||||||
|
$self->{label} = $self->{entPhysicalName};
|
||||||
|
$self->{label} .= ' '.$self->{entPhysicalAssetID} if $self->{entPhysicalAssetID};
|
||||||
} else {
|
} else {
|
||||||
$self->{entPhysicalName} = $self->{cpmCPUTotalIndex};
|
$self->{name} = $self->{cpmCPUTotalIndex};
|
||||||
|
$self->{label} = $self->{cpmCPUTotalIndex};
|
||||||
}
|
}
|
||||||
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check {
|
sub check {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
$self->add_info(sprintf 'cpu %s usage (5 min avg.) is %.2f%%',
|
$self->add_info(sprintf 'cpu %s usage (5 min avg.) is %.2f%%',
|
||||||
$self->{entPhysicalName}, $self->{usage});
|
$self->{name}, $self->{usage});
|
||||||
$self->set_thresholds(warning => 80, critical => 90);
|
$self->set_thresholds(warning => 80, critical => 90);
|
||||||
$self->add_message($self->check_thresholds(value => $self->{usage},
|
$self->add_message($self->check_thresholds($self->{usage}));
|
||||||
metric => 'cpu_'.$self->{entPhysicalName}.'_usage'));
|
|
||||||
$self->add_perfdata(
|
$self->add_perfdata(
|
||||||
label => 'cpu_'.$self->{entPhysicalName}.'_usage',
|
label => 'cpu_'.$self->{label}.'_usage',
|
||||||
value => $self->{usage},
|
value => $self->{usage},
|
||||||
uom => '%',
|
uom => '%',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,115 @@
|
||||||
|
package Classes::Cisco::NXOS::Component::FexSubsystem;
|
||||||
|
our @ISA = qw(GLPlugin::SNMP::Item);
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
sub init {
|
||||||
|
my $self = shift;
|
||||||
|
$self->get_snmp_tables('CISCO-ETHERNET-FABRIC-EXTENDER-MIB', [
|
||||||
|
['fexes', 'cefexConfigTable', 'Classes::Cisco::NXOS::Component::FexSubsystem::Fex'],
|
||||||
|
]);
|
||||||
|
if (scalar (@{$self->{fexes}}) == 0) {
|
||||||
|
# fallback
|
||||||
|
$self->get_snmp_tables('ENTITY-MIB', [
|
||||||
|
['fexes', 'entPhysicalTable', 'Classes::Cisco::NXOS::Component::FexSubsystem::Fex'],
|
||||||
|
]);
|
||||||
|
@{$self->{fexes}} = grep {
|
||||||
|
$_->{entPhysicalClass} eq 'chassis' && $_->{entPhysicalDescr} =~ /fex/i;
|
||||||
|
} @{$self->{fexes}};
|
||||||
|
if (scalar (@{$self->{fexes}}) == 0) {
|
||||||
|
$self->get_snmp_tables('ENTITY-MIB', [
|
||||||
|
['fexes', 'entPhysicalTable', 'Classes::Cisco::NXOS::Component::FexSubsystem::Fex'],
|
||||||
|
]);
|
||||||
|
# fallback
|
||||||
|
my $known_fexes = {};
|
||||||
|
@{$self->{fexes}} = grep {
|
||||||
|
! $known_fexes->{$_->{cefexConfigExtenderName}}++;
|
||||||
|
} grep {
|
||||||
|
$_->{entPhysicalClass} eq 'other' && $_->{entPhysicalDescr} =~ /fex.*cable/i;
|
||||||
|
} @{$self->{fexes}};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub dump {
|
||||||
|
my $self = shift;
|
||||||
|
foreach (@{$self->{fexes}}) {
|
||||||
|
$_->dump();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my $self = shift;
|
||||||
|
$self->add_info('counting fexes');
|
||||||
|
$self->{numOfFexes} = scalar (@{$self->{fexes}});
|
||||||
|
$self->{fexNameList} = [map { $_->{cefexConfigExtenderName} } @{$self->{fexes}}];
|
||||||
|
if (scalar (@{$self->{fexes}}) == 0) {
|
||||||
|
$self->add_unknown('no FEXes found');
|
||||||
|
} else {
|
||||||
|
# lookback, denn sonst muesste der check is_volatile sein und koennte bei
|
||||||
|
# einem kurzen netzausfall fehler schmeissen.
|
||||||
|
# empfehlung: check_interval 5 (muss jedesmal die entity-mib durchwalken)
|
||||||
|
# retry_interval 2
|
||||||
|
# max_check_attempts 2
|
||||||
|
# --lookback 360
|
||||||
|
$self->opts->override_opt('lookback', 1800) if ! $self->opts->lookback;
|
||||||
|
$self->valdiff({name => $self->{name}, lastarray => 1},
|
||||||
|
qw(fexNameList numOfFexes));
|
||||||
|
if (scalar(@{$self->{delta_found_fexNameList}}) > 0) {
|
||||||
|
$self->add_warning(sprintf '%d new FEX(es) (%s)',
|
||||||
|
scalar(@{$self->{delta_found_fexNameList}}),
|
||||||
|
join(", ", @{$self->{delta_found_fexNameList}}));
|
||||||
|
}
|
||||||
|
if (scalar(@{$self->{delta_lost_fexNameList}}) > 0) {
|
||||||
|
$self->add_critical(sprintf '%d FEXes missing (%s)',
|
||||||
|
scalar(@{$self->{delta_lost_fexNameList}}),
|
||||||
|
join(", ", @{$self->{delta_lost_fexNameList}}));
|
||||||
|
}
|
||||||
|
$self->add_ok(sprintf 'found %d FEXes', scalar (@{$self->{fexes}}));
|
||||||
|
$self->add_perfdata(
|
||||||
|
label => 'num_fexes',
|
||||||
|
value => $self->{numOfFexes},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
package Classes::Cisco::NXOS::Component::FexSubsystem::Fex;
|
||||||
|
our @ISA = qw(GLPlugin::SNMP::TableItem);
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
sub finish {
|
||||||
|
my $self = shift;
|
||||||
|
$self->{original_cefexConfigExtenderName} = $self->{cefexConfigExtenderName};
|
||||||
|
if (exists $self->{entPhysicalClass}) {
|
||||||
|
# stammt aus ENTITY-MIB
|
||||||
|
if ($self->{entPhysicalDescr} =~ /^FEX[^\d]*(\d+)/i) {
|
||||||
|
$self->{cefexConfigExtenderName} = "FEX".$1;
|
||||||
|
} else {
|
||||||
|
$self->{cefexConfigExtenderName} = $self->{entPhysicalDescr};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
# stammt aus CISCO-ETHERNET-FABRIC-EXTENDER-MIB, kann FEX101-J8-VT04.01 heissen
|
||||||
|
if ($self->{cefexConfigExtenderName} =~ /^FEX[^\d]*(\d+)/i) {
|
||||||
|
$self->{cefexConfigExtenderName} = "FEX".$1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
__END__
|
||||||
|
entweder die cefexConfigTable ist bestueckt oder man liest als Fallback die Entities aus
|
||||||
|
entPhysicalAlias:
|
||||||
|
entPhysicalAssetID:
|
||||||
|
entPhysicalClass: chassis
|
||||||
|
entPhysicalContainedIn: 10
|
||||||
|
entPhysicalDescr: Fex-107 Nexus2248 Chassis
|
||||||
|
entPhysicalFirmwareRev:
|
||||||
|
entPhysicalHardwareRev: V03
|
||||||
|
entPhysicalIsFRU: 2
|
||||||
|
entPhysicalMfgName: Cisco Systems, Inc.
|
||||||
|
entPhysicalModelName: Fabric Extender Module: 48x1GE, 4x10GE
|
||||||
|
entPhysicalName: Fex-107 Nexus2248 Chassis
|
||||||
|
entPhysicalParentRelPos: 107
|
||||||
|
entPhysicalSerialNum: SSI162802BH
|
||||||
|
entPhysicalSoftwareRev:
|
||||||
|
entPhysicalVendorType: 1.3.6.1.4.1.9.12.3.1.3.914
|
||||||
|
|
|
@ -8,6 +8,11 @@ sub classify {
|
||||||
$self->add_unknown('either specify a hostname or a snmpwalk file');
|
$self->add_unknown('either specify a hostname or a snmpwalk file');
|
||||||
} else {
|
} else {
|
||||||
if ($self->opts->servertype && $self->opts->servertype eq 'linuxlocal') {
|
if ($self->opts->servertype && $self->opts->servertype eq 'linuxlocal') {
|
||||||
|
} elsif ($self->opts->servertype && $self->opts->servertype eq 'windowslocal') {
|
||||||
|
eval "use DBD::WMI";
|
||||||
|
if ($@) {
|
||||||
|
$self->add_unknown("module DBD::WMI is not installed");
|
||||||
|
}
|
||||||
} elsif ($self->opts->port && $self->opts->port == 49000) {
|
} elsif ($self->opts->port && $self->opts->port == 49000) {
|
||||||
$self->{productname} = 'upnp';
|
$self->{productname} = 'upnp';
|
||||||
$self->check_upnp_and_model();
|
$self->check_upnp_and_model();
|
||||||
|
@ -43,6 +48,9 @@ sub classify {
|
||||||
} elsif ($self->{productname} =~ /linuxlocal/i) {
|
} elsif ($self->{productname} =~ /linuxlocal/i) {
|
||||||
bless $self, 'Server::Linux';
|
bless $self, 'Server::Linux';
|
||||||
$self->debug('using Server::Linux');
|
$self->debug('using Server::Linux');
|
||||||
|
} elsif ($self->{productname} =~ /windowslocal/i) {
|
||||||
|
bless $self, 'Server::Windows';
|
||||||
|
$self->debug('using Server::Windows');
|
||||||
} elsif ($self->{productname} =~ /Cisco/i) {
|
} elsif ($self->{productname} =~ /Cisco/i) {
|
||||||
bless $self, 'Classes::Cisco';
|
bless $self, 'Classes::Cisco';
|
||||||
$self->debug('using Classes::Cisco');
|
$self->debug('using Classes::Cisco');
|
||||||
|
@ -99,6 +107,9 @@ sub classify {
|
||||||
} elsif ($self->implements_mib('NETSCREEN-PRODUCTS-MIB')) {
|
} elsif ($self->implements_mib('NETSCREEN-PRODUCTS-MIB')) {
|
||||||
$self->debug('using Classes::Juniper::NetScreen');
|
$self->debug('using Classes::Juniper::NetScreen');
|
||||||
bless $self, 'Classes::Juniper::NetScreen';
|
bless $self, 'Classes::Juniper::NetScreen';
|
||||||
|
} elsif ($self->implements_mib('PAN-PRODUCTS-MIB')) {
|
||||||
|
$self->debug('using Classes::PaloAlto');
|
||||||
|
bless $self, 'Classes::PaloAlto';
|
||||||
} elsif ($self->{productname} =~ /SecureOS/i) {
|
} elsif ($self->{productname} =~ /SecureOS/i) {
|
||||||
bless $self, 'Classes::SecureOS';
|
bless $self, 'Classes::SecureOS';
|
||||||
$self->debug('using Classes::SecureOS');
|
$self->debug('using Classes::SecureOS');
|
|
@ -0,0 +1,4 @@
|
||||||
|
package Classes::ENTITYSENSORMIB;
|
||||||
|
our @ISA = qw(Classes::Device);
|
||||||
|
use strict;
|
||||||
|
|
|
@ -0,0 +1,107 @@
|
||||||
|
package Classes::ENTITYSENSORMIB::Component::EnvironmentalSubsystem;
|
||||||
|
our @ISA = qw(GLPlugin::SNMP::Item);
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
sub init {
|
||||||
|
my $self = shift;
|
||||||
|
$self->get_snmp_tables('ENTITY-MIB', [
|
||||||
|
['entities', 'entPhysicalTable', 'GLPlugin::TableItem', sub { my $o = shift; $o->{entPhysicalClass} eq 'sensor';}],
|
||||||
|
]);
|
||||||
|
$self->get_snmp_tables('ENTITY-SENSOR-MIB', [
|
||||||
|
['sensors', 'entPhySensorTable', 'Classes::ENTITYSENSORMIB::Component::EnvironmentalSubsystem::Sensor' ],
|
||||||
|
]);
|
||||||
|
foreach (@{$self->{sensors}}) {
|
||||||
|
$_->{entPhySensorEntityName} = shift(@{$self->{entities}})->{entPhysicalName};
|
||||||
|
}
|
||||||
|
delete $self->{entities};
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my $self = shift;
|
||||||
|
foreach (@{$self->{sensors}}) {
|
||||||
|
$_->check();
|
||||||
|
}
|
||||||
|
if (! $self->check_messages()) {
|
||||||
|
$self->add_ok("environmental hardware working fine");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub dump {
|
||||||
|
my $self = shift;
|
||||||
|
foreach (@{$self->{sensors}}) {
|
||||||
|
$_->dump();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
package Classes::ENTITYSENSORMIB::Component::EnvironmentalSubsystem::Sensor;
|
||||||
|
our @ISA = qw(GLPlugin::SNMP::TableItem);
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
sub finish {
|
||||||
|
my $self = shift;
|
||||||
|
if ($self->{entPhySensorType} eq 'rpm') {
|
||||||
|
bless $self, 'Classes::ENTITYSENSORMIB::Component::EnvironmentalSubsystem::Sensor::Fan';
|
||||||
|
} elsif ($self->{entPhySensorType} eq 'celsius') {
|
||||||
|
bless $self, 'Classes::ENTITYSENSORMIB::Component::EnvironmentalSubsystem::Sensor::Temperature';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my $self = shift;
|
||||||
|
if ($self->{entPhySensorOperStatus} ne 'ok') {
|
||||||
|
$self->add_info(sprintf '%s has status %s\n',
|
||||||
|
$self->{entity}->{entPhysicalName},
|
||||||
|
$self->{entPhySensorOperStatus});
|
||||||
|
if ($self->{entPhySensorOperStatus} eq 'nonoperational') {
|
||||||
|
$self->add_critical();
|
||||||
|
} else {
|
||||||
|
$self->add_unknown();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$self->add_info(sprintf "%s reports %s%s",
|
||||||
|
$self->{entPhySensorEntityName},
|
||||||
|
$self->{entPhySensorValue},
|
||||||
|
$self->{entPhySensorUnitsDisplay}
|
||||||
|
);
|
||||||
|
#$self->add_ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
package Classes::ENTITYSENSORMIB::Component::EnvironmentalSubsystem::Sensor::Temperature;
|
||||||
|
our @ISA = qw(Classes::ENTITYSENSORMIB::Component::EnvironmentalSubsystem::Sensor);
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
sub rename {
|
||||||
|
my $self = shift;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my $self = shift;
|
||||||
|
$self->SUPER::check();
|
||||||
|
my $label = $self->{entPhySensorEntityName};
|
||||||
|
$label =~ s/[Tt]emperature\s*@\s*(.*)/$1/;
|
||||||
|
$self->add_perfdata(
|
||||||
|
label => 'temp_'.$label,
|
||||||
|
value => $self->{entPhySensorValue},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
package Classes::ENTITYSENSORMIB::Component::EnvironmentalSubsystem::Sensor::Fan;
|
||||||
|
our @ISA = qw(Classes::ENTITYSENSORMIB::Component::EnvironmentalSubsystem::Sensor);
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my $self = shift;
|
||||||
|
$self->SUPER::check();
|
||||||
|
my $label = $self->{entPhySensorEntityName};
|
||||||
|
$label =~ s/ RPM$//g;
|
||||||
|
$label =~ s/Fan #(\d+)/$1/g;
|
||||||
|
$self->add_perfdata(
|
||||||
|
label => 'fan_'.$label,
|
||||||
|
value => $self->{entPhySensorValue},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue