(plugin) network::alcatel::omniswitch::snmp - add temperature metrics (#3738)
This commit is contained in:
parent
81e50fd52f
commit
d3fa0fde0e
|
@ -59,9 +59,9 @@ sub check {
|
|||
|
||||
if ($result->{chasEntPhysPower} > 0) {
|
||||
$self->{output}->perfdata_add(
|
||||
label => "power", unit => 'W',
|
||||
nlabel => 'hardware.backplane.power.watt',
|
||||
instances => $instance,
|
||||
unit => 'W',
|
||||
instances => [$result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance],
|
||||
value => $result->{chasEntPhysPower},
|
||||
min => 0
|
||||
);
|
||||
|
|
|
@ -26,6 +26,157 @@ use network::alcatel::omniswitch::snmp::mode::components::resources qw(%oids $ma
|
|||
|
||||
sub load {}
|
||||
|
||||
sub check_temp_aos6 {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $mapping_temp = {
|
||||
boardTemp => { oid => '.1.3.6.1.4.1.6486.800.1.1.1.3.1.1.3.1.4', default => -1 }, # chasHardwareBoardTemp
|
||||
threshold => { oid => '.1.3.6.1.4.1.6486.800.1.1.1.3.1.1.3.1.7', default => -1 }, # chasTempThreshold
|
||||
danger => { oid => '.1.3.6.1.4.1.6486.800.1.1.1.3.1.1.3.1.8', default => -1 } # chasDangerTempThreshold
|
||||
};
|
||||
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping_temp, results => $self->{results}->{entity}, instance => $options{instance});
|
||||
|
||||
return if ($result->{boardTemp} <= 0);
|
||||
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"chassis '%s/%s' [instance: %s] board temperature is %s degree centigrade",
|
||||
$options{name},
|
||||
$options{descr},
|
||||
$options{instance},
|
||||
$result->{boardTemp}
|
||||
)
|
||||
);
|
||||
|
||||
my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $options{instance}, value => $result->{boardTemp});
|
||||
if ($checked == 0) {
|
||||
my $warn_th = $result->{threshold} > 0 ? $result->{threshold} : '';
|
||||
my $crit_th = $result->{danger} > 0 ? $result->{danger} : '';
|
||||
|
||||
$self->{perfdata}->threshold_validate(label => 'warning-temperature-instance-' . $options{instance}, value => $warn_th);
|
||||
$self->{perfdata}->threshold_validate(label => 'critical-temperature-instance-' . $options{instance}, value => $crit_th);
|
||||
|
||||
$exit = $self->{perfdata}->threshold_check(
|
||||
value => $result->{boardTemp},
|
||||
threshold => [
|
||||
{ label => 'critical-temperature-instance-' . $options{instance}, exit_litteral => 'critical' },
|
||||
{ label => 'warning-temperature-instance-' . $options{instance}, exit_litteral => 'warning' }
|
||||
]
|
||||
);
|
||||
|
||||
$warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-temperature-instance-' . $options{instance});
|
||||
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-temperature-instance-' . $options{instance})
|
||||
}
|
||||
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf(
|
||||
"chassis '%s/%s/%s' board temperature is %s degree centigrade",
|
||||
$options{name},
|
||||
$options{descr},
|
||||
$options{instance},
|
||||
$result->{boardTemp}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$self->{output}->perfdata_add(
|
||||
nlabel => 'hardware.temperature.celsius',
|
||||
unit => 'C',
|
||||
instances => [$options{name}, $options{descr}, $options{instance}, 'Chassis'],
|
||||
value => $result->{boardTemp},
|
||||
warning => $warn,
|
||||
critical => $crit
|
||||
);
|
||||
}
|
||||
|
||||
sub check_temp_aos7 {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $mapping_temp = {
|
||||
threshold => { oid => '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.3.1.5', default => -1 }, # chasTempThreshold
|
||||
danger => { oid => '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.3.1.6', default => -1 }, # chasDangerTempThreshold
|
||||
CPMA => { oid => '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.3.1.8', default => -1 }, # chasCPMAHardwareBoardTemp
|
||||
CFMA => { oid => '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.3.1.9', default => -1 }, # chasCFMAHardwareBoardTemp
|
||||
CPMB => { oid => '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.3.1.10', default => -1 }, # chasCPMBHardwareBoardTemp
|
||||
CFMB => { oid => '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.3.1.11', default => -1 }, # chasCFMBHardwareBoardTemp
|
||||
CFMC => { oid => '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.3.1.12', default => -1 }, # chasCFMCHardwareBoardTemp
|
||||
CFMD => { oid => '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.3.1.13', default => -1 }, # chasCFMDHardwareBoardTemp
|
||||
FanTray1 => { oid => '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.3.1.14', default => -1 }, # chasFTAHardwareBoardTemp
|
||||
FanTray2 => { oid => '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.3.1.15', default => -1 }, # chasFTBHardwareBoardTemp
|
||||
NI1 => { oid => '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.3.1.16', default => -1 }, # chasNI1HardwareBoardTemp
|
||||
NI2 => { oid => '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.3.1.17', default => -1 }, # chasNI2HardwareBoardTemp
|
||||
NI3 => { oid => '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.3.1.18', default => -1 }, # chasNI3HardwareBoardTemp
|
||||
NI4 => { oid => '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.3.1.19', default => -1 }, # chasNI4HardwareBoardTemp
|
||||
NI5 => { oid => '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.3.1.20', default => -1 }, # chasNI5HardwareBoardTemp
|
||||
NI6 => { oid => '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.3.1.21', default => -1 }, # chasNI6HardwareBoardTemp
|
||||
NI7 => { oid => '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.3.1.22', default => -1 }, # chasNI7HardwareBoardTemp
|
||||
NI8 => { oid => '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.3.1.23', default => -1 } # chasNI8HardwareBoardTemp
|
||||
};
|
||||
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping_temp, results => $self->{results}->{entity}, instance => $options{instance});
|
||||
|
||||
foreach my $sensor ('CPMA', 'CFMA', 'CPMB', 'CFMB', 'CFMC', 'CFMD', 'FanTray1', 'FanTray2', 'NI1', 'NI2', 'NI3', 'NI4', 'NI5', 'NI6', 'NI7', 'NI8') {
|
||||
next if ($result->{$sensor} <= 0);
|
||||
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"chassis '%s/%s/%s/%s' temperature is %s degree centigrade",
|
||||
$options{name},
|
||||
$options{descr},
|
||||
$options{instance},
|
||||
$sensor,
|
||||
$result->{$sensor}
|
||||
)
|
||||
);
|
||||
|
||||
my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $options{instance}, value => $result->{$sensor});
|
||||
if ($checked == 0) {
|
||||
my $warn_th = $result->{threshold} > 0 ? $result->{threshold} : '';
|
||||
my $crit_th = $result->{danger} > 0 ? $result->{danger} : '';
|
||||
|
||||
$self->{perfdata}->threshold_validate(label => 'warning-temperature-instance-' . $options{instance}, value => $warn_th);
|
||||
$self->{perfdata}->threshold_validate(label => 'critical-temperature-instance-' . $options{instance}, value => $crit_th);
|
||||
|
||||
$exit = $self->{perfdata}->threshold_check(
|
||||
value => $result->{$sensor},
|
||||
threshold => [
|
||||
{ label => 'critical-temperature-instance-' . $options{instance}, exit_litteral => 'critical' },
|
||||
{ label => 'warning-temperature-instance-' . $options{instance}, exit_litteral => 'warning' }
|
||||
]
|
||||
);
|
||||
|
||||
$warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-temperature-instance-' . $options{instance});
|
||||
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-temperature-instance-' . $options{instance})
|
||||
}
|
||||
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf(
|
||||
"chassis '%s/%s/%s/%s' temperature is %s degree centigrade",
|
||||
$options{name},
|
||||
$options{descr},
|
||||
$options{instance},
|
||||
$sensor,
|
||||
$result->{$sensor}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$self->{output}->perfdata_add(
|
||||
nlabel => 'hardware.temperature.celsius',
|
||||
unit => 'C',
|
||||
instances => [$options{name}, $options{descr}, $options{instance}, $sensor],
|
||||
value => $result->{$sensor},
|
||||
warning => $warn,
|
||||
critical => $crit
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
|
@ -34,46 +185,57 @@ sub check {
|
|||
return if ($self->check_filter(section => 'chassis'));
|
||||
|
||||
my @instances = ();
|
||||
foreach my $key (keys %{$self->{results}->{$oids{common}->{entPhysicalClass}}}) {
|
||||
if ($self->{results}->{$oids{common}->{entPhysicalClass}}->{$key} == 3) {
|
||||
foreach my $key (keys %{$self->{results}->{ $oids{common}->{entPhysicalClass} }}) {
|
||||
if ($self->{results}->{ $oids{common}->{entPhysicalClass} }->{$key} == 3) {
|
||||
next if ($key !~ /^$oids{common}->{entPhysicalClass}\.(.*)$/);
|
||||
push @instances, $1;
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $instance (@instances) {
|
||||
next if (!defined($self->{results}->{entity}->{$oids{$self->{type}}{chasEntPhysAdminStatus} . '.' . $instance}));
|
||||
next if (!defined($self->{results}->{entity}->{ $oids{ $self->{type} }->{chasEntPhysAdminStatus} . '.' . $instance }));
|
||||
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping->{$self->{type}}, results => $self->{results}->{entity}, instance => $instance);
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping->{ $self->{type} }, results => $self->{results}->{entity}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'chassis', instance => $instance));
|
||||
$self->{components}->{chassis}->{total}++;
|
||||
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"chassis '%s/%s' [instance: %s, admin status: %s] operationnal status is %s.",
|
||||
$result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance,
|
||||
$result->{chasEntPhysAdminStatus}, $result->{chasEntPhysOperStatus}
|
||||
"chassis '%s/%s' [instance: %s, admin status: %s] operationnal status is %s",
|
||||
$result->{entPhysicalName},
|
||||
$result->{entPhysicalDescr},
|
||||
$instance,
|
||||
$result->{chasEntPhysAdminStatus},
|
||||
$result->{chasEntPhysOperStatus}
|
||||
)
|
||||
);
|
||||
|
||||
if ($result->{chasEntPhysPower} > 0) {
|
||||
$self->{output}->perfdata_add(
|
||||
label => "power", unit => 'W',
|
||||
nlabel => 'hardware.chassis.power.watt',
|
||||
instances => $instance,
|
||||
unit => 'W',
|
||||
instances => [$result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance],
|
||||
value => $result->{chasEntPhysPower},
|
||||
min => 0
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if ($self->{type} eq 'aos6') {
|
||||
check_temp_aos6($self, instance => $instance, name => $result->{entPhysicalName}, descr => $result->{entPhysicalDescr});
|
||||
} else {
|
||||
check_temp_aos7($self, instance => $instance, name => $result->{entPhysicalName}, descr => $result->{entPhysicalDescr});
|
||||
}
|
||||
|
||||
my $exit = $self->get_severity(label => 'admin', section => 'chassis.admin', value => $result->{chasEntPhysAdminStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf(
|
||||
"chassis '%s/%s/%s' admin status is %s",
|
||||
$result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance,
|
||||
$result->{entPhysicalName},
|
||||
$result->{entPhysicalDescr},
|
||||
$instance,
|
||||
$result->{chasEntPhysAdminStatus}
|
||||
)
|
||||
);
|
||||
|
@ -86,7 +248,9 @@ sub check {
|
|||
severity => $exit,
|
||||
short_msg => sprintf(
|
||||
"chassis '%s/%s/%s' operational status is %s",
|
||||
$result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance,
|
||||
$result->{entPhysicalName},
|
||||
$result->{entPhysicalDescr},
|
||||
$instance,
|
||||
$result->{chasEntPhysOperStatus}
|
||||
)
|
||||
);
|
||||
|
|
|
@ -59,9 +59,9 @@ sub check {
|
|||
|
||||
if ($result->{chasEntPhysPower} > 0) {
|
||||
$self->{output}->perfdata_add(
|
||||
label => "power", unit => 'W',
|
||||
nlabel => 'hardware.container.power.watt',
|
||||
instances => $instance,
|
||||
unit => 'W',
|
||||
instances => [$result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance],
|
||||
value => $result->{chasEntPhysPower},
|
||||
min => 0
|
||||
);
|
||||
|
|
|
@ -40,7 +40,7 @@ sub check {
|
|||
return if ($self->check_filter(section => 'fan'));
|
||||
|
||||
my @instances = ();
|
||||
foreach my $key (keys %{$self->{results}->{$oids{common}->{entPhysicalClass}}}) {
|
||||
foreach my $key (keys %{$self->{results}->{ $oids{common}->{entPhysicalClass} }}) {
|
||||
if ($self->{results}->{$oids{common}->{entPhysicalClass}}->{$key} == 7) {
|
||||
next if ($key !~ /^$oids{common}->{entPhysicalClass}\.(.*)$/);
|
||||
push @instances, $1;
|
||||
|
@ -48,7 +48,7 @@ sub check {
|
|||
}
|
||||
|
||||
foreach my $instance (@instances) {
|
||||
next if (!defined($self->{results}->{entity}->{$oids{$self->{type}}{chasEntPhysAdminStatus} . '.' . $instance}));
|
||||
next if (!defined($self->{results}->{entity}->{ $oids{ $self->{type} }->{chasEntPhysAdminStatus} . '.' . $instance }));
|
||||
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping->{$self->{type}}, results => $self->{results}->{entity}, instance => $instance);
|
||||
|
||||
|
@ -67,7 +67,7 @@ sub check {
|
|||
$self->{output}->perfdata_add(
|
||||
label => "power", unit => 'W',
|
||||
nlabel => 'hardware.fan.power.watt',
|
||||
instances => $instance,
|
||||
instances => [$result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance],
|
||||
value => $result->{chasEntPhysPower},
|
||||
min => 0
|
||||
);
|
||||
|
@ -99,7 +99,9 @@ sub check {
|
|||
}
|
||||
}
|
||||
|
||||
foreach my $key (keys %{$self->{results}->{$oids{$self->{type}}->{alaChasEntPhysFanStatus}}}) {
|
||||
return if ($self->{type} eq '');
|
||||
|
||||
foreach my $key (keys %{$self->{results}->{ $oids{ $self->{type} }->{alaChasEntPhysFanStatus} } }) {
|
||||
next if ($key !~ /^$oids{$self->{type}}->{alaChasEntPhysFanStatus}\.(.*?)\.(.*?)$/);
|
||||
my ($phys_index, $loc_index) = ($1, $2);
|
||||
my $status = $self->{results}->{$oids{$self->{type}}->{alaChasEntPhysFanStatus}}->{$key};
|
||||
|
|
|
@ -59,9 +59,9 @@ sub check {
|
|||
|
||||
if ($result->{chasEntPhysPower} > 0) {
|
||||
$self->{output}->perfdata_add(
|
||||
label => "power", unit => 'W',
|
||||
nlabel => 'hardware.module.power.watt',
|
||||
instances => $instance,
|
||||
unit => 'W',
|
||||
instances => [$result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance],
|
||||
value => $result->{chasEntPhysPower},
|
||||
min => 0
|
||||
);
|
||||
|
|
|
@ -59,9 +59,9 @@ sub check {
|
|||
|
||||
if ($result->{chasEntPhysPower} > 0) {
|
||||
$self->{output}->perfdata_add(
|
||||
label => "power", unit => 'W',
|
||||
nlabel => 'hardware.other.power.watt',
|
||||
instances => $instance,
|
||||
unit => 'W',
|
||||
instances => [$result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance],
|
||||
value => $result->{chasEntPhysPower},
|
||||
min => 0
|
||||
);
|
||||
|
|
|
@ -34,7 +34,7 @@ sub check {
|
|||
return if ($self->check_filter(section => 'psu'));
|
||||
|
||||
my @instances = ();
|
||||
foreach my $key (keys %{$self->{results}->{$oids{common}->{entPhysicalClass}}}) {
|
||||
foreach my $key (keys %{$self->{results}->{ $oids{common}->{entPhysicalClass} }}) {
|
||||
if ($self->{results}->{$oids{common}->{entPhysicalClass}}->{$key} == 6) {
|
||||
next if ($key !~ /^$oids{common}->{entPhysicalClass}\.(.*)$/);
|
||||
push @instances, $1;
|
||||
|
@ -42,9 +42,9 @@ sub check {
|
|||
}
|
||||
|
||||
foreach my $instance (@instances) {
|
||||
next if (!defined($self->{results}->{entity}->{$oids{$self->{type}}{chasEntPhysAdminStatus} . '.' . $instance}));
|
||||
next if (!defined($self->{results}->{entity}->{ $oids{ $self->{type} }->{chasEntPhysAdminStatus} . '.' . $instance }));
|
||||
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping->{$self->{type}}, results => $self->{results}->{entity}, instance => $instance);
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping->{ $self->{type} }, results => $self->{results}->{entity}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'psu', instance => $instance));
|
||||
$self->{components}->{psu}->{total}++;
|
||||
|
@ -59,9 +59,9 @@ sub check {
|
|||
|
||||
if ($result->{chasEntPhysPower} > 0) {
|
||||
$self->{output}->perfdata_add(
|
||||
label => "power", unit => 'W',
|
||||
nlabel => 'hardware.powersupply.power.watt',
|
||||
instances => $instance,
|
||||
unit => 'W',
|
||||
instances => [$result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance],
|
||||
value => $result->{chasEntPhysPower},
|
||||
min => 0
|
||||
);
|
||||
|
|
|
@ -82,29 +82,32 @@ our @EXPORT_OK = qw(%physical_class %phys_oper_status %phys_admin_status %oids $
|
|||
},
|
||||
aos6 => {
|
||||
entreprise_alcatel_base => '.1.3.6.1.4.1.6486.800',
|
||||
|
||||
|
||||
version => '.1.3.6.1.4.1.6486.800.1.1.1.2.1.1.3.17.0', # systemHardwareUbootVersion
|
||||
|
||||
chasPhysBase => '.1.3.6.1.4.1.6486.800.1.1.1.1.1.1.1',
|
||||
chasEntPhysAdminStatus => '.1.3.6.1.4.1.6486.800.1.1.1.1.1.1.1.1',
|
||||
chasEntPhysOperStatus => '.1.3.6.1.4.1.6486.800.1.1.1.1.1.1.1.2',
|
||||
chasEntPhysPower => '.1.3.6.1.4.1.6486.800.1.1.1.1.1.1.1.4',
|
||||
|
||||
chasHardwareBoardTemp => '.1.3.6.1.4.1.6486.800.1.1.1.3.1.1.3.1.4',
|
||||
chasTempThreshold => '.1.3.6.1.4.1.6486.800.1.1.1.3.1.1.3.1.7',
|
||||
chasDangerTempThreshold => '.1.3.6.1.4.1.6486.800.1.1.1.3.1.1.3.1.8',
|
||||
|
||||
chasChassisEntry => '.1.3.6.1.4.1.6486.800.1.1.1.3.1.1.3.1',
|
||||
|
||||
alaChasEntPhysFanStatus => '.1.3.6.1.4.1.6486.800.1.1.1.3.1.1.11.1.2'
|
||||
},
|
||||
aos7 => {
|
||||
entreprise_alcatel_base => '.1.3.6.1.4.1.6486.801',
|
||||
|
||||
|
||||
version => '.1.3.6.1.4.1.6486.801.1.1.1.2.1.1.3.17.0', # systemHardwareUbootVersion
|
||||
|
||||
chasPhysBase => '.1.3.6.1.4.1.6486.801.1.1.1.1.1.1.1',
|
||||
chasEntPhysAdminStatus => '.1.3.6.1.4.1.6486.801.1.1.1.1.1.1.1.1',
|
||||
chasEntPhysOperStatus => '.1.3.6.1.4.1.6486.801.1.1.1.1.1.1.1.2',
|
||||
chasEntPhysPower => '.1.3.6.1.4.1.6486.801.1.1.1.1.1.1.1.3',
|
||||
|
||||
chasTempThreshold => '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.3.1.5',
|
||||
chasDangerTempThreshold => '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.3.1.6',
|
||||
|
||||
chasChassisEntry => '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.3.1',
|
||||
|
||||
alaChasEntPhysFanStatus => '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.11.1.2'
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
$mapping = {
|
||||
|
|
|
@ -40,12 +40,12 @@ sub check {
|
|||
push @instances, $1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach my $instance (@instances) {
|
||||
next if (!defined($self->{results}->{entity}->{$oids{$self->{type}}{chasEntPhysAdminStatus} . '.' . $instance}));
|
||||
|
||||
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping->{$self->{type}}, results => $self->{results}->{entity}, instance => $instance);
|
||||
|
||||
|
||||
next if ($self->check_filter(section => 'sensor', instance => $instance));
|
||||
$self->{components}->{sensor}->{total}++;
|
||||
|
||||
|
@ -59,14 +59,14 @@ sub check {
|
|||
|
||||
if ($result->{chasEntPhysPower} > 0) {
|
||||
$self->{output}->perfdata_add(
|
||||
label => "power", unit => 'W',
|
||||
nlabel => 'hardware.sensor.power.watt',
|
||||
instances => $instance,
|
||||
unit => 'W',
|
||||
instances => [$result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance],
|
||||
value => $result->{chasEntPhysPower},
|
||||
min => 0
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
my $exit = $self->get_severity(label => 'admin', section => 'sensor.admin', value => $result->{chasEntPhysAdminStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(
|
||||
|
|
|
@ -59,9 +59,9 @@ sub check {
|
|||
|
||||
if ($result->{chasEntPhysPower} > 0) {
|
||||
$self->{output}->perfdata_add(
|
||||
label => "power", unit => 'W',
|
||||
nlabel => 'hardware.stack.power.watt',
|
||||
instances => $instance,
|
||||
unit => 'W',
|
||||
instances => [$result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance],
|
||||
value => $result->{chasEntPhysPower},
|
||||
min => 0
|
||||
);
|
||||
|
|
|
@ -59,8 +59,8 @@ sub check {
|
|||
|
||||
if ($result->{chasEntPhysPower} > 0) {
|
||||
$self->{output}->perfdata_add(
|
||||
label => "power", unit => 'W',
|
||||
nlabel => 'hardware.unknown.power.watt',
|
||||
nlabel => [$result->{entPhysicalName}, $result->{entPhysicalDescr}, $instance],
|
||||
unit => 'W',
|
||||
instances => $instance,
|
||||
value => $result->{chasEntPhysPower},
|
||||
min => 0
|
||||
|
|
|
@ -26,8 +26,10 @@ use network::alcatel::omniswitch::snmp::mode::components::resources qw(%oids);
|
|||
sub set_system {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{regexp_threshold_numeric_check_section_option} = '^(temperature)$';
|
||||
|
||||
$self->{cb_hook2} = 'snmp_execute';
|
||||
|
||||
|
||||
$self->{thresholds} = {
|
||||
admin => [
|
||||
['^(reset|takeover|resetWithFabric|takeoverWithFabrc)$', 'WARNING'],
|
||||
|
@ -58,34 +60,59 @@ sub snmp_execute {
|
|||
my ($self, %options) = @_;
|
||||
|
||||
$self->{snmp} = $options{snmp};
|
||||
$self->{results} = $self->{snmp}->get_multiple_table(oids => [
|
||||
{ oid => $oids{common}->{entPhysicalClass} },
|
||||
{ oid => $oids{aos6}->{alaChasEntPhysFanStatus} },
|
||||
{ oid => $oids{aos7}->{alaChasEntPhysFanStatus} }
|
||||
]);
|
||||
$self->{results}->{entity} = $self->{snmp}->get_multiple_table(oids => [
|
||||
{ oid => $oids{common}->{entPhysicalDescr} },
|
||||
{ oid => $oids{common}->{entPhysicalName} },
|
||||
{ oid => $oids{aos6}->{chasEntPhysAdminStatus} },
|
||||
{ oid => $oids{aos6}->{chasEntPhysOperStatus} },
|
||||
{ oid => $oids{aos6}->{chasEntPhysPower} },
|
||||
{ oid => $oids{aos7}->{chasEntPhysAdminStatus} },
|
||||
{ oid => $oids{aos7}->{chasEntPhysOperStatus} },
|
||||
{ oid => $oids{aos7}->{chasEntPhysPower} }
|
||||
], return_type => 1);
|
||||
|
||||
$self->{type} = 'aos6';
|
||||
foreach (keys %{$self->{results}->{entity}}) {
|
||||
if (/^$oids{aos7}->{entreprise_alcatel_base}\./) {
|
||||
$self->{type} = 'aos7';
|
||||
last;
|
||||
}
|
||||
my $versions = $self->{snmp}->get_leef(
|
||||
oids => [ $oids{aos6}->{version}, $oids{aos7}->{version} ]
|
||||
);
|
||||
|
||||
$self->{type} = '';
|
||||
if (defined($versions->{ $oids{aos6}->{version} })) {
|
||||
$self->{type} = 'aos6';
|
||||
} elsif (defined($versions->{ $oids{aos7}->{version} })) {
|
||||
$self->{type} = 'aos7';
|
||||
}
|
||||
|
||||
if ($self->{type} eq 'aos6') {
|
||||
$self->{results} = $self->{snmp}->get_multiple_table(
|
||||
oids => [
|
||||
{ oid => $oids{common}->{entPhysicalClass} },
|
||||
{ oid => $oids{aos6}->{alaChasEntPhysFanStatus} }
|
||||
]
|
||||
);
|
||||
|
||||
$self->{results}->{entity} = $self->{snmp}->get_multiple_table(
|
||||
oids => [
|
||||
{ oid => $oids{common}->{entPhysicalDescr} },
|
||||
{ oid => $oids{common}->{entPhysicalName} },
|
||||
{ oid => $oids{aos6}->{chasPhysBase}, start => $oids{aos6}->{chasEntPhysAdminStatus}, end => $oids{aos6}->{chasEntPhysOperStatus} },
|
||||
{ oid => $oids{aos6}->{chasEntPhysPower} },
|
||||
{ oid => $oids{aos6}->{chasChassisEntry} }
|
||||
],
|
||||
return_type => 1
|
||||
);
|
||||
} elsif ($self->{type} eq 'aos7') {
|
||||
$self->{results} = $self->{snmp}->get_multiple_table(
|
||||
oids => [
|
||||
{ oid => $oids{common}->{entPhysicalClass} },
|
||||
{ oid => $oids{aos7}->{alaChasEntPhysFanStatus} }
|
||||
]
|
||||
);
|
||||
|
||||
$self->{results}->{entity} = $self->{snmp}->get_multiple_table(
|
||||
oids => [
|
||||
{ oid => $oids{common}->{entPhysicalDescr} },
|
||||
{ oid => $oids{common}->{entPhysicalName} },
|
||||
{ oid => $oids{aos7}->{chasPhysBase}, start => $oids{aos7}->{chasEntPhysAdminStatus}, end => $oids{aos7}->{chasEntPhysPower} },
|
||||
{ oid => $oids{aos7}->{chasChassisEntry} }
|
||||
],
|
||||
return_type => 1
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {});
|
||||
|
|
Loading…
Reference in New Issue