check_nwc_health: Updating to 3.0.3.7
This commit is contained in:
parent
e95e2a8f9a
commit
15a3d1f73c
|
@ -1,58 +0,0 @@
|
|||
<?php
|
||||
|
||||
#
|
||||
# This is a template for the visualisation addon PNP (http://www.pnp4nagios.org)
|
||||
#
|
||||
# Plugin: check_nwc_health - https://labs.consol.de/nagios/check_nwc_health/
|
||||
# Release 1.0 2013-07-18
|
||||
#
|
||||
|
||||
$def[1] = "";
|
||||
$opt[1] = "";
|
||||
|
||||
$_WARNRULE = '#FFFF00';
|
||||
$_CRITRULE = '#FF0000';
|
||||
|
||||
$num = 1;
|
||||
foreach ($DS as $i=>$VAL) {
|
||||
|
||||
# eth0_usage_in / out
|
||||
if(preg_match('/^(.*?)_usage_in/', $NAME[$i])) {
|
||||
$interface = preg_replace('/_.*$/', '', $NAME[$i]);
|
||||
$ds_name[$num] = $interface.' usage';
|
||||
$opt[$num] = "--vertical-label \"Usage\" -l 0 -u 100 --title \"Interface Usage for $hostname - ".$interface."\" ";
|
||||
$def[$num] = "DEF:percin=$RRDFILE[$i]:$DS[$i]:AVERAGE ";
|
||||
$def[$num] .= "DEF:percout=".$RRDFILE[$i+1].":".$DS[$i+1].":AVERAGE ";
|
||||
$def[$num] .= "LINE2:percin#00e060:\"in\t\" ";
|
||||
$def[$num] .= "GPRINT:percin:LAST:\"%10.1lf %% last\" ";
|
||||
$def[$num] .= "GPRINT:percin:AVERAGE:\"%7.1lf %% avg\" ";
|
||||
$def[$num] .= "GPRINT:percin:MAX:\"%7.1lf %% max\\n\" ";
|
||||
$def[$num] .= "LINE2:percout#0080e0:\"out\t\" ";
|
||||
$def[$num] .= "GPRINT:percout:LAST:\"%10.1lf %% last\" ";
|
||||
$def[$num] .= "GPRINT:percout:AVERAGE:\"%7.1lf %% avg\" ";
|
||||
$def[$num] .= "GPRINT:percout:MAX:\"%7.1lf %% max\"\\n ";
|
||||
$def[$num] .= "HRULE:$WARN[$num]$_WARNRULE ";
|
||||
$def[$num] .= "HRULE:$CRIT[$num]$_CRITRULE ";
|
||||
$num++;
|
||||
}
|
||||
|
||||
# eth0_traffic_in / out
|
||||
if(preg_match('/^(.*?)_traffic_in/', $NAME[$i])) {
|
||||
$interface = preg_replace('/_.*$/', '', $NAME[$i]);
|
||||
$ds_name[$num] = $interface.' traffic';
|
||||
$opt[$num] = "--vertical-label \"Traffic\" -b 1024 --title \"Interface Traffic for $hostname - $interface\" ";
|
||||
$def[$num] = "DEF:bitsin=$RRDFILE[$i]:$DS[$i]:AVERAGE ";
|
||||
$def[$num] .= "DEF:bitsout=".$RRDFILE[$i+1].":".$DS[$i+1].":AVERAGE ";
|
||||
$def[$num] .= "AREA:bitsin#00e060:\"in\t\" ";
|
||||
$def[$num] .= "GPRINT:bitsin:LAST:\"%10.1lf %Sb/s last\" ";
|
||||
$def[$num] .= "GPRINT:bitsin:AVERAGE:\"%7.1lf %Sb/s avg\" ";
|
||||
$def[$num] .= "GPRINT:bitsin:MAX:\"%7.1lf %Sb/s max\\n\" ";
|
||||
$def[$num] .= "CDEF:bitsminusout=0,bitsout,- ";
|
||||
$def[$num] .= "AREA:bitsminusout#0080e0:\"out\t\" ";
|
||||
$def[$num] .= "GPRINT:bitsout:LAST:\"%10.1lf %Sb/s last\" ";
|
||||
$def[$num] .= "GPRINT:bitsout:AVERAGE:\"%7.1lf %Sb/s avg\" ";
|
||||
$def[$num] .= "GPRINT:bitsout:MAX:\"%7.1lf %Sb/s max\\n\" ";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,285 +0,0 @@
|
|||
package Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem;
|
||||
our @ISA = qw(GLPlugin::SNMP::Item);
|
||||
use strict;
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
my $sensors = {};
|
||||
$self->get_snmp_tables('CISCO-ENTITY-SENSOR-MIB', [
|
||||
['sensors', 'entSensorValueTable', 'Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem::Sensor', sub { my $o = shift; $self->filter_name($o->{entPhysicalIndex})}],
|
||||
['thresholds', 'entSensorThresholdTable', 'Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem::SensorThreshold'],
|
||||
]);
|
||||
$self->get_snmp_tables('ENTITY-MIB', [
|
||||
['entities', 'entPhysicalTable', 'Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem::PhysicalEntity'],
|
||||
]);
|
||||
@{$self->{entities}} = grep { $_->{entPhysicalClass} eq 'sendor' } @{$self->{entities}};
|
||||
foreach my $sensor (@{$self->{sensors}}) {
|
||||
$sensors->{$sensor->{entPhysicalIndex}} = $sensor;
|
||||
foreach my $threshold (@{$self->{thresholds}}) {
|
||||
if ($sensor->{entPhysicalIndex} eq $threshold->{entPhysicalIndex}) {
|
||||
push(@{$sensors->{thresholds}}, $threshold);
|
||||
}
|
||||
}
|
||||
foreach my $entity (@{$self->{entities}}) {
|
||||
if ($sensor->{entPhysicalIndex} eq $entity->{entPhysicalIndex}) {
|
||||
$sensor->{entity} = $entity;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
package Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem::Sensor;
|
||||
our @ISA = qw(GLPlugin::SNMP::TableItem);
|
||||
use strict;
|
||||
|
||||
sub finish {
|
||||
my $self = shift;
|
||||
$self->{entPhysicalIndex} = $self->{flat_indices};
|
||||
# www.thaiadmin.org%2Fboard%2Findex.php%3Faction%3Ddlattach%3Btopic%3D45832.0%3Battach%3D23494&ei=kV9zT7GHJ87EsgbEvpX6DQ&usg=AFQjCNHuHiS2MR9TIpYtu7C8bvgzuqxgMQ&cad=rja
|
||||
# zu klaeren. entPhysicalIndex entspricht dem entPhysicalindex der ENTITY-MIB.
|
||||
# In der stehen alle moeglichen Powersupplies etc.
|
||||
# Was bedeutet aber dann entSensorMeasuredEntity? gibt's eh nicht in meinen
|
||||
# Beispiel-walks
|
||||
$self->{thresholds} = [];
|
||||
$self->{entSensorMeasuredEntity} ||= 'undef';
|
||||
}
|
||||
|
||||
sub check {
|
||||
my $self = shift;
|
||||
$self->add_info(sprintf '%s sensor %s%s is %s',
|
||||
$self->{entSensorType},
|
||||
$self->{entPhysicalIndex},
|
||||
exists $self->{entity} ? ' ('.$self->{entity}->{entPhysicalDescr}.')' : '',
|
||||
$self->{entSensorStatus});
|
||||
if ($self->{entSensorStatus} eq "nonoperational") {
|
||||
$self->add_critical();
|
||||
} elsif ($self->{entSensorStatus} eq "unknown_10") {
|
||||
# these sensors do not exist according to cisco-tools
|
||||
return;
|
||||
} elsif ($self->{entSensorStatus} eq "unavailable") {
|
||||
return;
|
||||
} elsif (scalar(grep { $_->{entSensorThresholdEvaluation} eq "true" }
|
||||
@{$self->{thresholds}})) {
|
||||
$self->add_critical(sprintf "%s sensor %s threshold evaluation is true",
|
||||
$self->{entSensorType},
|
||||
$self->{entPhysicalIndex});
|
||||
} else {
|
||||
}
|
||||
if (scalar(@{$self->{thresholds}} == 2)) {
|
||||
# reparaturlauf
|
||||
foreach my $idx (0..1) {
|
||||
my $otheridx = $idx == 0 ? 1 : 0;
|
||||
if (! defined @{$self->{thresholds}}[$idx]->{entSensorThresholdSeverity} &&
|
||||
@{$self->{thresholds}}[$otheridx]->{entSensorThresholdSeverity} eq "minor") {
|
||||
@{$self->{thresholds}}[$idx]->{entSensorThresholdSeverity} = "major";
|
||||
} elsif (! defined @{$self->{thresholds}}[$idx]->{entSensorThresholdSeverity} &&
|
||||
@{$self->{thresholds}}[$otheridx]->{entSensorThresholdSeverity} eq "minor") {
|
||||
@{$self->{thresholds}}[$idx]->{entSensorThresholdSeverity} = "minor";
|
||||
}
|
||||
}
|
||||
my $warning = (map { $_->{entSensorThresholdValue} }
|
||||
grep { $_->{entSensorThresholdSeverity} eq "minor" }
|
||||
@{$self->{thresholds}})[0];
|
||||
my $critical = (map { $_->{entSensorThresholdValue} }
|
||||
grep { $_->{entSensorThresholdSeverity} eq "major" }
|
||||
@{$self->{thresholds}})[0];
|
||||
$self->add_perfdata(
|
||||
label => sprintf('sens_%s_%s', $self->{entSensorType}, $self->{entPhysicalIndex}),
|
||||
value => $self->{entSensorValue},
|
||||
warning => $warning,
|
||||
critical => $critical,
|
||||
);
|
||||
} elsif ($self->{entSensorValue}) {
|
||||
$self->add_perfdata(
|
||||
label => sprintf('sens_%s_%s', $self->{entSensorType}, $self->{entPhysicalIndex}),
|
||||
value => $self->{entSensorValue},
|
||||
warning => $self->{ciscoEnvMonSensorThreshold},
|
||||
critical => undef,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
package Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem::SensorThreshold;
|
||||
our @ISA = qw(GLPlugin::SNMP::TableItem);
|
||||
use strict;
|
||||
|
||||
sub finish {
|
||||
my $self = shift;
|
||||
$self->{entPhysicalIndex} = $self->{indices}->[0];
|
||||
$self->{entSensorThresholdIndex} = $self->{indices}->[1];
|
||||
}
|
||||
|
||||
|
||||
package Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem::PhysicalEntity;
|
||||
our @ISA = qw(GLPlugin::SNMP::TableItem);
|
||||
use strict;
|
||||
|
||||
sub finish {
|
||||
my $self = shift;
|
||||
$self->{entPhysicalIndex} = $self->{flat_indices};
|
||||
}
|
||||
|
||||
|
||||
|
||||
__END__
|
||||
|
||||
nex5-rz2-04# sh env
|
||||
Fan:
|
||||
------------------------------------------------------
|
||||
Fan Model Hw Status
|
||||
------------------------------------------------------
|
||||
Chassis-1 N5K-C5010-FAN -- ok
|
||||
Chassis-2 N5K-C5010-FAN -- ok
|
||||
PS-1 N5K-PAC-550W -- ok
|
||||
PS-2 N5K-PAC-550W -- ok
|
||||
Temperature
|
||||
-----------------------------------------------------------------
|
||||
Module Sensor MajorThresh MinorThres CurTemp Status
|
||||
(Celsius) (Celsius) (Celsius)
|
||||
-----------------------------------------------------------------
|
||||
1 Outlet-1 60 50 45 ok
|
||||
1 Outlet-2 60 50 46 ok
|
||||
1 Intake-1 60 50 33 ok
|
||||
1 Intake-2 60 50 34 ok
|
||||
1 Intake-3 50 40 34 ok
|
||||
1 Intake-4 50 40 34 ok
|
||||
1 PS-1 60 50 33 ok
|
||||
1 PS-2 60 50 31 ok
|
||||
2 Outlet-1 60 50 38 ok
|
||||
|
||||
|
||||
nex5-rz2-04# sh env fex all
|
||||
|
||||
|
||||
Temperature Fex 100:
|
||||
-----------------------------------------------------------------
|
||||
Module Sensor MajorThresh MinorThres CurTemp Status
|
||||
(Celsius) (Celsius) (Celsius)
|
||||
-----------------------------------------------------------------
|
||||
1 Outlet-1 57 45 45 ok
|
||||
1 Die-1 95 85 58 ok
|
||||
|
||||
|
||||
Fan Fex: 100:
|
||||
------------------------------------------------------
|
||||
Fan Model Hw Status
|
||||
------------------------------------------------------
|
||||
Chassis N2K-C2248-FAN -- ok
|
||||
PS-1 N2200-PAC-400W -- ok
|
||||
PS-2 N2200-PAC-400W -- ok
|
||||
|
||||
|
||||
Power Supply Fex 100:
|
||||
---------------------------------------------------------------------------
|
||||
Voltage: 12 Volts
|
||||
-----------------------------------------------------
|
||||
PS Model Power Power Status
|
||||
(Watts) (Amp)
|
||||
-----------------------------------------------------
|
||||
1 N2200-PAC-400W 396.00 33.00 ok
|
||||
2 N2200-PAC-400W 396.00 33.00 ok
|
||||
|
||||
|
||||
Mod Model Power Power Power Power Status
|
||||
Requested Requested Allocated Allocated
|
||||
(Watts) (Amp) (Watts) (Amp)
|
||||
--- ------------------- ------- ---------- --------- ---------- ----------
|
||||
1 N2K-C2248TP-1GE 85.20 7.10 85.20 7.10 powered-up
|
||||
|
||||
|
||||
Power Usage Summary:
|
||||
--------------------
|
||||
Power Supply redundancy mode: redundant
|
||||
|
||||
Total Power Capacity 792.00 W
|
||||
|
||||
Power reserved for Supervisor(s) 85.20 W
|
||||
Power currently used by Modules 0.00 W
|
||||
|
||||
-------------
|
||||
Total Power Available 706.80 W
|
||||
-------------
|
||||
|
||||
|
||||
Temperature Fex 101:
|
||||
-----------------------------------------------------------------
|
||||
Module Sensor MajorThresh MinorThres CurTemp Status
|
||||
(Celsius) (Celsius) (Celsius)
|
||||
-----------------------------------------------------------------
|
||||
1 Outlet-1 57 45 42 ok
|
||||
1 Die-1 95 85 53 ok
|
||||
|
||||
|
||||
Fan Fex: 101:
|
||||
------------------------------------------------------
|
||||
Fan Model Hw Status
|
||||
------------------------------------------------------
|
||||
Chassis N2K-C2248-FAN -- ok
|
||||
PS-1 N2200-PAC-400W -- ok
|
||||
PS-2 N2200-PAC-400W -- ok
|
||||
|
||||
|
||||
Power Supply Fex 101:
|
||||
---------------------------------------------------------------------------
|
||||
Voltage: 12 Volts
|
||||
-----------------------------------------------------
|
||||
PS Model Power Power Status
|
||||
(Watts) (Amp)
|
||||
-----------------------------------------------------
|
||||
1 N2200-PAC-400W 396.00 33.00 ok
|
||||
2 N2200-PAC-400W 396.00 33.00 ok
|
||||
|
||||
|
||||
Mod Model Power Power Power Power Status
|
||||
Requested Requested Allocated Allocated
|
||||
(Watts) (Amp) (Watts) (Amp)
|
||||
--- ------------------- ------- ---------- --------- ---------- ----------
|
||||
1 N2K-C2248TP-1GE 94.80 7.90 94.80 7.90 powered-up
|
||||
|
||||
|
||||
Power Usage Summary:
|
||||
--------------------
|
||||
Power Supply redundancy mode: redundant
|
||||
|
||||
Total Power Capacity 792.00 W
|
||||
|
||||
Power reserved for Supervisor(s) 94.80 W
|
||||
Power currently used by Modules 0.00 W
|
||||
|
||||
-------------
|
||||
Total Power Available 697.20 W
|
||||
-------------
|
||||
|
||||
|
||||
OK - environmental hardware working fine, environmental hardware working fine
|
||||
checking sensors
|
||||
celsius sensor 100021590 (Fex-100 Module-1 Outlet-1) is ok
|
||||
celsius sensor 100021591 (Fex-100 Module-1 Outlet-2) is unknown_10
|
||||
celsius sensor 100021592 (Fex-100 Module-1 Inlet-1) is unknown_10
|
||||
celsius sensor 101021590 (Fex-101 Module-1 Outlet-1) is ok
|
||||
celsius sensor 101021591 (Fex-101 Module-1 Outlet-2) is unknown_10
|
||||
celsius sensor 101021592 (Fex-101 Module-1 Inlet-1) is unknown_10
|
||||
celsius sensor 21590 (Module-1, Outlet-1) is ok
|
||||
celsius sensor 21591 (Module-1, Outlet-2) is ok
|
||||
celsius sensor 21592 (Module-1, Intake-1) is ok
|
||||
celsius sensor 21593 (Module-1, Intake-2) is ok
|
||||
celsius sensor 21594 (Module-1, Intake-3) is ok
|
||||
celsius sensor 21595 (Module-1, Intake-4) is ok
|
||||
celsius sensor 21596 (PowerSupply-1 Sensor-1) is ok
|
||||
celsius sensor 21597 (PowerSupply-2 Sensor-1) is ok
|
||||
celsius sensor 21602 (Module-2, Outlet-1) is ok
|
||||
checking fans
|
||||
fan/tray 100000534 (Fex-100 FanModule-1 ) status is up
|
||||
fan/tray 100000539 (Fex-100 PowerSupply-1 Fan-1 ) status is up
|
||||
fan/tray 100000540 (Fex-100 PowerSupply-2 Fan-1 ) status is up
|
||||
fan/tray 101000534 (Fex-101 FanModule-1 ) status is up
|
||||
fan/tray 101000539 (Fex-101 PowerSupply-1 Fan-1 ) status is up
|
||||
fan/tray 101000540 (Fex-101 PowerSupply-2 Fan-1 ) status is up
|
||||
fan/tray 534 (FanModule-1 ) status is up
|
||||
fan/tray 535 (FanModule-2 ) status is up
|
||||
fan/tray 536 (PowerSupply-1 Fan-1 ) status is up
|
||||
fan/tray 537 (PowerSupply-1 Fan-2 ) status is up
|
||||
fan/tray 538 (PowerSupply-2 Fan-1 ) status is up
|
||||
fan/tray 539 (PowerSupply-2 Fan-2 ) status is up | 'sens_celsius_100021590'=44 'sens_celsius_101021590'=41 'sens_celsius_21590'=44 'sens_celsius_21591'=46 'sens_celsius_21592'=33 'sens_celsius_21593'=34 'sens_celsius_21594'=34 'sens_celsius_21595'=33 'sens_celsius_21596'=33 'sens_celsius_21597'=31 'sens_celsius_21602'=38
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
package Classes::Cisco::IOS::Component::FanSubsystem;
|
||||
our @ISA = qw(GLPlugin::SNMP::Item);
|
||||
use strict;
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
$self->get_snmp_tables('CISCO-ENVMON-MIB', [
|
||||
['fans', 'ciscoEnvMonFanStatusTable', 'Classes::Cisco::IOS::Component::FanSubsystem::Fan'],
|
||||
]);
|
||||
}
|
||||
|
||||
package Classes::Cisco::IOS::Component::FanSubsystem::Fan;
|
||||
our @ISA = qw(GLPlugin::SNMP::TableItem);
|
||||
use strict;
|
||||
|
||||
sub check {
|
||||
my $self = shift;
|
||||
$self->{ciscoEnvMonFanStatusIndex} ||= 0;
|
||||
$self->add_info(sprintf 'fan %d (%s) is %s',
|
||||
$self->{ciscoEnvMonFanStatusIndex},
|
||||
$self->{ciscoEnvMonFanStatusDescr},
|
||||
$self->{ciscoEnvMonFanState});
|
||||
if ($self->{ciscoEnvMonFanState} eq 'notPresent') {
|
||||
} elsif ($self->{ciscoEnvMonFanState} ne 'normal') {
|
||||
$self->add_critical();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
package Classes::Cisco::IOS::Component::PowersupplySubsystem;
|
||||
our @ISA = qw(GLPlugin::SNMP::Item);
|
||||
use strict;
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
$self->get_snmp_tables('CISCO-ENVMON-MIB', [
|
||||
['supplies', 'ciscoEnvMonSupplyStatusTable', 'Classes::Cisco::IOS::Component::PowersupplySubsystem::Powersupply'],
|
||||
]);
|
||||
}
|
||||
|
||||
package Classes::Cisco::IOS::Component::PowersupplySubsystem::Powersupply;
|
||||
our @ISA = qw(GLPlugin::SNMP::TableItem);
|
||||
use strict;
|
||||
|
||||
sub check {
|
||||
my $self = shift;
|
||||
$self->{ciscoEnvMonSupplyStatusIndex} ||= 0;
|
||||
$self->add_info(sprintf 'powersupply %d (%s) is %s',
|
||||
$self->{ciscoEnvMonSupplyStatusIndex},
|
||||
$self->{ciscoEnvMonSupplyStatusDescr},
|
||||
$self->{ciscoEnvMonSupplyState});
|
||||
if ($self->{ciscoEnvMonSupplyState} eq 'notPresent') {
|
||||
} elsif ($self->{ciscoEnvMonSupplyState} ne 'normal') {
|
||||
$self->add_critical();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
package Classes::Cisco::IOS::Component::TemperatureSubsystem;
|
||||
our @ISA = qw(GLPlugin::SNMP::Item);
|
||||
use strict;
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
my $tempcnt = 0;
|
||||
foreach ($self->get_snmp_table_objects(
|
||||
'CISCO-ENVMON-MIB', 'ciscoEnvMonTemperatureStatusTable')) {
|
||||
$_->{ciscoEnvMonTemperatureStatusIndex} = $tempcnt++ if (! exists $_->{ciscoEnvMonTemperatureStatusIndex});
|
||||
push(@{$self->{temperatures}},
|
||||
Classes::Cisco::IOS::Component::TemperatureSubsystem::Temperature->new(%{$_}));
|
||||
}
|
||||
}
|
||||
|
||||
package Classes::Cisco::IOS::Component::TemperatureSubsystem::Temperature;
|
||||
our @ISA = qw(GLPlugin::SNMP::TableItem);
|
||||
use strict;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my %params = @_;
|
||||
my $self = {};
|
||||
foreach (keys %params) {
|
||||
$self->{$_} = $params{$_};
|
||||
}
|
||||
$self->{ciscoEnvMonTemperatureStatusIndex} ||= 0;
|
||||
$self->{ciscoEnvMonTemperatureLastShutdown} ||= 0;
|
||||
if ($self->{ciscoEnvMonTemperatureStatusValue}) {
|
||||
bless $self, $class;
|
||||
} else {
|
||||
bless $self, $class.'::Simple';
|
||||
}
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check {
|
||||
my $self = shift;
|
||||
if ($self->{ciscoEnvMonTemperatureStatusValue} >
|
||||
$self->{ciscoEnvMonTemperatureThreshold}) {
|
||||
$self->add_info(sprintf 'temperature %d %s is too high (%d of %d max = %s)',
|
||||
$self->{ciscoEnvMonTemperatureStatusIndex},
|
||||
$self->{ciscoEnvMonTemperatureStatusDescr},
|
||||
$self->{ciscoEnvMonTemperatureStatusValue},
|
||||
$self->{ciscoEnvMonTemperatureThreshold},
|
||||
$self->{ciscoEnvMonTemperatureState});
|
||||
if ($self->{ciscoEnvMonTemperatureState} eq 'warning') {
|
||||
$self->add_warning();
|
||||
} elsif ($self->{ciscoEnvMonTemperatureState} eq 'critical') {
|
||||
$self->add_critical();
|
||||
}
|
||||
} else {
|
||||
$self->add_info(sprintf 'temperature %d %s is %d (of %d max = normal)',
|
||||
$self->{ciscoEnvMonTemperatureStatusIndex},
|
||||
$self->{ciscoEnvMonTemperatureStatusDescr},
|
||||
$self->{ciscoEnvMonTemperatureStatusValue},
|
||||
$self->{ciscoEnvMonTemperatureThreshold},
|
||||
$self->{ciscoEnvMonTemperatureState});
|
||||
}
|
||||
$self->add_perfdata(
|
||||
label => sprintf('temp_%s', $self->{ciscoEnvMonTemperatureStatusIndex}),
|
||||
value => $self->{ciscoEnvMonTemperatureStatusValue},
|
||||
warning => $self->{ciscoEnvMonTemperatureThreshold},
|
||||
critical => undef,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
package Classes::Cisco::IOS::Component::TemperatureSubsystem::Temperature::Simple;
|
||||
our @ISA = qw(GLPlugin::SNMP::TableItem);
|
||||
use strict;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my %params = @_;
|
||||
my $self = {
|
||||
ciscoEnvMonTemperatureStatusIndex => $params{ciscoEnvMonTemperatureStatusIndex} || 0,
|
||||
ciscoEnvMonTemperatureStatusDescr => $params{ciscoEnvMonTemperatureStatusDescr},
|
||||
ciscoEnvMonTemperatureState => $params{ciscoEnvMonTemperatureState},
|
||||
};
|
||||
bless $self, $class;
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check {
|
||||
my $self = shift;
|
||||
$self->add_info(sprintf 'temperature %d %s is %s',
|
||||
$self->{ciscoEnvMonTemperatureStatusIndex},
|
||||
$self->{ciscoEnvMonTemperatureStatusDescr},
|
||||
$self->{ciscoEnvMonTemperatureState});
|
||||
if ($self->{ciscoEnvMonTemperatureState} ne 'normal') {
|
||||
if ($self->{ciscoEnvMonTemperatureState} eq 'warning') {
|
||||
$self->add_warning();
|
||||
} elsif ($self->{ciscoEnvMonTemperatureState} eq 'critical') {
|
||||
$self->add_critical();
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
package Classes::Cisco::IOS::Component::VoltageSubsystem;
|
||||
our @ISA = qw(GLPlugin::SNMP::Item);
|
||||
use strict;
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
my $index = 0;
|
||||
$self->get_snmp_tables('CISCO-ENVMON-MIB', [
|
||||
['voltages', 'ciscoEnvMonVoltageStatusTable', 'Classes::Cisco::IOS::Component::VoltageSubsystem::Voltage'],
|
||||
]);
|
||||
foreach (@{$self->{voltages}}) {
|
||||
$_->{ciscoEnvMonVoltageStatusIndex} ||= $index++;
|
||||
}
|
||||
}
|
||||
|
||||
package Classes::Cisco::IOS::Component::VoltageSubsystem::Voltage;
|
||||
our @ISA = qw(GLPlugin::SNMP::TableItem);
|
||||
use strict;
|
||||
|
||||
sub check {
|
||||
my $self = shift;
|
||||
$self->add_info(sprintf 'voltage %d (%s) is %s',
|
||||
$self->{ciscoEnvMonVoltageStatusIndex},
|
||||
$self->{ciscoEnvMonVoltageStatusDescr},
|
||||
$self->{ciscoEnvMonVoltageState});
|
||||
if ($self->{ciscoEnvMonVoltageState} eq 'notPresent') {
|
||||
} elsif ($self->{ciscoEnvMonVoltageState} ne 'normal') {
|
||||
$self->add_critical();
|
||||
}
|
||||
$self->add_perfdata(
|
||||
label => sprintf('mvolt_%s', $self->{ciscoEnvMonVoltageStatusIndex}),
|
||||
value => $self->{ciscoEnvMonVoltageStatusValue},
|
||||
warning => $self->{ciscoEnvMonVoltageThresholdLow},
|
||||
critical => $self->{ciscoEnvMonVoltageThresholdHigh},
|
||||
);
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
package Classes::Fortigate::Component::DiskSubsystem;
|
||||
our @ISA = qw(GLPlugin::SNMP::Item);
|
||||
use strict;
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
$self->get_snmp_objects('FORTINET-FORTIGATE-MIB', (qw(
|
||||
fgSysDiskUsage fgSysDiskCapacity)));
|
||||
$self->{usage} = $self->{fgSysDiskCapacity} ?
|
||||
100 * $self->{fgSysDiskUsage} / $self->{fgSysDiskCapacity} : undef;
|
||||
}
|
||||
|
||||
sub check {
|
||||
my $self = shift;
|
||||
$self->add_info('checking disks');
|
||||
if (! defined $self->{usage}) {
|
||||
$self->add_info(sprintf 'system has no disk');
|
||||
return;
|
||||
}
|
||||
$self->add_info(sprintf 'disk is %.2f%% full',
|
||||
$self->{usage});
|
||||
$self->set_thresholds(warning => 80, critical => 90);
|
||||
$self->add_message($self->check_thresholds($self->{usage}));
|
||||
$self->add_perfdata(
|
||||
label => 'disk_usage',
|
||||
value => $self->{usage},
|
||||
uom => '%',
|
||||
);
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
package Classes::MIBII;
|
||||
our @ISA = qw(Classes::Device);
|
||||
use strict;
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
den ganzen scheissdreck in $self->warning() verstecken zb in
|
||||
|
||||
$self->add_perfdata(
|
||||
label => $self->{ciscoMemoryPoolName}.'_usage',
|
||||
value => $self->{usage},
|
||||
uom => '%',
|
||||
warning => $self->{warning},
|
||||
critical => $self->{critical}
|
||||
);
|
||||
|
|
@ -1,500 +0,0 @@
|
|||
package Nagios::MiniPlugin;
|
||||
|
||||
use strict;
|
||||
use Getopt::Long qw(:config no_ignore_case bundling);
|
||||
|
||||
our @STATUS_CODES = qw(OK WARNING CRITICAL UNKNOWN DEPENDENT);
|
||||
|
||||
require Exporter;
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = (@STATUS_CODES, qw(nagios_exit nagios_die check_messages));
|
||||
our @EXPORT_OK = qw(%ERRORS);
|
||||
|
||||
use constant OK => 0;
|
||||
use constant WARNING => 1;
|
||||
use constant CRITICAL => 2;
|
||||
use constant UNKNOWN => 3;
|
||||
use constant DEPENDENT => 4;
|
||||
|
||||
our %ERRORS = (
|
||||
'OK' => OK,
|
||||
'WARNING' => WARNING,
|
||||
'CRITICAL' => CRITICAL,
|
||||
'UNKNOWN' => UNKNOWN,
|
||||
'DEPENDENT' => DEPENDENT,
|
||||
);
|
||||
|
||||
our %STATUS_TEXT = reverse %ERRORS;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my %params = @_;
|
||||
my $self = {
|
||||
perfdata => [],
|
||||
messages => {
|
||||
ok => [],
|
||||
warning => [],
|
||||
critical => [],
|
||||
unknown => [],
|
||||
},
|
||||
args => [],
|
||||
opts => Nagios::MiniPlugin::Getopt->new(%params),
|
||||
};
|
||||
foreach (qw(shortname usage version url plugin blurb extra
|
||||
license timeout)) {
|
||||
$self->{$_} = $params{$_};
|
||||
}
|
||||
bless $self, $class;
|
||||
}
|
||||
|
||||
sub add_arg {
|
||||
my $self = shift;
|
||||
$self->{opts}->add_arg(@_);
|
||||
}
|
||||
|
||||
sub getopts {
|
||||
my $self = shift;
|
||||
$self->{opts}->getopts();
|
||||
}
|
||||
|
||||
sub override_opt {
|
||||
my $self = shift;
|
||||
$self->{opts}->override_opt(@_);
|
||||
}
|
||||
|
||||
sub create_opt {
|
||||
my $self = shift;
|
||||
$self->{opts}->create_opt(@_);
|
||||
}
|
||||
|
||||
sub opts {
|
||||
my $self = shift;
|
||||
return $self->{opts};
|
||||
}
|
||||
|
||||
sub add_message {
|
||||
my $self = shift;
|
||||
my ($code, @messages) = @_;
|
||||
$code = (qw(ok warning critical unknown))[$code] if $code =~ /^\d+$/;
|
||||
$code = lc $code;
|
||||
push @{$self->{messages}->{$code}}, @messages;
|
||||
}
|
||||
|
||||
sub add_perfdata {
|
||||
my ($self, %args) = @_;
|
||||
#if ($args{label} =~ /\s/) {
|
||||
$args{label} = '\''.$args{label}.'\'';
|
||||
#}
|
||||
if (! exists $args{places}) {
|
||||
$args{places} = 2;
|
||||
}
|
||||
my $format = '%d';
|
||||
if ($args{value} =~ /\./) {
|
||||
$format = '%.'.$args{places}.'f';
|
||||
}
|
||||
my $str = $args{label}.'='.sprintf $format, $args{value};
|
||||
if ($args{uom}) {
|
||||
$str .= $args{uom};
|
||||
}
|
||||
if ($args{warning}) {
|
||||
$str .= ';'.$args{warning};
|
||||
}
|
||||
if ($args{critical}) {
|
||||
$str .= ';'.$args{critical};
|
||||
}
|
||||
if (! $args{warning} && ! $args{critical} && $args{uom} && $args{uom} eq '%') {
|
||||
## $str .= ';0;100';
|
||||
}
|
||||
push @{$self->{perfdata}}, $str;
|
||||
}
|
||||
|
||||
sub add_html {
|
||||
my $self = shift;
|
||||
my $line = shift;
|
||||
push @{$self->{html}}, $line;
|
||||
}
|
||||
|
||||
sub suppress_messages {
|
||||
my $self = shift;
|
||||
$self->{suppress_messages} = 1;
|
||||
}
|
||||
|
||||
sub clear_messages {
|
||||
my $self = shift;
|
||||
my $code = shift;
|
||||
$code = (qw(ok warning critical unknown))[$code] if $code =~ /^\d+$/;
|
||||
$code = lc $code;
|
||||
$self->{messages}->{$code} = [];
|
||||
}
|
||||
|
||||
sub check_messages {
|
||||
my $self = shift;
|
||||
my %args = @_;
|
||||
|
||||
# Add object messages to any passed in as args
|
||||
for my $code (qw(critical warning unknown ok)) {
|
||||
my $messages = $self->{messages}->{$code} || [];
|
||||
if ($args{$code}) {
|
||||
unless (ref $args{$code} eq 'ARRAY') {
|
||||
if ($code eq 'ok') {
|
||||
$args{$code} = [ $args{$code} ];
|
||||
}
|
||||
}
|
||||
push @{$args{$code}}, @$messages;
|
||||
} else {
|
||||
$args{$code} = $messages;
|
||||
}
|
||||
}
|
||||
my %arg = %args;
|
||||
$arg{join} = ' ' unless defined $arg{join};
|
||||
|
||||
# Decide $code
|
||||
my $code = OK;
|
||||
$code ||= CRITICAL if @{$arg{critical}};
|
||||
$code ||= WARNING if @{$arg{warning}};
|
||||
$code ||= UNKNOWN if @{$arg{unknown}};
|
||||
return $code unless wantarray;
|
||||
|
||||
# Compose message
|
||||
my $message = '';
|
||||
if ($arg{join_all}) {
|
||||
$message = join( $arg{join_all},
|
||||
map { @$_ ? join( $arg{'join'}, @$_) : () }
|
||||
$arg{critical},
|
||||
$arg{warning},
|
||||
$arg{unknown},
|
||||
$arg{ok} ? (ref $arg{ok} ? $arg{ok} : [ $arg{ok} ]) : []
|
||||
);
|
||||
}
|
||||
|
||||
else {
|
||||
$message ||= join( $arg{'join'}, @{$arg{critical}} )
|
||||
if $code == CRITICAL;
|
||||
$message ||= join( $arg{'join'}, @{$arg{warning}} )
|
||||
if $code == WARNING;
|
||||
$message ||= join( $arg{'join'}, @{$arg{unknown}} )
|
||||
if $code == UNKNOWN;
|
||||
$message ||= ref $arg{ok} ? join( $arg{'join'}, @{$arg{ok}} ) : $arg{ok}
|
||||
if $arg{ok};
|
||||
}
|
||||
|
||||
return ($code, $message);
|
||||
}
|
||||
|
||||
sub status_code {
|
||||
my $self = shift;
|
||||
my $code = shift;
|
||||
$code = (qw(ok warning critical unknown))[$code] if $code =~ /^\d+$/;
|
||||
$code = uc $code;
|
||||
$code = $ERRORS{$code} if defined $code && exists $ERRORS{$code};
|
||||
$code = UNKNOWN unless defined $code && exists $STATUS_TEXT{$code};
|
||||
return "$STATUS_TEXT{$code}";
|
||||
}
|
||||
|
||||
sub perfdata_string {
|
||||
my $self = shift;
|
||||
if (scalar (@{$self->{perfdata}})) {
|
||||
return join(" ", @{$self->{perfdata}});
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
sub html_string {
|
||||
my $self = shift;
|
||||
if (scalar (@{$self->{html}})) {
|
||||
return join(" ", @{$self->{html}});
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
sub nagios_exit {
|
||||
my $self = shift;
|
||||
my ($code, $message, $arg) = @_;
|
||||
$code = $ERRORS{$code} if defined $code && exists $ERRORS{$code};
|
||||
$code = UNKNOWN unless defined $code && exists $STATUS_TEXT{$code};
|
||||
$message = '' unless defined $message;
|
||||
if (ref $message && ref $message eq 'ARRAY') {
|
||||
$message = join(' ', map { chomp; $_ } @$message);
|
||||
} else {
|
||||
chomp $message;
|
||||
}
|
||||
my $output = "$STATUS_TEXT{$code}";
|
||||
$output .= " - $message" if defined $message && $message ne '';
|
||||
if (scalar (@{$self->{perfdata}})) {
|
||||
$output .= " | ".$self->perfdata_string();
|
||||
}
|
||||
$output .= "\n";
|
||||
if (! exists $self->{suppress_messages}) {
|
||||
print $output;
|
||||
}
|
||||
exit $code;
|
||||
}
|
||||
|
||||
sub set_thresholds {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
$self->{mywarning} = $self->opts->warning || $params{warning} || 0;
|
||||
$self->{mycritical} = $self->opts->critical || $params{critical} || 0;
|
||||
}
|
||||
|
||||
sub force_thresholds {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
$self->{mywarning} = $params{warning} || 0;
|
||||
$self->{mycritical} = $params{critical} || 0;
|
||||
}
|
||||
|
||||
sub get_thresholds {
|
||||
my $self = shift;
|
||||
return ($self->{mywarning}, $self->{mycritical});
|
||||
}
|
||||
|
||||
sub check_thresholds {
|
||||
my $self = shift;
|
||||
my @params = @_;
|
||||
my $level = $ERRORS{OK};
|
||||
my $warningrange;
|
||||
my $criticalrange;
|
||||
my $value;
|
||||
if (scalar(@params) > 1) {
|
||||
my %params = @params;
|
||||
$value = $params{check};
|
||||
$warningrange = (defined $params{warning}) ?
|
||||
$params{warning} : $self->{mywarning};
|
||||
$criticalrange = (defined $params{critical}) ?
|
||||
$params{critical} : $self->{mycritical};
|
||||
} else {
|
||||
$value = $params[0];
|
||||
$warningrange = $self->{mywarning};
|
||||
$criticalrange = $self->{mycritical};
|
||||
}
|
||||
if ($warningrange =~ /^([-+]?[0-9]*\.?[0-9]+)$/) {
|
||||
# warning = 10, warn if > 10 or < 0
|
||||
$level = $ERRORS{WARNING}
|
||||
if ($value > $1 || $value < 0);
|
||||
} elsif ($warningrange =~ /^([-+]?[0-9]*\.?[0-9]+):$/) {
|
||||
# warning = 10:, warn if < 10
|
||||
$level = $ERRORS{WARNING}
|
||||
if ($value < $1);
|
||||
} elsif ($warningrange =~ /^~:([-+]?[0-9]*\.?[0-9]+)$/) {
|
||||
# warning = ~:10, warn if > 10
|
||||
$level = $ERRORS{WARNING}
|
||||
if ($value > $1);
|
||||
} elsif ($warningrange =~ /^([-+]?[0-9]*\.?[0-9]+):([-+]?[0-9]*\.?[0-9]+)$/) {
|
||||
# warning = 10:20, warn if < 10 or > 20
|
||||
$level = $ERRORS{WARNING}
|
||||
if ($value < $1 || $value > $2);
|
||||
} elsif ($warningrange =~ /^@([-+]?[0-9]*\.?[0-9]+):([-+]?[0-9]*\.?[0-9]+)$/) {
|
||||
# warning = @10:20, warn if >= 10 and <= 20
|
||||
$level = $ERRORS{WARNING}
|
||||
if ($value >= $1 && $value <= $2);
|
||||
}
|
||||
if ($criticalrange =~ /^([-+]?[0-9]*\.?[0-9]+)$/) {
|
||||
# critical = 10, crit if > 10 or < 0
|
||||
$level = $ERRORS{CRITICAL}
|
||||
if ($value > $1 || $value < 0);
|
||||
} elsif ($criticalrange =~ /^([-+]?[0-9]*\.?[0-9]+):$/) {
|
||||
# critical = 10:, crit if < 10
|
||||
$level = $ERRORS{CRITICAL}
|
||||
if ($value < $1);
|
||||
} elsif ($criticalrange =~ /^~:([-+]?[0-9]*\.?[0-9]+)$/) {
|
||||
# critical = ~:10, crit if > 10
|
||||
$level = $ERRORS{CRITICAL}
|
||||
if ($value > $1);
|
||||
} elsif ($criticalrange =~ /^([-+]?[0-9]*\.?[0-9]+):([-+]?[0-9]*\.?[0-9]+)$/) {
|
||||
# critical = 10:20, crit if < 10 or > 20
|
||||
$level = $ERRORS{CRITICAL}
|
||||
if ($value < $1 || $value > $2);
|
||||
} elsif ($criticalrange =~ /^@([-+]?[0-9]*\.?[0-9]+):([-+]?[0-9]*\.?[0-9]+)$/) {
|
||||
# critical = @10:20, crit if >= 10 and <= 20
|
||||
$level = $ERRORS{CRITICAL}
|
||||
if ($value >= $1 && $value <= $2);
|
||||
}
|
||||
return $level;
|
||||
}
|
||||
|
||||
|
||||
package Nagios::MiniPlugin::Getopt;
|
||||
|
||||
use strict;
|
||||
use File::Basename;
|
||||
use Data::Dumper;
|
||||
use Getopt::Long qw(:config no_ignore_case bundling);
|
||||
|
||||
# Standard defaults
|
||||
my %DEFAULT = (
|
||||
timeout => 15,
|
||||
verbose => 0,
|
||||
license =>
|
||||
"This nagios plugin is free software, and comes with ABSOLUTELY NO WARRANTY.
|
||||
It may be used, redistributed and/or modified under the terms of the GNU
|
||||
General Public Licence (see http://www.fsf.org/licensing/licenses/gpl.txt).",
|
||||
);
|
||||
# Standard arguments
|
||||
my @ARGS = ({
|
||||
spec => 'usage|?',
|
||||
help => "-?, --usage\n Print usage information",
|
||||
}, {
|
||||
spec => 'help|h',
|
||||
help => "-h, --help\n Print detailed help screen",
|
||||
}, {
|
||||
spec => 'version|V',
|
||||
help => "-V, --version\n Print version information",
|
||||
}, {
|
||||
#spec => 'extra-opts:s@',
|
||||
#help => "--extra-opts=[<section>[@<config_file>]]\n Section and/or config_file from which to load extra options (may repeat)",
|
||||
}, {
|
||||
spec => 'timeout|t=i',
|
||||
help => sprintf("-t, --timeout=INTEGER\n Seconds before plugin times out (default: %s)", $DEFAULT{timeout}),
|
||||
default => $DEFAULT{timeout},
|
||||
}, {
|
||||
spec => 'verbose|v+',
|
||||
help => "-v, --verbose\n Show details for command-line debugging (can repeat up to 3 times)",
|
||||
default => $DEFAULT{verbose},
|
||||
},
|
||||
);
|
||||
# Standard arguments we traditionally display last in the help output
|
||||
my %DEFER_ARGS = map { $_ => 1 } qw(timeout verbose);
|
||||
|
||||
sub _init
|
||||
{
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
# Check params
|
||||
my $plugin = basename($ENV{NAGIOS_PLUGIN} || $0);
|
||||
#my %attr = validate( @_, {
|
||||
my %attr = (
|
||||
usage => 1,
|
||||
version => 0,
|
||||
url => 0,
|
||||
plugin => { default => $plugin },
|
||||
blurb => 0,
|
||||
extra => 0,
|
||||
'extra-opts' => 0,
|
||||
license => { default => $DEFAULT{license} },
|
||||
timeout => { default => $DEFAULT{timeout} },
|
||||
);
|
||||
|
||||
# Add attr to private _attr hash (except timeout)
|
||||
$self->{timeout} = delete $attr{timeout};
|
||||
$self->{_attr} = { %attr };
|
||||
foreach (keys %{$self->{_attr}}) {
|
||||
if (exists $params{$_}) {
|
||||
$self->{_attr}->{$_} = $params{$_};
|
||||
} else {
|
||||
$self->{_attr}->{$_} = $self->{_attr}->{$_}->{default}
|
||||
if ref ($self->{_attr}->{$_}) eq 'HASH' &&
|
||||
exists $self->{_attr}->{$_}->{default};
|
||||
}
|
||||
}
|
||||
# Chomp _attr values
|
||||
chomp foreach values %{$self->{_attr}};
|
||||
|
||||
# Setup initial args list
|
||||
$self->{_args} = [ grep { exists $_->{spec} } @ARGS ];
|
||||
|
||||
$self
|
||||
}
|
||||
|
||||
sub new
|
||||
{
|
||||
my $class = shift;
|
||||
my $self = bless {}, $class;
|
||||
$self->_init(@_);
|
||||
}
|
||||
|
||||
sub add_arg {
|
||||
my $self = shift;
|
||||
my %arg = @_;
|
||||
push (@{$self->{_args}}, \%arg);
|
||||
}
|
||||
|
||||
sub getopts {
|
||||
my $self = shift;
|
||||
my %commandline = ();
|
||||
my @params = map { $_->{spec} } @{$self->{_args}};
|
||||
if (! GetOptions(\%commandline, @params)) {
|
||||
$self->print_help();
|
||||
exit 0;
|
||||
} else {
|
||||
no strict 'refs';
|
||||
do { $self->print_help(); exit 0; } if $commandline{help};
|
||||
do { $self->print_version(); exit 0 } if $commandline{version};
|
||||
do { $self->print_usage(); exit 3 } if $commandline{usage};
|
||||
foreach (map { $_->{spec} =~ /^([\w\-]+)/; $1; } @{$self->{_args}}) {
|
||||
my $field = $_;
|
||||
*{"$field"} = sub {
|
||||
return $self->{opts}->{$field};
|
||||
};
|
||||
}
|
||||
foreach (map { $_->{spec} =~ /^([\w\-]+)/; $1; }
|
||||
grep { exists $_->{required} && $_->{required} } @{$self->{_args}}) {
|
||||
do { $self->print_usage(); exit 0 } if ! exists $commandline{$_};
|
||||
}
|
||||
foreach (grep { exists $_->{default} } @{$self->{_args}}) {
|
||||
$_->{spec} =~ /^([\w\-]+)/;
|
||||
my $spec = $1;
|
||||
$self->{opts}->{$spec} = $_->{default};
|
||||
}
|
||||
foreach (keys %commandline) {
|
||||
$self->{opts}->{$_} = $commandline{$_};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub create_opt {
|
||||
my $self = shift;
|
||||
my $key = shift;
|
||||
no strict 'refs';
|
||||
*{"$key"} = sub {
|
||||
return $self->{opts}->{$key};
|
||||
};
|
||||
}
|
||||
|
||||
sub override_opt {
|
||||
my $self = shift;
|
||||
my $key = shift;
|
||||
my $value = shift;
|
||||
$self->{opts}->{$key} = $value;
|
||||
}
|
||||
|
||||
sub get {
|
||||
my $self = shift;
|
||||
my $opt = shift;
|
||||
return $self->{opts}->{$opt};
|
||||
}
|
||||
|
||||
sub print_help {
|
||||
my $self = shift;
|
||||
$self->print_version();
|
||||
printf "\n%s\n", $self->{_attr}->{license};
|
||||
printf "\n%s\n\n", $self->{_attr}->{blurb};
|
||||
$self->print_usage();
|
||||
foreach (@{$self->{_args}}) {
|
||||
printf " %s\n", $_->{help};
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
sub print_usage {
|
||||
my $self = shift;
|
||||
printf $self->{_attr}->{usage}, $self->{_attr}->{plugin};
|
||||
print "\n";
|
||||
}
|
||||
|
||||
sub print_version {
|
||||
my $self = shift;
|
||||
printf "%s %s", $self->{_attr}->{plugin}, $self->{_attr}->{version};
|
||||
printf " [%s]", $self->{_attr}->{url} if $self->{_attr}->{url};
|
||||
print "\n";
|
||||
}
|
||||
|
||||
sub print_license {
|
||||
my $self = shift;
|
||||
printf "%s\n", $self->{_attr}->{license};
|
||||
print "\n";
|
||||
}
|
||||
|
||||
1;
|
|
@ -1,119 +0,0 @@
|
|||
component class has new with int
|
||||
|
||||
* plugins-scripts/Classes/BGP/Component/PeerSubsystem.pm
|
||||
plugins-scripts/Classes/CheckPoint/Firewall1/Component/CpuSubsystem.pm
|
||||
plugins-scripts/Classes/CheckPoint/Firewall1/Component/DiskSubsystem.pm
|
||||
plugins-scripts/Classes/CheckPoint/Firewall1/Component/EnvironmentalSubsystem.pm
|
||||
plugins-scripts/Classes/CheckPoint/Firewall1/Component/FanSubsystem.pm
|
||||
plugins-scripts/Classes/CheckPoint/Firewall1/Component/FwSubsystem.pm
|
||||
plugins-scripts/Classes/CheckPoint/Firewall1/Component/HaSubsystem.pm
|
||||
plugins-scripts/Classes/CheckPoint/Firewall1/Component/MemSubsystem.pm
|
||||
plugins-scripts/Classes/CheckPoint/Firewall1/Component/MngmtSubsystem.pm
|
||||
plugins-scripts/Classes/CheckPoint/Firewall1/Component/SvnSubsystem.pm
|
||||
plugins-scripts/Classes/CheckPoint/Firewall1/Component/TemperatureSubsystem.pm
|
||||
plugins-scripts/Classes/CheckPoint/Firewall1/Component/VoltageSubsystem.pm
|
||||
plugins-scripts/Classes/CheckPoint/Firewall1.pm
|
||||
plugins-scripts/Classes/CheckPoint.pm
|
||||
plugins-scripts/Classes/Cisco.pm
|
||||
plugins-scripts/Classes/CiscoAsyncOS/Component/CpuSubsystem.pm
|
||||
plugins-scripts/Classes/CiscoAsyncOS/Component/EnvironmentalSubsystem.pm
|
||||
plugins-scripts/Classes/CiscoAsyncOS/Component/FanSubsystem.pm
|
||||
plugins-scripts/Classes/CiscoAsyncOS/Component/KeySubsystem.pm
|
||||
plugins-scripts/Classes/CiscoAsyncOS/Component/MemSubsystem.pm
|
||||
plugins-scripts/Classes/CiscoAsyncOS/Component/RaidSubsystem.pm
|
||||
plugins-scripts/Classes/CiscoAsyncOS/Component/SupplySubsystem.pm
|
||||
plugins-scripts/Classes/CiscoAsyncOS/Component/TemperatureSubsystem.pm
|
||||
plugins-scripts/Classes/CiscoAsyncOS.pm
|
||||
plugins-scripts/Classes/CiscoIOS/Component/ConfigSubsystem.pm
|
||||
plugins-scripts/Classes/CiscoIOS/Component/ConnectionSubsystem.pm
|
||||
plugins-scripts/Classes/CiscoIOS/Component/CpuSubsystem.pm
|
||||
plugins-scripts/Classes/CiscoIOS/Component/EnvironmentalSubsystem.pm
|
||||
plugins-scripts/Classes/CiscoIOS/Component/FanSubsystem.pm
|
||||
plugins-scripts/Classes/CiscoIOS/Component/MemSubsystem.pm
|
||||
plugins-scripts/Classes/CiscoIOS/Component/SupplySubsystem.pm
|
||||
plugins-scripts/Classes/CiscoIOS/Component/TemperatureSubsystem.pm
|
||||
plugins-scripts/Classes/CiscoIOS/Component/VoltageSubsystem.pm
|
||||
plugins-scripts/Classes/CiscoIOS.pm
|
||||
plugins-scripts/Classes/CiscoNXOS/Component/CpuSubsystem.pm
|
||||
plugins-scripts/Classes/CiscoNXOS/Component/EnvironmentalSubsystem.pm
|
||||
plugins-scripts/Classes/CiscoNXOS/Component/MemSubsystem.pm
|
||||
plugins-scripts/Classes/CiscoNXOS/Component/SensorSubsystem.pm
|
||||
plugins-scripts/Classes/CiscoNXOS.pm
|
||||
plugins-scripts/Classes/CiscoWLC/Component/CpuSubsystem.pm
|
||||
plugins-scripts/Classes/CiscoWLC/Component/EnvironmentalSubsystem.pm
|
||||
plugins-scripts/Classes/CiscoWLC/Component/FanSubsystem.pm
|
||||
plugins-scripts/Classes/CiscoWLC/Component/MemSubsystem.pm
|
||||
plugins-scripts/Classes/CiscoWLC/Component/SupplySubsystem.pm
|
||||
plugins-scripts/Classes/CiscoWLC/Component/TemperatureSubsystem.pm
|
||||
plugins-scripts/Classes/CiscoWLC/Component/VoltageSubsystem.pm
|
||||
plugins-scripts/Classes/CiscoWLC/Component/WlanSubsystem.pm
|
||||
plugins-scripts/Classes/CiscoWLC.pm
|
||||
plugins-scripts/Classes/Device.pm
|
||||
plugins-scripts/Classes/F5/F5BIGIP/Component/CpuSubsystem.pm
|
||||
plugins-scripts/Classes/F5/F5BIGIP/Component/EnvironmentalSubsystem.pm
|
||||
plugins-scripts/Classes/F5/F5BIGIP/Component/FanSubsystem.pm
|
||||
plugins-scripts/Classes/F5/F5BIGIP/Component/LTM.pm
|
||||
plugins-scripts/Classes/F5/F5BIGIP/Component/MemSubsystem.pm
|
||||
plugins-scripts/Classes/F5/F5BIGIP/Component/PowersupplySubsystem.pm
|
||||
plugins-scripts/Classes/F5/F5BIGIP/Component/TemperatureSubsystem.pm
|
||||
plugins-scripts/Classes/F5/F5BIGIP.pm
|
||||
plugins-scripts/Classes/F5.pm
|
||||
*plugins-scripts/Classes/FabOS/Component/CpuSubsystem.pm
|
||||
*plugins-scripts/Classes/FabOS/Component/EnvironmentalSubsystem.pm
|
||||
plugins-scripts/Classes/FabOS/Component/MemSubsystem.pm
|
||||
*plugins-scripts/Classes/FabOS/Component/SensorSubsystem.pm
|
||||
plugins-scripts/Classes/FabOS.pm
|
||||
plugins-scripts/Classes/FCEOS/Components/EnvironmentalSubsystem.pm
|
||||
plugins-scripts/Classes/FCEOS/Components/FruSubsystem.pm
|
||||
plugins-scripts/Classes/FCEOS.pm
|
||||
plugins-scripts/Classes/FCMGMT/Component/EnvironmentalSubsystem.pm
|
||||
plugins-scripts/Classes/FCMGMT/Component/SensorSubsystem.pm
|
||||
plugins-scripts/Classes/FCMGMT.pm
|
||||
plugins-scripts/Classes/Fortigate/Component/CpuSubsystem.pm
|
||||
plugins-scripts/Classes/Fortigate/Component/DiskSubsystem.pm
|
||||
plugins-scripts/Classes/Fortigate/Component/EnvironmentalSubsystem.pm
|
||||
plugins-scripts/Classes/Fortigate/Component/MemSubsystem.pm
|
||||
plugins-scripts/Classes/Fortigate/Component/SensorSubsystem.pm
|
||||
plugins-scripts/Classes/Fortigate.pm
|
||||
plugins-scripts/Classes/Foundry/Component/CpuSubsystem.pm
|
||||
plugins-scripts/Classes/Foundry/Component/EnvironmentalSubsystem.pm
|
||||
plugins-scripts/Classes/Foundry/Component/FanSubsystem.pm
|
||||
plugins-scripts/Classes/Foundry/Component/MemSubsystem.pm
|
||||
plugins-scripts/Classes/Foundry/Component/PowersupplySubsystem.pm
|
||||
plugins-scripts/Classes/Foundry/Component/SLBSubsystem.pm
|
||||
plugins-scripts/Classes/Foundry/Component/TemperatureSubsystem.pm
|
||||
plugins-scripts/Classes/Foundry.pm
|
||||
plugins-scripts/Classes/HOSTRESOURCESMIB/Component/CpuSubsystem.pm
|
||||
plugins-scripts/Classes/HOSTRESOURCESMIB/Component/DiskSubsystem.pm
|
||||
plugins-scripts/Classes/HOSTRESOURCESMIB/Component/EnvironmentalSubsystem.pm
|
||||
plugins-scripts/Classes/HOSTRESOURCESMIB/Component/MemSubsystem.pm
|
||||
plugins-scripts/Classes/HOSTRESOURCESMIB.pm
|
||||
plugins-scripts/Classes/HP/Procurve/Component/CpuSubsystem.pm
|
||||
plugins-scripts/Classes/HP/Procurve/Component/EnvironmentalSubsystem.pm
|
||||
plugins-scripts/Classes/HP/Procurve/Component/MemSubsystem.pm
|
||||
plugins-scripts/Classes/HP/Procurve/Component/SensorSubsystem.pm
|
||||
plugins-scripts/Classes/HP/Procurve.pm
|
||||
plugins-scripts/Classes/HP.pm
|
||||
*plugins-scripts/Classes/HSRP/Component/HSRPSubsystem.pm
|
||||
plugins-scripts/Classes/HSRP.pm
|
||||
plugins-scripts/Classes/IFMIB/Component/InterfaceSubsystem.pm
|
||||
plugins-scripts/Classes/IFMIB/Component/LinkAggregation.pm
|
||||
plugins-scripts/Classes/IFMIB.pm
|
||||
plugins-scripts/Classes/Juniper/IVE/Component/CpuSubsystem.pm
|
||||
plugins-scripts/Classes/Juniper/IVE/Component/DiskSubsystem.pm
|
||||
plugins-scripts/Classes/Juniper/IVE/Component/EnvironmentalSubsystem.pm
|
||||
plugins-scripts/Classes/Juniper/IVE/Component/MemSubsystem.pm
|
||||
plugins-scripts/Classes/Juniper/IVE/Component/UserSubsystem.pm
|
||||
plugins-scripts/Classes/Juniper/IVE.pm
|
||||
plugins-scripts/Classes/Juniper/NetScreen/Component/CpuSubsystem.pm
|
||||
plugins-scripts/Classes/Juniper/NetScreen/Component/MemSubsystem.pm
|
||||
plugins-scripts/Classes/Juniper/NetScreen.pm
|
||||
plugins-scripts/Classes/Juniper.pm
|
||||
plugins-scripts/Classes/MEOS.pm
|
||||
plugins-scripts/Classes/MIBII.pm
|
||||
plugins-scripts/Classes/MibsAndOids.pm
|
||||
plugins-scripts/Classes/Nortel.pm
|
||||
plugins-scripts/Classes/SecureOS.pm
|
||||
plugins-scripts/Classes/UCDMIB/Components/CpuSubsystem.pm
|
||||
plugins-scripts/Classes/UCDMIB/Components/MemSubsystem.pm
|
||||
plugins-scripts/Classes/UCDMIB.pm
|
|
@ -2,6 +2,12 @@
|
|||
# Changelog of the check_nwc_health plugin #
|
||||
############################################
|
||||
|
||||
2014-08-26 3.0.3.7
|
||||
- bugfix in glpluginsnmp (undef errors with loadbalacer index)
|
||||
|
||||
2014-08-25 3.0.3.6
|
||||
- bugfix in glpluginsnmp / (fritzbox cpu undef-error)
|
||||
|
||||
2014-08-22 3.0.3.5
|
||||
- bugfix in glplugin/uptime because of buggy snmpengineuptime
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#! /bin/sh
|
||||
# From configure.ac .
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.69 for check_nwc_health 3.0.3.3.
|
||||
# Generated by GNU Autoconf 2.69 for check_nwc_health 3.0.3.7.
|
||||
#
|
||||
#
|
||||
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
|
||||
|
@ -577,8 +577,8 @@ MAKEFLAGS=
|
|||
# Identity of this package.
|
||||
PACKAGE_NAME='check_nwc_health'
|
||||
PACKAGE_TARNAME='check_nwc_health'
|
||||
PACKAGE_VERSION='3.0.3.3'
|
||||
PACKAGE_STRING='check_nwc_health 3.0.3.3'
|
||||
PACKAGE_VERSION='3.0.3.7'
|
||||
PACKAGE_STRING='check_nwc_health 3.0.3.7'
|
||||
PACKAGE_BUGREPORT=''
|
||||
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.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures check_nwc_health 3.0.3.3 to adapt to many kinds of systems.
|
||||
\`configure' configures check_nwc_health 3.0.3.7 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
|
@ -1299,7 +1299,7 @@ fi
|
|||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of check_nwc_health 3.0.3.3:";;
|
||||
short | recursive ) echo "Configuration of check_nwc_health 3.0.3.7:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
|
@ -1385,7 +1385,7 @@ fi
|
|||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
check_nwc_health configure 3.0.3.3
|
||||
check_nwc_health configure 3.0.3.7
|
||||
generated by GNU Autoconf 2.69
|
||||
|
||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
|
@ -1402,7 +1402,7 @@ cat >config.log <<_ACEOF
|
|||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by check_nwc_health $as_me 3.0.3.3, which was
|
||||
It was created by check_nwc_health $as_me 3.0.3.7, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
|
@ -2265,7 +2265,7 @@ fi
|
|||
|
||||
# Define the identity of the package.
|
||||
PACKAGE='check_nwc_health'
|
||||
VERSION='3.0.3.3'
|
||||
VERSION='3.0.3.7'
|
||||
|
||||
|
||||
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
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by check_nwc_health $as_me 3.0.3.3, which was
|
||||
This file was extended by check_nwc_health $as_me 3.0.3.7, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
|
@ -3404,7 +3404,7 @@ _ACEOF
|
|||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||
ac_cs_version="\\
|
||||
check_nwc_health config.status 3.0.3.3
|
||||
check_nwc_health config.status 3.0.3.7
|
||||
configured by $0, generated by GNU Autoconf 2.69,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
|
@ -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,3.0.3.5)
|
||||
AC_INIT(check_nwc_health,3.0.3.7)
|
||||
AM_INIT_AUTOMAKE([1.9 tar-pax])
|
||||
AC_CANONICAL_HOST
|
||||
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue