(plugin) network::nortel::standard::snmp - manage voss hardware (#3533)
This commit is contained in:
parent
c8a487173a
commit
c2cd9c71f4
|
@ -24,16 +24,86 @@ use strict;
|
|||
use warnings;
|
||||
use network::nortel::standard::snmp::mode::components::resources qw($map_card_status);
|
||||
|
||||
my $mapping = {
|
||||
rcCardSerialNumber => { oid => '.1.3.6.1.4.1.2272.1.4.9.1.1.3' },
|
||||
rcCardOperStatus => { oid => '.1.3.6.1.4.1.2272.1.4.9.1.1.6', map => $map_card_status },
|
||||
my $mapping_rc = {
|
||||
serial => { oid => '.1.3.6.1.4.1.2272.1.4.9.1.1.3' }, # rcCardSerialNumber
|
||||
status => { oid => '.1.3.6.1.4.1.2272.1.4.9.1.1.6', map => $map_card_status } # rcCardOperStatus
|
||||
};
|
||||
my $oid_rcCardEntry = '.1.3.6.1.4.1.2272.1.4.9.1.1';
|
||||
|
||||
my $mapping_rc2k = {
|
||||
status => { oid => '.1.3.6.1.4.1.2272.1.100.6.1.5', map => $map_card_status }, # rc2kCardFrontOperStatus
|
||||
serial => { oid => '.1.3.6.1.4.1.2272.1.100.6.1.6' } # rc2kCardFrontSerialNum
|
||||
};
|
||||
my $oid_rc2kCardEntry = '.1.3.6.1.4.1.2272.1.100.6.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_rcCardEntry };
|
||||
push @{$self->{request}},
|
||||
{ oid => $oid_rcCardEntry, start => $mapping_rc->{serial}->{oid}, end => $mapping_rc->{serial}->{status} },
|
||||
{ oid => $oid_rc2kCardEntry, start => $mapping_rc2k->{status}->{oid}, end => $mapping_rc2k->{serial}->{status} };
|
||||
}
|
||||
|
||||
sub check_rc {
|
||||
my ($self) = @_;
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_rcCardEntry}})) {
|
||||
next if ($oid !~ /^$mapping_rc->{status}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping_rc, results => $self->{results}->{$oid_rcCardEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'card', instance => $instance));
|
||||
$self->{components}->{card}->{total}++;
|
||||
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"card '%s' status is '%s' [instance: %s]",
|
||||
$result->{serial}, $result->{status},
|
||||
$instance
|
||||
)
|
||||
);
|
||||
my $exit = $self->get_severity(section => 'card', instance => $instance, value => $result->{status});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf(
|
||||
"Card '%s' status is '%s'",
|
||||
$result->{serial}, $result->{status}
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check_rc2k {
|
||||
my ($self) = @_;
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_rc2kCardEntry}})) {
|
||||
next if ($oid !~ /^$mapping_rc2k->{status}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping_rc2k, results => $self->{results}->{$oid_rc2kCardEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'card', instance => $instance));
|
||||
$self->{components}->{card}->{total}++;
|
||||
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"card '%s' status is '%s' [instance: %s]",
|
||||
$result->{serial}, $result->{status},
|
||||
$instance
|
||||
)
|
||||
);
|
||||
my $exit = $self->get_severity(section => 'card', instance => $instance, value => $result->{status});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf(
|
||||
"Card '%s' status is '%s'",
|
||||
$result->{serial}, $result->{status}
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check {
|
||||
|
@ -43,25 +113,8 @@ sub check {
|
|||
$self->{components}->{card} = {name => 'cards', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'card'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_rcCardEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{rcCardOperStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_rcCardEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'card', instance => $instance));
|
||||
$self->{components}->{card}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("card '%s' status is '%s' [instance: %s].",
|
||||
$result->{rcCardSerialNumber}, $result->{rcCardOperStatus},
|
||||
$instance
|
||||
));
|
||||
my $exit = $self->get_severity(section => 'card', instance => $instance, value => $result->{rcCardOperStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Card '%s' status is '%s'",
|
||||
$result->{rcCardSerialNumber}, $result->{rcCardOperStatus}));
|
||||
}
|
||||
}
|
||||
check_rc($self);
|
||||
check_rc2k($self);
|
||||
}
|
||||
|
||||
1;
|
||||
1;
|
||||
|
|
|
@ -26,7 +26,7 @@ use network::nortel::standard::snmp::mode::components::resources qw($map_comp_st
|
|||
|
||||
my $mapping = {
|
||||
s5ChasComDescr => { oid => '.1.3.6.1.4.1.45.1.6.3.3.1.1.5' },
|
||||
s5ChasComOperState => { oid => '.1.3.6.1.4.1.45.1.6.3.3.1.1.10', map => $map_comp_status },
|
||||
s5ChasComOperState => { oid => '.1.3.6.1.4.1.45.1.6.3.3.1.1.10', map => $map_comp_status }
|
||||
};
|
||||
my $oid_s5ChasComEntry = '.1.3.6.1.4.1.45.1.6.3.3.1.1';
|
||||
|
||||
|
@ -53,17 +53,24 @@ sub check {
|
|||
|
||||
my $name = defined($result->{s5ChasComDescr}) && $result->{s5ChasComDescr} ne '' ?
|
||||
$result->{s5ChasComDescr} : $instance;
|
||||
$self->{output}->output_add(long_msg => sprintf("entity '%s' status is '%s' [instance: %s].",
|
||||
$name, $result->{s5ChasComOperState},
|
||||
$instance
|
||||
));
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"entity '%s' status is '%s' [instance: %s]",
|
||||
$name, $result->{s5ChasComOperState},
|
||||
$instance
|
||||
)
|
||||
);
|
||||
my $exit = $self->get_severity(section => 'entity', instance => $instance, value => $result->{s5ChasComOperState});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Entity '%s' status is '%s'",
|
||||
$name, $result->{s5ChasComOperState}));
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf(
|
||||
"Entity '%s' status is '%s'",
|
||||
$name, $result->{s5ChasComOperState}
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
1;
|
||||
|
|
|
@ -24,58 +24,116 @@ use strict;
|
|||
use warnings;
|
||||
use network::nortel::standard::snmp::mode::components::resources qw($map_fan_status);
|
||||
|
||||
my $mapping = {
|
||||
rcChasFanOperStatus => { oid => '.1.3.6.1.4.1.2272.1.4.7.1.1.2', map => $map_fan_status },
|
||||
rcChasFanAmbientTemperature => { oid => '.1.3.6.1.4.1.2272.1.4.7.1.1.3' },
|
||||
my $mapping_rc = {
|
||||
status => { oid => '.1.3.6.1.4.1.2272.1.4.7.1.1.2', map => $map_fan_status }, # rcChasFanOperStatus
|
||||
temperature => { oid => '.1.3.6.1.4.1.2272.1.4.7.1.1.3' } # rcChasFanAmbientTemperature
|
||||
};
|
||||
my $oid_rcChasFanEntry = '.1.3.6.1.4.1.2272.1.4.7.1.1';
|
||||
my $oid_rcFanEntry = '.1.3.6.1.4.1.2272.1.4.7.1.1'; # rcChasFanEntry
|
||||
|
||||
my $mapping_voss = {
|
||||
description => { oid => '.1.3.6.1.4.1.2272.1.101.1.1.4.1.3' }, # rcVossSystemFanInfoDescription
|
||||
status => { oid => '.1.3.6.1.4.1.2272.1.101.1.1.4.1.4', map => $map_fan_status }, # rcVossSystemFanInfoOperStatus
|
||||
};
|
||||
my $oid_vossFanEntry = '.1.3.6.1.4.1.2272.1.101.1.1.4.1'; # rcVossSystemFanInfoEntry
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_rcChasFanEntry };
|
||||
push @{$self->{request}},
|
||||
{ oid => $oid_rcFanEntry, end => $mapping_rc->{temperature}->{oid} },
|
||||
{ oid => $oid_vossFanEntry, start => $mapping_voss->{description}->{oid}, end => $mapping_voss->{status}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
sub check_fan_rc {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking fans");
|
||||
$self->{components}->{fan} = {name => 'fans', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'fan'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_rcChasFanEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{rcChasFanOperStatus}->{oid}\.(.*)$/);
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_rcFanEntry}})) {
|
||||
next if ($oid !~ /^$mapping_rc->{status}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_rcChasFanEntry}, instance => $instance);
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping_rc, results => $self->{results}->{$oid_rcFanEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'fan', instance => $instance));
|
||||
$self->{components}->{fan}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("fan '%s' status is '%s' [instance: %s, value: %s].",
|
||||
$instance, $result->{rcChasFanOperStatus},
|
||||
$instance, $result->{rcChasFanAmbientTemperature}
|
||||
));
|
||||
my $exit = $self->get_severity(section => 'fan', instance => $instance, value => $result->{rcChasFanOperStatus});
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"fan '%s' status is '%s' [instance: %s, value: %s]",
|
||||
$instance,
|
||||
$result->{status},
|
||||
$instance,
|
||||
$result->{temperature}
|
||||
)
|
||||
);
|
||||
my $exit = $self->get_severity(section => 'fan', instance => $instance, value => $result->{status});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Fan '%s' status is '%s'",
|
||||
$instance, $result->{rcChasFanOperStatus}));
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf(
|
||||
"Fan '%s' status is '%s'",
|
||||
$instance, $result->{status}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
my ($exit2, $warn, $crit) = $self->get_severity_numeric(section => 'fan.temperature', instance => $instance, value => $result->{rcChasFanAmbientTemperature});
|
||||
my ($exit2, $warn, $crit) = $self->get_severity_numeric(section => 'fan.temperature', instance => $instance, value => $result->{temperature});
|
||||
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit2,
|
||||
short_msg => sprintf("Fan temperature '%s' is %s degree centigrade", $instance, $result->{rcChasFanAmbientTemperature}));
|
||||
$self->{output}->output_add(
|
||||
severity => $exit2,
|
||||
short_msg => sprintf("Fan '%s' temperature is %s degree centigrade", $instance, $result->{temperature})
|
||||
);
|
||||
}
|
||||
$self->{output}->perfdata_add(
|
||||
label => 'fan_temp', unit => 'C',
|
||||
nlabel => 'hardware.fan.temperature.celsius',
|
||||
unit => 'C',
|
||||
instances => $instance,
|
||||
value => $result->{rcChasFanAmbientTemperature},
|
||||
value => $result->{temperature},
|
||||
warning => $warn,
|
||||
critical => $crit,
|
||||
critical => $crit
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
sub check_fan_voss {
|
||||
my ($self) = @_;
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_vossFanEntry}})) {
|
||||
next if ($oid !~ /^$mapping_voss->{status}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping_voss, results => $self->{results}->{$oid_vossFanEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'fan', instance => $instance));
|
||||
$self->{components}->{fan}->{total}++;
|
||||
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"%s status is '%s' [instance: %s]",
|
||||
$result->{description},
|
||||
$result->{status},
|
||||
$instance
|
||||
)
|
||||
);
|
||||
my $exit = $self->get_severity(section => 'fan', instance => $instance, value => $result->{status});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf(
|
||||
"%s status is '%s'",
|
||||
$result->{description}, $result->{status}
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => 'Checking fans');
|
||||
$self->{components}->{fan} = { name => 'fans', total => 0, skip => 0 };
|
||||
return if ($self->check_filter(section => 'fan'));
|
||||
|
||||
check_fan_rc($self);
|
||||
check_fan_voss($self);
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -56,7 +56,7 @@ sub check {
|
|||
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"led '%s' status is '%s' [instance: %s].",
|
||||
"led '%s' status is '%s' [instance: %s]",
|
||||
$result->{label},
|
||||
$result->{status},
|
||||
$instance
|
||||
|
|
|
@ -25,7 +25,7 @@ use warnings;
|
|||
use network::nortel::standard::snmp::mode::components::resources qw($map_psu_status);
|
||||
|
||||
my $mapping = {
|
||||
rcChasPowerSupplyOperStatus => { oid => '.1.3.6.1.4.1.2272.1.4.8.1.1.2', map => $map_psu_status },
|
||||
rcChasPowerSupplyOperStatus => { oid => '.1.3.6.1.4.1.2272.1.4.8.1.1.2', map => $map_psu_status }
|
||||
};
|
||||
my $oid_rcChasPowerSupplyEntry = '.1.3.6.1.4.1.2272.1.4.8.1.1';
|
||||
|
||||
|
@ -37,7 +37,7 @@ sub load {
|
|||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking power supplies");
|
||||
$self->{components}->{psu} = {name => 'psus', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'psu'));
|
||||
|
@ -50,17 +50,24 @@ sub check {
|
|||
next if ($self->check_filter(section => 'psu', instance => $instance));
|
||||
$self->{components}->{psu}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("power supply '%s' status is '%s' [instance: %s].",
|
||||
$instance, $result->{rcChasPowerSupplyOperStatus},
|
||||
$instance
|
||||
));
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"power supply '%s' status is '%s' [instance: %s]",
|
||||
$instance, $result->{rcChasPowerSupplyOperStatus},
|
||||
$instance
|
||||
)
|
||||
);
|
||||
my $exit = $self->get_severity(section => 'psu', instance => $instance, value => $result->{rcChasPowerSupplyOperStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Power supply '%s' status is '%s'",
|
||||
$instance, $result->{rcChasPowerSupplyOperStatus}));
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf(
|
||||
"Power supply '%s' status is '%s'",
|
||||
$instance, $result->{rcChasPowerSupplyOperStatus}
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
1;
|
||||
|
|
|
@ -33,13 +33,14 @@ $map_fan_status = {
|
|||
1 => 'unknown',
|
||||
2 => 'up',
|
||||
3 => 'down',
|
||||
4 => 'notpresent'
|
||||
};
|
||||
|
||||
$map_psu_status = {
|
||||
1 => 'unknown',
|
||||
2 => 'empty',
|
||||
3 => 'up',
|
||||
4 => 'down',
|
||||
4 => 'down'
|
||||
};
|
||||
|
||||
$map_card_status = {
|
||||
|
@ -48,6 +49,9 @@ $map_card_status = {
|
|||
3 => 'testing',
|
||||
4 => 'unknown',
|
||||
5 => 'dormant',
|
||||
6 => 'upMaster',
|
||||
7 => 'upDormant',
|
||||
8 => 'upWarmstandby'
|
||||
};
|
||||
|
||||
$map_comp_status = {
|
||||
|
@ -62,7 +66,7 @@ $map_comp_status = {
|
|||
9 => 'nonFatalErr',
|
||||
10 => 'fatalErr',
|
||||
11 => 'notConfig',
|
||||
12 => 'obsoleted',
|
||||
12 => 'obsoleted'
|
||||
};
|
||||
|
||||
$map_led_status = {
|
||||
|
|
|
@ -23,15 +23,100 @@ package network::nortel::standard::snmp::mode::components::temperature;
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $mapping = {
|
||||
s5ChasTmpSnrTmpValue => { oid => '.1.3.6.1.4.1.45.1.6.3.7.1.1.5' },
|
||||
my $mapping_s5 = {
|
||||
value => { oid => '.1.3.6.1.4.1.45.1.6.3.7.1.1.5' } # s5ChasTmpSnrTmpValue
|
||||
};
|
||||
my $oid_s5ChasTmpSnrEntry = '.1.3.6.1.4.1.45.1.6.3.7.1.1';
|
||||
|
||||
my $mapping_voss = {
|
||||
description => { oid => '.1.3.6.1.4.1.2272.1.101.1.1.2.1.2' }, # rcVossSystemTemperatureSensorDescription
|
||||
value => { oid => '.1.3.6.1.4.1.2272.1.101.1.1.2.1.3' } # rcVossSystemTemperatureTemperature
|
||||
};
|
||||
my $oid_vossTempEntry = '.1.3.6.1.4.1.2272.1.101.1.1.2.1'; # rcVossSystemTemperatureEntry
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_s5ChasTmpSnrEntry };
|
||||
push @{$self->{request}},
|
||||
{ oid => $oid_s5ChasTmpSnrEntry, start => $mapping_s5->{value}->{oid}, end => $mapping_s5->{value}->{oid} },
|
||||
{ oid => $oid_vossTempEntry, start => $mapping_voss->{description}->{oid}, end => $mapping_voss->{value}->{oid} };
|
||||
}
|
||||
|
||||
sub check_s5 {
|
||||
my ($self) = @_;
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_s5ChasTmpSnrEntry}})) {
|
||||
next if ($oid !~ /^$mapping_s5->{value}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping_s5, results => $self->{results}->{$oid_s5ChasTmpSnrEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'temperature', instance => $instance));
|
||||
$self->{components}->{temperature}->{total}++;
|
||||
|
||||
$result->{s5ChasTmpSnrTmpValue} = sprintf("%.2f", $result->{value} / 2);
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"temperature '%s' is %s degree centigrade [instance: %s]",
|
||||
$instance, $result->{value}, $instance
|
||||
)
|
||||
);
|
||||
|
||||
my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{value});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf(
|
||||
"Temperature '%s' is %s degree centigrade", $instance, $result->{value}
|
||||
)
|
||||
);
|
||||
}
|
||||
$self->{output}->perfdata_add(
|
||||
nlabel => 'hardware.temperature.celsius',
|
||||
unit => 'C',
|
||||
instances => $instance,
|
||||
value => $result->{value},
|
||||
warning => $warn,
|
||||
critical => $crit
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
sub check_voss {
|
||||
my ($self) = @_;
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_vossTempEntry}})) {
|
||||
next if ($oid !~ /^$mapping_voss->{value}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping_voss, results => $self->{results}->{$oid_vossTempEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'temperature', instance => $instance));
|
||||
$self->{components}->{temperature}->{total}++;
|
||||
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"temperature '%s' is %s degree centigrade [instance: %s]",
|
||||
$result->{description}, $result->{value}, $instance
|
||||
)
|
||||
);
|
||||
|
||||
my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{value});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf(
|
||||
"Temperature '%s' is %s degree centigrade", $result->{description}, $result->{value}
|
||||
)
|
||||
);
|
||||
}
|
||||
$self->{output}->perfdata_add(
|
||||
nlabel => 'hardware.temperature.celsius',
|
||||
unit => 'C',
|
||||
instances => $result->{description},
|
||||
value => $result->{value},
|
||||
warning => $warn,
|
||||
critical => $crit
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
sub check {
|
||||
|
@ -41,33 +126,8 @@ sub check {
|
|||
$self->{components}->{temperature} = {name => 'temperatures', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'temperature'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_s5ChasTmpSnrEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{s5ChasTmpSnrTmpValue}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_s5ChasTmpSnrEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'temperature', instance => $instance));
|
||||
$self->{components}->{temperature}->{total}++;
|
||||
|
||||
$result->{s5ChasTmpSnrTmpValue} = sprintf("%.2f", $result->{s5ChasTmpSnrTmpValue} / 2);
|
||||
$self->{output}->output_add(long_msg => sprintf("temperature '%s' is %s degree centigrade [instance = %s]",
|
||||
$instance, $result->{s5ChasTmpSnrTmpValue}, $instance,
|
||||
));
|
||||
|
||||
my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{s5ChasTmpSnrTmpValue});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Temperature '%s' is %s degree centigrade", $result->{slHdwTempSensorName}, $result->{s5ChasTmpSnrTmpValue}));
|
||||
}
|
||||
$self->{output}->perfdata_add(
|
||||
label => 'temp', unit => 'C',
|
||||
nlabel => 'hardware.temperature.celsius',
|
||||
instances => $instance,
|
||||
value => $result->{s5ChasTmpSnrTmpValue},
|
||||
warning => $warn,
|
||||
critical => $crit,
|
||||
);
|
||||
}
|
||||
check_s5($self);
|
||||
check_voss($self);
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -25,6 +25,12 @@ use base qw(centreon::plugins::templates::counter);
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub prefix_cpu_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "CPU '" . $options{instance_value}->{num} . "' usage ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
@ -37,8 +43,7 @@ sub set_counters {
|
|||
key_values => [ { name => 'total' }, { name => 'num' } ],
|
||||
output_template => '%.2f %% (total)',
|
||||
perfdatas => [
|
||||
{ label => 'cpu_total', value => 'total', template => '%.2f',
|
||||
min => 0, max => 100, unit => '%', label_extra_instance => 1 }
|
||||
{ template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
|
@ -46,8 +51,7 @@ sub set_counters {
|
|||
key_values => [ { name => '1m' }, { name => 'num' } ],
|
||||
output_template => '%.2f %% (1min)',
|
||||
perfdatas => [
|
||||
{ label => 'cpu_1min', value => '1m', template => '%.2f',
|
||||
min => 0, max => 100, unit => '%', label_extra_instance => 1 }
|
||||
{ template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
|
@ -55,8 +59,7 @@ sub set_counters {
|
|||
key_values => [ { name => '5m' }, { name => 'num' } ],
|
||||
output_template => '%.2f %% (5min)',
|
||||
perfdatas => [
|
||||
{ label => 'cpu_5min', value => '5m', template => '%.2f',
|
||||
min => 0, max => 100, unit => '%', label_extra_instance => 1 }
|
||||
{ template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
|
@ -64,8 +67,7 @@ sub set_counters {
|
|||
key_values => [ { name => '10m' }, { name => 'num' } ],
|
||||
output_template => '%.2f %% (10min)',
|
||||
perfdatas => [
|
||||
{ label => 'cpu_10min', value => '10m', template => '%.2f',
|
||||
min => 0, max => 100, unit => '%', label_extra_instance => 1 }
|
||||
{ template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
|
@ -73,23 +75,16 @@ sub set_counters {
|
|||
key_values => [ { name => '1h' }, { name => 'num' } ],
|
||||
output_template => '%.2f %% (1h)',
|
||||
perfdatas => [
|
||||
{ label => 'cpu_1h', value => '1h', template => '%.2f',
|
||||
min => 0, max => 100, unit => '%', label_extra_instance => 1 }
|
||||
{ template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub prefix_cpu_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "CPU '" . $options{instance_value}->{num} . "' usage ";
|
||||
}
|
||||
|
||||
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 => {
|
||||
|
@ -146,7 +141,7 @@ sub manage_selection {
|
|||
next if ($oid !~ /^$mapping->{s5ChasUtilCPUUsageLast1Minute}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result->{$oid_s5ChasUtilEntry}, instance => $instance);
|
||||
|
||||
|
||||
$self->{cpu}->{$instance} = {
|
||||
num => $instance,
|
||||
total => $result->{s5ChasUtilTotalCPUUsage},
|
||||
|
|
|
@ -37,20 +37,21 @@ sub set_system {
|
|||
['up', 'OK'],
|
||||
['down', 'CRITICAL'],
|
||||
['unknown', 'UNKNOWN'],
|
||||
['notpresent', 'OK']
|
||||
],
|
||||
psu => [
|
||||
['up', 'OK'],
|
||||
['down', 'CRITICAL'],
|
||||
['unknown', 'UNKNOWN'],
|
||||
['empty', 'OK'],
|
||||
['empty', 'OK']
|
||||
],
|
||||
card => [
|
||||
['up', 'OK'],
|
||||
['down', 'CRITICAL'],
|
||||
['unknown', 'UNKNOWN'],
|
||||
['testing', 'OK'],
|
||||
['dormant', 'OK'],
|
||||
],
|
||||
['dormant', 'OK']
|
||||
],
|
||||
entity => [
|
||||
['other', 'UNKNOWN'],
|
||||
['notAvail', 'OK'],
|
||||
|
@ -63,7 +64,7 @@ sub set_system {
|
|||
['nonFatalErr', 'WARNING'],
|
||||
['fatalErr', 'CRITICAL'],
|
||||
['notConfig', 'OK'],
|
||||
['obsoleted', 'WARNING'],
|
||||
['obsoleted', 'WARNING']
|
||||
],
|
||||
led => [
|
||||
['unknown', 'UNKNOWN'],
|
||||
|
@ -75,9 +76,9 @@ sub set_system {
|
|||
['off', 'OK']
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
$self->{components_path} = 'network::nortel::standard::snmp::mode::components';
|
||||
$self->{components_module} = ['card', 'entity', 'fan', 'led', 'psu'];
|
||||
$self->{components_module} = ['card', 'entity', 'fan', 'led', 'psu', 'temperature'];
|
||||
}
|
||||
|
||||
sub snmp_execute {
|
||||
|
@ -89,7 +90,7 @@ sub snmp_execute {
|
|||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1);
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {});
|
||||
|
|
|
@ -38,6 +38,12 @@ sub custom_usage_output {
|
|||
);
|
||||
}
|
||||
|
||||
sub prefix_memory_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Memory '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
@ -73,19 +79,12 @@ sub set_counters {
|
|||
];
|
||||
}
|
||||
|
||||
sub prefix_memory_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Memory '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
});
|
||||
$options{options}->add_options(arguments => {});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue