enh(cisco/standard/snmp): add fcs-errors + minor environment enhancement (#2883)
This commit is contained in:
parent
ed5c34ebc4
commit
bc5af3af46
|
@ -40,7 +40,6 @@ my %map_fan_state2 = (
|
||||||
|
|
||||||
my $oid_ciscoEnvMonFanStatusEntry = '.1.3.6.1.4.1.9.9.13.1.4.1'; # CISCO-ENVMON-MIB
|
my $oid_ciscoEnvMonFanStatusEntry = '.1.3.6.1.4.1.9.9.13.1.4.1'; # CISCO-ENVMON-MIB
|
||||||
my $oid_cefcFanTrayOperStatus = '.1.3.6.1.4.1.9.9.117.1.4.1.1.1'; # CISCO-ENTITY-SENSOR-MIB
|
my $oid_cefcFanTrayOperStatus = '.1.3.6.1.4.1.9.9.117.1.4.1.1.1'; # CISCO-ENTITY-SENSOR-MIB
|
||||||
my $oid_entPhysicalDescr = '.1.3.6.1.2.1.47.1.1.1.1.2';
|
|
||||||
|
|
||||||
sub load {
|
sub load {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
@ -77,9 +76,13 @@ sub check_fan_envmon {
|
||||||
);
|
);
|
||||||
my $exit = $self->get_severity(section => 'fan', instance => $instance, value => $result->{ciscoEnvMonFanState});
|
my $exit = $self->get_severity(section => 'fan', instance => $instance, value => $result->{ciscoEnvMonFanState});
|
||||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(
|
||||||
short_msg => sprintf("fan '%s' status is %s",
|
severity => $exit,
|
||||||
$result->{ciscoEnvMonFanStatusDescr}, $result->{ciscoEnvMonFanState}));
|
short_msg => sprintf(
|
||||||
|
"fan '%s' status is %s",
|
||||||
|
$result->{ciscoEnvMonFanStatusDescr}, $result->{ciscoEnvMonFanState}
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,13 +91,13 @@ sub check_fan_entity {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
my $mapping = {
|
my $mapping = {
|
||||||
cefcFanTrayOperStatus => { oid => '.1.3.6.1.4.1.9.9.117.1.4.1.1.1', map => \%map_fan_state2 },
|
cefcFanTrayOperStatus => { oid => '.1.3.6.1.4.1.9.9.117.1.4.1.1.1', map => \%map_fan_state2 }
|
||||||
};
|
};
|
||||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cefcFanTrayOperStatus}})) {
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cefcFanTrayOperStatus}})) {
|
||||||
$oid =~ /\.([0-9]+)$/;
|
$oid =~ /\.([0-9]+)$/;
|
||||||
my $instance = $1;
|
my $instance = $1;
|
||||||
|
|
||||||
my $fan_descr = $self->{results}->{$oid_entPhysicalDescr}->{$oid_entPhysicalDescr . '.' . $instance};
|
my $fan_descr = $self->{results}->{ $self->{physical_name} }->{ $self->{physical_name} . '.' . $instance };
|
||||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cefcFanTrayOperStatus}, instance => $instance);
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cefcFanTrayOperStatus}, instance => $instance);
|
||||||
|
|
||||||
next if ($self->check_filter(section => 'fan', instance => $instance, name => $fan_descr));
|
next if ($self->check_filter(section => 'fan', instance => $instance, name => $fan_descr));
|
||||||
|
@ -102,14 +105,16 @@ sub check_fan_entity {
|
||||||
$self->{components}->{fan}->{total}++;
|
$self->{components}->{fan}->{total}++;
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
"Fan '%s' status is %s [instance: %s]",
|
"fan '%s' status is %s [instance: %s]",
|
||||||
$fan_descr, $result->{cefcFanTrayOperStatus}, $instance
|
$fan_descr, $result->{cefcFanTrayOperStatus}, $instance
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
my $exit = $self->get_severity(section => 'fan', instance => $instance, value => $result->{cefcFanTrayOperStatus});
|
my $exit = $self->get_severity(section => 'fan', instance => $instance, value => $result->{cefcFanTrayOperStatus});
|
||||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(
|
||||||
short_msg => sprintf("Fan '%s/%s' status is %s", $fan_descr, $instance, $result->{cefcFanTrayOperStatus}));
|
severity => $exit,
|
||||||
|
short_msg => sprintf("Fan '%s/%s' status is %s", $fan_descr, $instance, $result->{cefcFanTrayOperStatus})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,7 +123,7 @@ sub check {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => "Checking fans");
|
$self->{output}->output_add(long_msg => "Checking fans");
|
||||||
$self->{components}->{fan} = {name => 'fans', total => 0, skip => 0};
|
$self->{components}->{fan} = { name => 'fans', total => 0, skip => 0 };
|
||||||
return if ($self->check_filter(section => 'fan'));
|
return if ($self->check_filter(section => 'fan'));
|
||||||
|
|
||||||
check_fan_envmon($self);
|
check_fan_envmon($self);
|
||||||
|
|
|
@ -50,15 +50,14 @@ my %map_module_state = (
|
||||||
24 => 'mdr',
|
24 => 'mdr',
|
||||||
25 => 'fwMismatchFound',
|
25 => 'fwMismatchFound',
|
||||||
26 => 'fwDownloadSuccess',
|
26 => 'fwDownloadSuccess',
|
||||||
27 => 'fwDownloadFailure',
|
27 => 'fwDownloadFailure'
|
||||||
);
|
);
|
||||||
|
|
||||||
# In MIB 'CISCO-ENTITY-FRU-CONTROL-MIB'
|
# In MIB 'CISCO-ENTITY-FRU-CONTROL-MIB'
|
||||||
my $mapping = {
|
my $mapping = {
|
||||||
cefcModuleOperStatus => { oid => '.1.3.6.1.4.1.9.9.117.1.2.1.1.2', map => \%map_module_state },
|
cefcModuleOperStatus => { oid => '.1.3.6.1.4.1.9.9.117.1.2.1.1.2', map => \%map_module_state }
|
||||||
};
|
};
|
||||||
my $oid_cefcModuleOperStatus = '.1.3.6.1.4.1.9.9.117.1.2.1.1.2';
|
my $oid_cefcModuleOperStatus = '.1.3.6.1.4.1.9.9.117.1.2.1.1.2';
|
||||||
my $oid_entPhysicalDescr = '.1.3.6.1.2.1.47.1.1.1.1.2';
|
|
||||||
|
|
||||||
sub load {
|
sub load {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
@ -77,18 +76,26 @@ sub check {
|
||||||
$oid =~ /\.([0-9]+)$/;
|
$oid =~ /\.([0-9]+)$/;
|
||||||
my $instance = $1;
|
my $instance = $1;
|
||||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cefcModuleOperStatus}, instance => $instance);
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cefcModuleOperStatus}, instance => $instance);
|
||||||
my $module_descr = $self->{results}->{$oid_entPhysicalDescr}->{$oid_entPhysicalDescr . '.' . $instance};
|
my $module_descr = $self->{results}->{$self->{physical_name} }->{ $self->{physical_name} . '.' . $instance };
|
||||||
|
|
||||||
next if ($self->check_filter(section => 'module', instance => $instance, name => $module_descr));
|
next if ($self->check_filter(section => 'module', instance => $instance, name => $module_descr));
|
||||||
|
|
||||||
$self->{components}->{module}->{total}++;
|
$self->{components}->{module}->{total}++;
|
||||||
$self->{output}->output_add(long_msg => sprintf("Module '%s' status is %s [instance: %s]",
|
$self->{output}->output_add(
|
||||||
$module_descr, $result->{cefcModuleOperStatus}, $instance));
|
long_msg => sprintf(
|
||||||
|
"module '%s' status is %s [instance: %s]",
|
||||||
|
$module_descr, $result->{cefcModuleOperStatus}, $instance
|
||||||
|
)
|
||||||
|
);
|
||||||
my $exit = $self->get_severity(section => 'module', instance => $instance, value => $result->{cefcModuleOperStatus});
|
my $exit = $self->get_severity(section => 'module', instance => $instance, value => $result->{cefcModuleOperStatus});
|
||||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(
|
||||||
short_msg => sprintf("Module '%s/%s' status is %s", $module_descr,
|
severity => $exit,
|
||||||
$instance, $result->{cefcModuleOperStatus}));
|
short_msg => sprintf(
|
||||||
|
"Module '%s/%s' status is %s",
|
||||||
|
$module_descr, $instance, $result->{cefcModuleOperStatus}
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,10 +32,9 @@ my %map_physical_state = (
|
||||||
|
|
||||||
# In MIB 'CISCO-ENTITY-SENSOR-MIB'
|
# In MIB 'CISCO-ENTITY-SENSOR-MIB'
|
||||||
my $mapping = {
|
my $mapping = {
|
||||||
cefcPhysicalStatus => { oid => '.1.3.6.1.4.1.9.9.117.1.5.1.1.1', map => \%map_physical_state },
|
cefcPhysicalStatus => { oid => '.1.3.6.1.4.1.9.9.117.1.5.1.1.1', map => \%map_physical_state }
|
||||||
};
|
};
|
||||||
my $oid_cefcPhysicalStatus = '.1.3.6.1.4.1.9.9.117.1.5.1.1.1';
|
my $oid_cefcPhysicalStatus = '.1.3.6.1.4.1.9.9.117.1.5.1.1.1';
|
||||||
my $oid_entPhysicalDescr = '.1.3.6.1.2.1.47.1.1.1.1.2';
|
|
||||||
|
|
||||||
sub load {
|
sub load {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
@ -54,7 +53,7 @@ sub check {
|
||||||
$oid =~ /\.([0-9]+)$/;
|
$oid =~ /\.([0-9]+)$/;
|
||||||
my $instance = $1;
|
my $instance = $1;
|
||||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cefcPhysicalStatus}, instance => $instance);
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cefcPhysicalStatus}, instance => $instance);
|
||||||
my $physical_descr = $self->{results}->{$oid_entPhysicalDescr}->{$oid_entPhysicalDescr . '.' . $instance};
|
my $physical_descr = $self->{results}->{ $self->{physical_name} }->{ $self->{physical_name} . '.' . $instance};
|
||||||
|
|
||||||
if (!defined($physical_descr)) {
|
if (!defined($physical_descr)) {
|
||||||
$self->{output}->output_add(long_msg => sprintf("skipped instance '%s': no description", $instance));
|
$self->{output}->output_add(long_msg => sprintf("skipped instance '%s': no description", $instance));
|
||||||
|
@ -64,13 +63,21 @@ sub check {
|
||||||
next if ($self->check_filter(section => 'physical', instance => $instance, name => $physical_descr));
|
next if ($self->check_filter(section => 'physical', instance => $instance, name => $physical_descr));
|
||||||
|
|
||||||
$self->{components}->{physical}->{total}++;
|
$self->{components}->{physical}->{total}++;
|
||||||
$self->{output}->output_add(long_msg => sprintf("Physical '%s' status is %s [instance: %s]",
|
$self->{output}->output_add(
|
||||||
$physical_descr, $result->{cefcPhysicalStatus}, $instance));
|
long_msg => sprintf(
|
||||||
|
"physical '%s' status is %s [instance: %s]",
|
||||||
|
$physical_descr, $result->{cefcPhysicalStatus}, $instance
|
||||||
|
)
|
||||||
|
);
|
||||||
my $exit = $self->get_severity(section => 'physical', instance => $instance, value => $result->{cefcPhysicalStatus});
|
my $exit = $self->get_severity(section => 'physical', instance => $instance, value => $result->{cefcPhysicalStatus});
|
||||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(
|
||||||
short_msg => sprintf("Physical '%s/%s' status is %s", $physical_descr,
|
severity => $exit,
|
||||||
$instance, $result->{cefcPhysicalStatus}));
|
short_msg => sprintf(
|
||||||
|
"Physical '%s/%s' status is %s",
|
||||||
|
$physical_descr, $instance, $result->{cefcPhysicalStatus}
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ my %map_psu_state1 = (
|
||||||
3 => 'critical',
|
3 => 'critical',
|
||||||
4 => 'shutdown',
|
4 => 'shutdown',
|
||||||
5 => 'not present',
|
5 => 'not present',
|
||||||
6 => 'not functioning',
|
6 => 'not functioning'
|
||||||
);
|
);
|
||||||
my %map_psu_state2 = (
|
my %map_psu_state2 = (
|
||||||
1 => 'offEnvOther',
|
1 => 'offEnvOther',
|
||||||
|
@ -50,12 +50,11 @@ my %map_psu_state2 = (
|
||||||
9 => 'onButFanFail',
|
9 => 'onButFanFail',
|
||||||
10 => 'offCooling',
|
10 => 'offCooling',
|
||||||
11 => 'offConnectorRating',
|
11 => 'offConnectorRating',
|
||||||
12 => 'onButInlinePowerFail',
|
12 => 'onButInlinePowerFail'
|
||||||
);
|
);
|
||||||
|
|
||||||
my $oid_ciscoEnvMonSupplyStatusEntry = '.1.3.6.1.4.1.9.9.13.1.5.1'; # CISCO-ENVMON-MIB
|
my $oid_ciscoEnvMonSupplyStatusEntry = '.1.3.6.1.4.1.9.9.13.1.5.1'; # CISCO-ENVMON-MIB
|
||||||
my $oid_cefcFRUPowerOperStatus = '.1.3.6.1.4.1.9.9.117.1.1.2.1.2'; # CISCO-ENTITY-SENSOR-MIB
|
my $oid_cefcFRUPowerOperStatus = '.1.3.6.1.4.1.9.9.117.1.1.2.1.2'; # CISCO-ENTITY-SENSOR-MIB
|
||||||
my $oid_entPhysicalDescr = '.1.3.6.1.2.1.47.1.1.1.1.2';
|
|
||||||
|
|
||||||
sub load {
|
sub load {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
@ -69,7 +68,7 @@ sub check_psu_envmon {
|
||||||
my $mapping = {
|
my $mapping = {
|
||||||
ciscoEnvMonSupplyStatusDescr => { oid => '.1.3.6.1.4.1.9.9.13.1.5.1.2' },
|
ciscoEnvMonSupplyStatusDescr => { oid => '.1.3.6.1.4.1.9.9.13.1.5.1.2' },
|
||||||
ciscoEnvMonSupplyState => { oid => '.1.3.6.1.4.1.9.9.13.1.5.1.3', map => \%map_psu_state1 },
|
ciscoEnvMonSupplyState => { oid => '.1.3.6.1.4.1.9.9.13.1.5.1.3', map => \%map_psu_state1 },
|
||||||
ciscoEnvMonSupplySource => { oid => '.1.3.6.1.4.1.9.9.13.1.5.1.4', map => \%map_psu_source },
|
ciscoEnvMonSupplySource => { oid => '.1.3.6.1.4.1.9.9.13.1.5.1.4', map => \%map_psu_source }
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_ciscoEnvMonSupplyStatusEntry}})) {
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_ciscoEnvMonSupplyStatusEntry}})) {
|
||||||
|
@ -84,15 +83,22 @@ sub check_psu_envmon {
|
||||||
$self->absent_problem(section => 'psu', instance => $instance, name => $result->{ciscoEnvMonSupplyStatusDescr}));
|
$self->absent_problem(section => 'psu', instance => $instance, name => $result->{ciscoEnvMonSupplyStatusDescr}));
|
||||||
$self->{components}->{psu}->{total}++;
|
$self->{components}->{psu}->{total}++;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => sprintf("Power supply '%s' status is %s [instance: %s] [source: %s]",
|
$self->{output}->output_add(
|
||||||
$result->{ciscoEnvMonSupplyStatusDescr}, $result->{ciscoEnvMonSupplyState},
|
long_msg => sprintf(
|
||||||
$instance, $result->{ciscoEnvMonSupplySource}
|
"power supply '%s' status is %s [instance: %s] [source: %s]",
|
||||||
));
|
$result->{ciscoEnvMonSupplyStatusDescr}, $result->{ciscoEnvMonSupplyState},
|
||||||
|
$instance, $result->{ciscoEnvMonSupplySource}
|
||||||
|
)
|
||||||
|
);
|
||||||
my $exit = $self->get_severity(section => 'psu', instance => $instance, value => $result->{ciscoEnvMonSupplyState});
|
my $exit = $self->get_severity(section => 'psu', instance => $instance, value => $result->{ciscoEnvMonSupplyState});
|
||||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(
|
||||||
short_msg => sprintf("Power supply '%s' status is %s",
|
severity => $exit,
|
||||||
$result->{ciscoEnvMonSupplyStatusDescr}, $result->{ciscoEnvMonSupplyState}));
|
short_msg => sprintf(
|
||||||
|
"Power supply '%s' status is %s",
|
||||||
|
$result->{ciscoEnvMonSupplyStatusDescr}, $result->{ciscoEnvMonSupplyState}
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,24 +107,33 @@ sub check_psu_entity {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
my $mapping = {
|
my $mapping = {
|
||||||
cefcFRUPowerOperStatus => { oid => '.1.3.6.1.4.1.9.9.117.1.1.2.1.2', map => \%map_psu_state2 },
|
cefcFRUPowerOperStatus => { oid => '.1.3.6.1.4.1.9.9.117.1.1.2.1.2', map => \%map_psu_state2 }
|
||||||
};
|
};
|
||||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cefcFRUPowerOperStatus}})) {
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cefcFRUPowerOperStatus}})) {
|
||||||
$oid =~ /\.([0-9]+)$/;
|
$oid =~ /\.([0-9]+)$/;
|
||||||
my $instance = $1;
|
my $instance = $1;
|
||||||
|
|
||||||
my $psu_descr = $self->{results}->{$oid_entPhysicalDescr}->{$oid_entPhysicalDescr . '.' . $instance};
|
my $psu_descr = $self->{results}->{ $self->{physical_name} }->{ $self->{physical_name} . '.' . $instance };
|
||||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cefcFRUPowerOperStatus}, instance => $instance);
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cefcFRUPowerOperStatus}, instance => $instance);
|
||||||
|
|
||||||
next if ($self->check_filter(section => 'psu', instance => $instance, name => $psu_descr));
|
next if ($self->check_filter(section => 'psu', instance => $instance, name => $psu_descr));
|
||||||
|
|
||||||
$self->{components}->{psu}->{total}++;
|
$self->{components}->{psu}->{total}++;
|
||||||
$self->{output}->output_add(long_msg => sprintf("Power supply '%s' status is %s [instance: %s]",
|
$self->{output}->output_add(
|
||||||
$psu_descr, $result->{cefcFRUPowerOperStatus}, $instance));
|
long_msg => sprintf(
|
||||||
|
"Power supply '%s' status is %s [instance: %s]",
|
||||||
|
$psu_descr, $result->{cefcFRUPowerOperStatus}, $instance
|
||||||
|
)
|
||||||
|
);
|
||||||
my $exit = $self->get_severity(section => 'psu', instance => $instance, value => $result->{cefcFRUPowerOperStatus});
|
my $exit = $self->get_severity(section => 'psu', instance => $instance, value => $result->{cefcFRUPowerOperStatus});
|
||||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(
|
||||||
short_msg => sprintf("Power supply '%s/%s' status is %s", $psu_descr, $instance, $result->{cefcFRUPowerOperStatus}));
|
severity => $exit,
|
||||||
|
short_msg => sprintf(
|
||||||
|
"Power supply '%s/%s' status is %s",
|
||||||
|
$psu_descr, $instance, $result->{cefcFRUPowerOperStatus}
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,7 +142,7 @@ sub check {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => "Checking power supplies");
|
$self->{output}->output_add(long_msg => "Checking power supplies");
|
||||||
$self->{components}->{psu} = {name => 'psus', total => 0, skip => 0};
|
$self->{components}->{psu} = { name => 'psus', total => 0, skip => 0 };
|
||||||
return if ($self->check_filter(section => 'psu'));
|
return if ($self->check_filter(section => 'psu'));
|
||||||
|
|
||||||
check_psu_envmon($self);
|
check_psu_envmon($self);
|
||||||
|
|
|
@ -43,7 +43,7 @@ my %map_sensor_type = (
|
||||||
11 => 'cmm',
|
11 => 'cmm',
|
||||||
12 => 'truthvalue',
|
12 => 'truthvalue',
|
||||||
13 => 'specialEnum',
|
13 => 'specialEnum',
|
||||||
14 => 'dBm',
|
14 => 'dBm'
|
||||||
);
|
);
|
||||||
my %map_scale = (
|
my %map_scale = (
|
||||||
1 => -24, # yocto,
|
1 => -24, # yocto,
|
||||||
|
@ -62,13 +62,13 @@ my %map_scale = (
|
||||||
14 => 18, #exa
|
14 => 18, #exa
|
||||||
15 => 15, #peta
|
15 => 15, #peta
|
||||||
16 => 21, #zetta
|
16 => 21, #zetta
|
||||||
17 => 24, #yotta
|
17 => 24 #yotta
|
||||||
);
|
);
|
||||||
my %map_severity = (
|
my %map_severity = (
|
||||||
1 => 'other',
|
1 => 'other',
|
||||||
10 => 'minor',
|
10 => 'minor',
|
||||||
20 => 'major',
|
20 => 'major',
|
||||||
30 => 'critical',
|
30 => 'critical'
|
||||||
);
|
);
|
||||||
my %map_relation = (
|
my %map_relation = (
|
||||||
1 => 'lessThan',
|
1 => 'lessThan',
|
||||||
|
@ -76,7 +76,7 @@ my %map_relation = (
|
||||||
3 => 'greaterThan',
|
3 => 'greaterThan',
|
||||||
4 => 'greaterOrEqual',
|
4 => 'greaterOrEqual',
|
||||||
5 => 'equalTo',
|
5 => 'equalTo',
|
||||||
6 => 'notEqualTo',
|
6 => 'notEqualTo'
|
||||||
);
|
);
|
||||||
my %perfdata_unit = (
|
my %perfdata_unit = (
|
||||||
'other' => '',
|
'other' => '',
|
||||||
|
@ -92,7 +92,7 @@ my %perfdata_unit = (
|
||||||
'cmm' => '',
|
'cmm' => '',
|
||||||
'truthvalue' => '',
|
'truthvalue' => '',
|
||||||
'specialEnum' => '',
|
'specialEnum' => '',
|
||||||
'dBm' => 'dBm',
|
'dBm' => 'dBm'
|
||||||
);
|
);
|
||||||
|
|
||||||
# In MIB 'CISCO-ENTITY-SENSOR-MIB'
|
# In MIB 'CISCO-ENTITY-SENSOR-MIB'
|
||||||
|
@ -102,16 +102,15 @@ my $mapping = {
|
||||||
entSensorPrecision => { oid => '.1.3.6.1.4.1.9.9.91.1.1.1.1.3' },
|
entSensorPrecision => { oid => '.1.3.6.1.4.1.9.9.91.1.1.1.1.3' },
|
||||||
entSensorValue => { oid => '.1.3.6.1.4.1.9.9.91.1.1.1.1.4' },
|
entSensorValue => { oid => '.1.3.6.1.4.1.9.9.91.1.1.1.1.4' },
|
||||||
entSensorStatus => { oid => '.1.3.6.1.4.1.9.9.91.1.1.1.1.5', map => \%map_sensor_status },
|
entSensorStatus => { oid => '.1.3.6.1.4.1.9.9.91.1.1.1.1.5', map => \%map_sensor_status },
|
||||||
entSensorValueUpdateRate => { oid => '.1.3.6.1.4.1.9.9.91.1.1.1.1.7' }, # 0 means no threshold check
|
entSensorValueUpdateRate => { oid => '.1.3.6.1.4.1.9.9.91.1.1.1.1.7' } # 0 means no threshold check
|
||||||
};
|
};
|
||||||
my $mapping2 = {
|
my $mapping2 = {
|
||||||
entSensorThresholdSeverity => { oid => '.1.3.6.1.4.1.9.9.91.1.2.1.1.2', map => \%map_severity },
|
entSensorThresholdSeverity => { oid => '.1.3.6.1.4.1.9.9.91.1.2.1.1.2', map => \%map_severity },
|
||||||
entSensorThresholdRelation => { oid => '.1.3.6.1.4.1.9.9.91.1.2.1.1.3', map => \%map_relation },
|
entSensorThresholdRelation => { oid => '.1.3.6.1.4.1.9.9.91.1.2.1.1.3', map => \%map_relation },
|
||||||
entSensorThresholdValue => { oid => '.1.3.6.1.4.1.9.9.91.1.2.1.1.4' },
|
entSensorThresholdValue => { oid => '.1.3.6.1.4.1.9.9.91.1.2.1.1.4' }
|
||||||
};
|
};
|
||||||
my $oid_entSensorValueEntry = '.1.3.6.1.4.1.9.9.91.1.1.1.1';
|
my $oid_entSensorValueEntry = '.1.3.6.1.4.1.9.9.91.1.1.1.1';
|
||||||
my $oid_entSensorThresholdEntry = '.1.3.6.1.4.1.9.9.91.1.2.1.1';
|
my $oid_entSensorThresholdEntry = '.1.3.6.1.4.1.9.9.91.1.2.1.1';
|
||||||
my $oid_entPhysicalDescr = '.1.3.6.1.2.1.47.1.1.1.1.2';
|
|
||||||
|
|
||||||
sub load {
|
sub load {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
@ -201,10 +200,10 @@ sub check {
|
||||||
my $instance = $1;
|
my $instance = $1;
|
||||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_entSensorValueEntry}, instance => $instance);
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_entSensorValueEntry}, instance => $instance);
|
||||||
|
|
||||||
next if (!defined($self->{results}->{$oid_entPhysicalDescr}->{$oid_entPhysicalDescr . '.' . $instance}));
|
next if (!defined($self->{results}->{ $self->{physical_name} }->{ $self->{physical_name} . '.' . $instance }));
|
||||||
my $sensor_descr = $self->{results}->{$oid_entPhysicalDescr}->{$oid_entPhysicalDescr . '.' . $instance};
|
my $sensor_descr = $self->{results}->{ $self->{physical_name} }->{ $self->{physical_name} . '.' . $instance };
|
||||||
|
|
||||||
next if ($self->check_filter(section => 'sensor', instance => $result->{entSensorType} . '.' . $instance));
|
next if ($self->check_filter(section => 'sensor', instance => $result->{entSensorType} . '.' . $instance, name => $sensor_descr));
|
||||||
$self->{components}->{sensor}->{total}++;
|
$self->{components}->{sensor}->{total}++;
|
||||||
|
|
||||||
$result->{entSensorValue} = defined($result->{entSensorValue}) ?
|
$result->{entSensorValue} = defined($result->{entSensorValue}) ?
|
||||||
|
@ -212,7 +211,7 @@ sub check {
|
||||||
|
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
"Sensor '%s' status is '%s' [instance: %s] [value: %s %s]",
|
"sensor '%s' status is '%s' [instance: %s] [value: %s %s]",
|
||||||
$sensor_descr, $result->{entSensorStatus},
|
$sensor_descr, $result->{entSensorStatus},
|
||||||
$instance,
|
$instance,
|
||||||
defined($result->{entSensorValue}) ? $result->{entSensorValue} : '-',
|
defined($result->{entSensorValue}) ? $result->{entSensorValue} : '-',
|
||||||
|
@ -233,7 +232,12 @@ sub check {
|
||||||
next if (!defined($result->{entSensorValue}) || $result->{entSensorValue} !~ /[0-9]/);
|
next if (!defined($result->{entSensorValue}) || $result->{entSensorValue} !~ /[0-9]/);
|
||||||
|
|
||||||
my $component = 'sensor.' . $result->{entSensorType};
|
my $component = 'sensor.' . $result->{entSensorType};
|
||||||
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => $component, instance => $instance, value => $result->{entSensorValue});
|
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(
|
||||||
|
section => $component,
|
||||||
|
instance => $instance,
|
||||||
|
name => $sensor_descr,
|
||||||
|
value => $result->{entSensorValue}
|
||||||
|
);
|
||||||
if ($checked == 0) {
|
if ($checked == 0) {
|
||||||
my $warn_th = get_default_warning_threshold($self, instance => $instance, result => $result);
|
my $warn_th = get_default_warning_threshold($self, instance => $instance, result => $result);
|
||||||
my $crit_th = get_default_critical_threshold($self, instance => $instance, result => $result);
|
my $crit_th = get_default_critical_threshold($self, instance => $instance, result => $result);
|
||||||
|
|
|
@ -29,7 +29,7 @@ my %map_temperature_state = (
|
||||||
3 => 'critical',
|
3 => 'critical',
|
||||||
4 => 'shutdown',
|
4 => 'shutdown',
|
||||||
5 => 'not present',
|
5 => 'not present',
|
||||||
6 => 'not functioning',
|
6 => 'not functioning'
|
||||||
);
|
);
|
||||||
|
|
||||||
# In MIB 'CISCO-ENVMON-MIB'
|
# In MIB 'CISCO-ENVMON-MIB'
|
||||||
|
@ -37,7 +37,7 @@ my $mapping = {
|
||||||
ciscoEnvMonTemperatureStatusDescr => { oid => '.1.3.6.1.4.1.9.9.13.1.3.1.2' },
|
ciscoEnvMonTemperatureStatusDescr => { oid => '.1.3.6.1.4.1.9.9.13.1.3.1.2' },
|
||||||
ciscoEnvMonTemperatureStatusValue => { oid => '.1.3.6.1.4.1.9.9.13.1.3.1.3' },
|
ciscoEnvMonTemperatureStatusValue => { oid => '.1.3.6.1.4.1.9.9.13.1.3.1.3' },
|
||||||
ciscoEnvMonTemperatureThreshold => { oid => '.1.3.6.1.4.1.9.9.13.1.3.1.4' },
|
ciscoEnvMonTemperatureThreshold => { oid => '.1.3.6.1.4.1.9.9.13.1.3.1.4' },
|
||||||
ciscoEnvMonTemperatureState => { oid => '.1.3.6.1.4.1.9.9.13.1.3.1.6', map => \%map_temperature_state },
|
ciscoEnvMonTemperatureState => { oid => '.1.3.6.1.4.1.9.9.13.1.3.1.6', map => \%map_temperature_state }
|
||||||
};
|
};
|
||||||
my $oid_ciscoEnvMonTemperatureStatusEntry = '.1.3.6.1.4.1.9.9.13.1.3.1';
|
my $oid_ciscoEnvMonTemperatureStatusEntry = '.1.3.6.1.4.1.9.9.13.1.3.1';
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ sub check {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => "Checking temperatures");
|
$self->{output}->output_add(long_msg => "Checking temperatures");
|
||||||
$self->{components}->{temperature} = {name => 'temperatures', total => 0, skip => 0};
|
$self->{components}->{temperature} = { name => 'temperatures', total => 0, skip => 0 };
|
||||||
return if ($self->check_filter(section => 'temperature'));
|
return if ($self->check_filter(section => 'temperature'));
|
||||||
|
|
||||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_ciscoEnvMonTemperatureStatusEntry}})) {
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_ciscoEnvMonTemperatureStatusEntry}})) {
|
||||||
|
@ -64,16 +64,20 @@ sub check {
|
||||||
|
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
"Temperature '%s' status is %s [instance: %s] [value: %s C]",
|
"temperature '%s' status is %s [instance: %s] [value: %s C]",
|
||||||
$result->{ciscoEnvMonTemperatureStatusDescr}, $result->{ciscoEnvMonTemperatureState},
|
$result->{ciscoEnvMonTemperatureStatusDescr}, $result->{ciscoEnvMonTemperatureState},
|
||||||
$instance, defined($result->{ciscoEnvMonTemperatureStatusValue}) ? $result->{ciscoEnvMonTemperatureStatusValue} : '-'
|
$instance, defined($result->{ciscoEnvMonTemperatureStatusValue}) ? $result->{ciscoEnvMonTemperatureStatusValue} : '-'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
my $exit = $self->get_severity(section => 'temperature', instance => $instance, value => $result->{ciscoEnvMonTemperatureState});
|
my $exit = $self->get_severity(section => 'temperature', instance => $instance, value => $result->{ciscoEnvMonTemperatureState});
|
||||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(
|
||||||
short_msg => sprintf("Temperature '%s' status is %s",
|
severity => $exit,
|
||||||
$result->{ciscoEnvMonTemperatureStatusDescr}, $result->{ciscoEnvMonTemperatureState}));
|
short_msg => sprintf(
|
||||||
|
"Temperature '%s' status is %s",
|
||||||
|
$result->{ciscoEnvMonTemperatureStatusDescr}, $result->{ciscoEnvMonTemperatureState}
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
next if (!defined($result->{ciscoEnvMonTemperatureStatusValue}));
|
next if (!defined($result->{ciscoEnvMonTemperatureStatusValue}));
|
||||||
|
@ -88,8 +92,10 @@ sub check {
|
||||||
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-temperature-instance-' . $instance);
|
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-temperature-instance-' . $instance);
|
||||||
}
|
}
|
||||||
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit2,
|
$self->{output}->output_add(
|
||||||
short_msg => sprintf("Temperature '%s' is %s degree centigrade", $result->{ciscoEnvMonTemperatureStatusDescr}, $result->{ciscoEnvMonTemperatureStatusValue}));
|
severity => $exit2,
|
||||||
|
short_msg => sprintf("Temperature '%s' is %s degree centigrade", $result->{ciscoEnvMonTemperatureStatusDescr}, $result->{ciscoEnvMonTemperatureStatusValue})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => "temp", unit => 'C',
|
label => "temp", unit => 'C',
|
||||||
|
|
|
@ -29,7 +29,7 @@ my %map_voltage_state = (
|
||||||
3 => 'critical',
|
3 => 'critical',
|
||||||
4 => 'shutdown',
|
4 => 'shutdown',
|
||||||
5 => 'not present',
|
5 => 'not present',
|
||||||
6 => 'not functioning',
|
6 => 'not functioning'
|
||||||
);
|
);
|
||||||
|
|
||||||
# In MIB 'CISCO-ENVMON-MIB'
|
# In MIB 'CISCO-ENVMON-MIB'
|
||||||
|
@ -38,7 +38,7 @@ my $mapping = {
|
||||||
ciscoEnvMonVoltageStatusValue => { oid => '.1.3.6.1.4.1.9.9.13.1.2.1.3' },
|
ciscoEnvMonVoltageStatusValue => { oid => '.1.3.6.1.4.1.9.9.13.1.2.1.3' },
|
||||||
ciscoEnvMonVoltageThresholdLow => { oid => '.1.3.6.1.4.1.9.9.13.1.2.1.4' },
|
ciscoEnvMonVoltageThresholdLow => { oid => '.1.3.6.1.4.1.9.9.13.1.2.1.4' },
|
||||||
ciscoEnvMonVoltageThresholdHigh => { oid => '.1.3.6.1.4.1.9.9.13.1.2.1.5' },
|
ciscoEnvMonVoltageThresholdHigh => { oid => '.1.3.6.1.4.1.9.9.13.1.2.1.5' },
|
||||||
ciscoEnvMonVoltageState => { oid => '.1.3.6.1.4.1.9.9.13.1.2.1.7', map => \%map_voltage_state },
|
ciscoEnvMonVoltageState => { oid => '.1.3.6.1.4.1.9.9.13.1.2.1.7', map => \%map_voltage_state }
|
||||||
};
|
};
|
||||||
my $oid_ciscoEnvMonVoltageStatusEntry = '.1.3.6.1.4.1.9.9.13.1.2.1';
|
my $oid_ciscoEnvMonVoltageStatusEntry = '.1.3.6.1.4.1.9.9.13.1.2.1';
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ sub check {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => "Checking voltages");
|
$self->{output}->output_add(long_msg => "Checking voltages");
|
||||||
$self->{components}->{voltage} = {name => 'voltages', total => 0, skip => 0};
|
$self->{components}->{voltage} = { name => 'voltages', total => 0, skip => 0 };
|
||||||
return if ($self->check_filter(section => 'voltage'));
|
return if ($self->check_filter(section => 'voltage'));
|
||||||
|
|
||||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_ciscoEnvMonVoltageStatusEntry}})) {
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_ciscoEnvMonVoltageStatusEntry}})) {
|
||||||
|
@ -63,14 +63,22 @@ sub check {
|
||||||
next if ($self->check_filter(section => 'voltage', instance => $instance, name => $result->{ciscoEnvMonVoltageStatusDescr}));
|
next if ($self->check_filter(section => 'voltage', instance => $instance, name => $result->{ciscoEnvMonVoltageStatusDescr}));
|
||||||
$self->{components}->{voltage}->{total}++;
|
$self->{components}->{voltage}->{total}++;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => sprintf("Voltage '%s' status is %s [instance: %s] [value: %s C]",
|
$self->{output}->output_add(
|
||||||
$result->{ciscoEnvMonVoltageStatusDescr}, $result->{ciscoEnvMonVoltageState},
|
long_msg => sprintf(
|
||||||
$instance, $result->{ciscoEnvMonVoltageStatusValue}));
|
"voltage '%s' status is %s [instance: %s] [value: %s C]",
|
||||||
|
$result->{ciscoEnvMonVoltageStatusDescr}, $result->{ciscoEnvMonVoltageState},
|
||||||
|
$instance, $result->{ciscoEnvMonVoltageStatusValue}
|
||||||
|
)
|
||||||
|
);
|
||||||
my $exit = $self->get_severity(section => 'voltage', instance => $instance, value => $result->{ciscoEnvMonVoltageState});
|
my $exit = $self->get_severity(section => 'voltage', instance => $instance, value => $result->{ciscoEnvMonVoltageState});
|
||||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(
|
||||||
short_msg => sprintf("Voltage '%s' status is %s",
|
severity => $exit,
|
||||||
$result->{ciscoEnvMonVoltageStatusDescr}, $result->{ciscoEnvMonVoltageState}));
|
short_msg => sprintf(
|
||||||
|
"Voltage '%s' status is %s",
|
||||||
|
$result->{ciscoEnvMonVoltageStatusDescr}, $result->{ciscoEnvMonVoltageState}
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result->{ciscoEnvMonVoltageStatusValue} = $result->{ciscoEnvMonVoltageStatusValue} / 1000;
|
$result->{ciscoEnvMonVoltageStatusValue} = $result->{ciscoEnvMonVoltageStatusValue} / 1000;
|
||||||
|
@ -85,14 +93,16 @@ sub check {
|
||||||
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-voltage-instance-' . $instance);
|
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-voltage-instance-' . $instance);
|
||||||
}
|
}
|
||||||
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit2,
|
$self->{output}->output_add(
|
||||||
short_msg => sprintf("Voltage '%s' is %.3f V", $result->{ciscoEnvMonVoltageStatusDescr}, $result->{ciscoEnvMonVoltageStatusValue}));
|
severity => $exit2,
|
||||||
|
short_msg => sprintf("Voltage '%s' is %.3f V", $result->{ciscoEnvMonVoltageStatusDescr}, $result->{ciscoEnvMonVoltageStatusValue})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => "voltage", unit => 'V',
|
label => 'voltage', unit => 'V',
|
||||||
nlabel => 'hardware.voltage.volt',
|
nlabel => 'hardware.voltage.volt',
|
||||||
instances => $result->{ciscoEnvMonVoltageStatusDescr},
|
instances => $result->{ciscoEnvMonVoltageStatusDescr},
|
||||||
value => sprintf("%.3f", $result->{ciscoEnvMonVoltageStatusValue}),
|
value => sprintf('%.3f', $result->{ciscoEnvMonVoltageStatusValue}),
|
||||||
warning => $warn,
|
warning => $warn,
|
||||||
critical => $crit
|
critical => $crit
|
||||||
);
|
);
|
||||||
|
|
|
@ -97,8 +97,7 @@ sub set_system {
|
||||||
$self->{components_module} = ['fan', 'psu', 'temperature', 'voltage', 'module', 'physical', 'sensor'];
|
$self->{components_module} = ['fan', 'psu', 'temperature', 'voltage', 'module', 'physical', 'sensor'];
|
||||||
}
|
}
|
||||||
|
|
||||||
my $oid_entPhysicalDescr = '.1.3.6.1.2.1.47.1.1.1.1.2';
|
my $oid_ciscoEnvMonPresent = '.1.3.6.1.4.1.9.9.13.1.1';
|
||||||
my $oid_ciscoEnvMonPresent = ".1.3.6.1.4.1.9.9.13.1.1";
|
|
||||||
|
|
||||||
my %map_type_mon = (
|
my %map_type_mon = (
|
||||||
1 => 'oldAgs',
|
1 => 'oldAgs',
|
||||||
|
@ -120,11 +119,12 @@ sub snmp_execute {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
$self->{snmp} = $options{snmp};
|
$self->{snmp} = $options{snmp};
|
||||||
|
$self->{physical_name} = defined($self->{option_results}->{use_physical_name}) ? '.1.3.6.1.2.1.47.1.1.1.1.7' : '.1.3.6.1.2.1.47.1.1.1.1.2';
|
||||||
|
|
||||||
push @{$self->{request}}, { oid => $oid_entPhysicalDescr }, { oid => $oid_ciscoEnvMonPresent };
|
push @{$self->{request}}, { oid => $self->{physical_name} }, { oid => $oid_ciscoEnvMonPresent };
|
||||||
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
|
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
|
||||||
while (my ($key, $value) = each %{$self->{results}->{$oid_entPhysicalDescr}}) {
|
while (my ($key, $value) = each %{$self->{results}->{ $self->{physical_name} }}) {
|
||||||
$self->{results}->{$oid_entPhysicalDescr}->{$key} = centreon::plugins::misc::trim($value);
|
$self->{results}->{ $self->{physical_name} }->{$key} = centreon::plugins::misc::trim($value);
|
||||||
}
|
}
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
|
@ -141,6 +141,7 @@ sub new {
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
|
'use-physical-name' => { name => 'use_physical_name' }
|
||||||
});
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
|
@ -170,6 +171,10 @@ Can also exclude specific instance: --filter=fan,1
|
||||||
|
|
||||||
Add literal description for instance value (used in filter, absent-problem and threshold options).
|
Add literal description for instance value (used in filter, absent-problem and threshold options).
|
||||||
|
|
||||||
|
=item B<--use-physical-name>
|
||||||
|
|
||||||
|
Use entPhysicalName OID instead of entPhysicalDescr.
|
||||||
|
|
||||||
=item B<--absent-problem>
|
=item B<--absent-problem>
|
||||||
|
|
||||||
Return an error if an entity is not 'present' (default is skipping) (comma seperated list)
|
Return an error if an entity is not 'present' (default is skipping) (comma seperated list)
|
||||||
|
|
|
@ -89,10 +89,8 @@ sub set_oids_status {
|
||||||
sub set_oids_errors {
|
sub set_oids_errors {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
$self->{oid_ifInDiscards} = '.1.3.6.1.2.1.2.2.1.13';
|
$self->SUPER::set_oids_errors(%options);
|
||||||
$self->{oid_ifInErrors} = '.1.3.6.1.2.1.2.2.1.14';
|
$self->{oid_ifInFCSError} = '.1.3.6.1.2.1.10.7.2.1.3'; # dot3StatsFCSErrors
|
||||||
$self->{oid_ifOutDiscards} = '.1.3.6.1.2.1.2.2.1.19';
|
|
||||||
$self->{oid_ifOutErrors} = '.1.3.6.1.2.1.2.2.1.20';
|
|
||||||
$self->{oid_ifInCrc} = '.1.3.6.1.4.1.9.2.2.1.1.12';
|
$self->{oid_ifInCrc} = '.1.3.6.1.4.1.9.2.2.1.1.12';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,6 +107,15 @@ sub set_counters_errors {
|
||||||
closure_custom_perfdata => $self->can('custom_errors_perfdata'),
|
closure_custom_perfdata => $self->can('custom_errors_perfdata'),
|
||||||
closure_custom_threshold_check => $self->can('custom_errors_threshold')
|
closure_custom_threshold_check => $self->can('custom_errors_threshold')
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{ label => 'in-fcserror', filter => 'add_errors', nlabel => 'interface.packets.in.fcserror.count', set => {
|
||||||
|
key_values => [ { name => 'infcserror', diff => 1 }, { name => 'total_in_packets', diff => 1 }, { name => 'display' }, { name => 'mode_cast' } ],
|
||||||
|
closure_custom_calc => $self->can('custom_errors_calc'),
|
||||||
|
closure_custom_calc_extra_options => { label_ref1 => 'in', label_ref2 => 'fcserror' },
|
||||||
|
closure_custom_output => $self->can('custom_errors_output'), output_error_template => 'Packets In FCS Error : %s',
|
||||||
|
closure_custom_perfdata => $self->can('custom_errors_perfdata'),
|
||||||
|
closure_custom_threshold_check => $self->can('custom_errors_threshold')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
@ -133,7 +140,7 @@ sub load_errors {
|
||||||
oids => [
|
oids => [
|
||||||
$self->{oid_ifInDiscards}, $self->{oid_ifInErrors},
|
$self->{oid_ifInDiscards}, $self->{oid_ifInErrors},
|
||||||
$self->{oid_ifOutDiscards}, $self->{oid_ifOutErrors},
|
$self->{oid_ifOutDiscards}, $self->{oid_ifOutErrors},
|
||||||
$self->{oid_ifInCrc}
|
$self->{oid_ifInCrc}, $self->{oid_ifInFCSError}
|
||||||
],
|
],
|
||||||
instances => $self->{array_interface_selected}
|
instances => $self->{array_interface_selected}
|
||||||
);
|
);
|
||||||
|
@ -156,6 +163,7 @@ sub add_result_errors {
|
||||||
$self->{int}->{$options{instance}}->{outdiscard} = $self->{results}->{$self->{oid_ifOutDiscards} . '.' . $options{instance}};
|
$self->{int}->{$options{instance}}->{outdiscard} = $self->{results}->{$self->{oid_ifOutDiscards} . '.' . $options{instance}};
|
||||||
$self->{int}->{$options{instance}}->{outerror} = $self->{results}->{$self->{oid_ifOutErrors} . '.' . $options{instance}};
|
$self->{int}->{$options{instance}}->{outerror} = $self->{results}->{$self->{oid_ifOutErrors} . '.' . $options{instance}};
|
||||||
$self->{int}->{$options{instance}}->{incrc} = $self->{results}->{$self->{oid_ifInCrc} . '.' . $options{instance}};
|
$self->{int}->{$options{instance}}->{incrc} = $self->{results}->{$self->{oid_ifInCrc} . '.' . $options{instance}};
|
||||||
|
$self->{int}->{$options{instance}}->{infcserror} = $self->{results}->{$self->{oid_ifInFCSError} . '.' . $options{instance}};
|
||||||
}
|
}
|
||||||
|
|
||||||
sub add_result_status {
|
sub add_result_status {
|
||||||
|
@ -243,7 +251,7 @@ Can used special variables like: %{admstatus}, %{opstatus}, %{duplexstatus}, %{e
|
||||||
|
|
||||||
Thresholds.
|
Thresholds.
|
||||||
Can be: 'total-port', 'total-admin-up', 'total-admin-down', 'total-oper-up', 'total-oper-down',
|
Can be: 'total-port', 'total-admin-up', 'total-admin-down', 'total-oper-up', 'total-oper-down',
|
||||||
'in-traffic', 'out-traffic', 'in-crc', 'in-error', 'in-discard', 'out-error', 'out-discard',
|
'in-traffic', 'out-traffic', 'in-crc', 'in-fcserror', 'in-error', 'in-discard', 'out-error', 'out-discard',
|
||||||
'in-ucast', 'in-bcast', 'in-mcast', 'out-ucast', 'out-bcast', 'out-mcast',
|
'in-ucast', 'in-bcast', 'in-mcast', 'out-ucast', 'out-bcast', 'out-mcast',
|
||||||
'speed' (b/s).
|
'speed' (b/s).
|
||||||
|
|
||||||
|
|
|
@ -65,10 +65,12 @@ sub custom_usage_output {
|
||||||
my ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{total});
|
my ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{total});
|
||||||
my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{used});
|
my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{used});
|
||||||
my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{free});
|
my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{free});
|
||||||
$msg = sprintf("Usage Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)",
|
$msg = sprintf(
|
||||||
$total_size_value . " " . $total_size_unit,
|
'Usage Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)',
|
||||||
$total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used},
|
$total_size_value . " " . $total_size_unit,
|
||||||
$total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free});
|
$total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used},
|
||||||
|
$total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free}
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$msg = sprintf("Usage : %.2f %%", $self->{result_values}->{prct_used});
|
$msg = sprintf("Usage : %.2f %%", $self->{result_values}->{prct_used});
|
||||||
}
|
}
|
||||||
|
@ -91,11 +93,17 @@ sub custom_usage_calc {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub prefix_memory_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
return "Memory '" . $options{instance_value}->{display} . "' ";
|
||||||
|
}
|
||||||
|
|
||||||
sub set_counters {
|
sub set_counters {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
$self->{maps_counters_type} = [
|
$self->{maps_counters_type} = [
|
||||||
{ name => 'memory', type => 1, cb_prefix_output => 'prefix_memory_output', message_multiple => 'All memories are ok', skipped_code => { -10 => 1 } },
|
{ name => 'memory', type => 1, cb_prefix_output => 'prefix_memory_output', message_multiple => 'All memories are ok', skipped_code => { -10 => 1 } }
|
||||||
];
|
];
|
||||||
|
|
||||||
$self->{maps_counters}->{memory} = [
|
$self->{maps_counters}->{memory} = [
|
||||||
|
@ -104,26 +112,20 @@ sub set_counters {
|
||||||
closure_custom_calc => $self->can('custom_usage_calc'),
|
closure_custom_calc => $self->can('custom_usage_calc'),
|
||||||
closure_custom_output => $self->can('custom_usage_output'),
|
closure_custom_output => $self->can('custom_usage_output'),
|
||||||
closure_custom_perfdata => $self->can('custom_usage_perfdata'),
|
closure_custom_perfdata => $self->can('custom_usage_perfdata'),
|
||||||
closure_custom_threshold_check => $self->can('custom_usage_threshold'),
|
closure_custom_threshold_check => $self->can('custom_usage_threshold')
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
sub prefix_memory_output {
|
|
||||||
my ($self, %options) = @_;
|
|
||||||
|
|
||||||
return "Memory '" . $options{instance_value}->{display} . "' ";
|
|
||||||
}
|
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
'filter-pool:s' => { name => 'filter_pool' },
|
'filter-pool:s' => { name => 'filter_pool' },
|
||||||
'check-order:s' => { name => 'check_order', default => 'enhanced_pool,pool,process,system_ext' },
|
'check-order:s' => { name => 'check_order', default => 'enhanced_pool,pool,process,system_ext' }
|
||||||
});
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
|
@ -132,7 +134,7 @@ sub new {
|
||||||
my $mapping_memory_pool = {
|
my $mapping_memory_pool = {
|
||||||
ciscoMemoryPoolName => { oid => '.1.3.6.1.4.1.9.9.48.1.1.1.2' },
|
ciscoMemoryPoolName => { oid => '.1.3.6.1.4.1.9.9.48.1.1.1.2' },
|
||||||
ciscoMemoryPoolUsed => { oid => '.1.3.6.1.4.1.9.9.48.1.1.1.5' }, # in B
|
ciscoMemoryPoolUsed => { oid => '.1.3.6.1.4.1.9.9.48.1.1.1.5' }, # in B
|
||||||
ciscoMemoryPoolFree => { oid => '.1.3.6.1.4.1.9.9.48.1.1.1.6' }, # in B
|
ciscoMemoryPoolFree => { oid => '.1.3.6.1.4.1.9.9.48.1.1.1.6' } # in B
|
||||||
};
|
};
|
||||||
my $oid_ciscoMemoryPoolEntry = '.1.3.6.1.4.1.9.9.48.1.1.1';
|
my $oid_ciscoMemoryPoolEntry = '.1.3.6.1.4.1.9.9.48.1.1.1';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue