enhance dell sseries (#2499)
This commit is contained in:
parent
590ad9d536
commit
96d28e0eb0
|
@ -23,60 +23,74 @@ package centreon::common::force10::snmp::mode::components::fan;
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %map_status = (
|
||||
my $map_status = {
|
||||
1 => 'up',
|
||||
2 => 'down',
|
||||
3 => 'absent',
|
||||
);
|
||||
3 => 'absent'
|
||||
};
|
||||
|
||||
my $mapping = {
|
||||
sseries => {
|
||||
OperStatus => { oid => '.1.3.6.1.4.1.6027.3.10.1.2.4.1.2', map => \%map_status },
|
||||
status => { oid => '.1.3.6.1.4.1.6027.3.10.1.2.4.1.2', map => $map_status } # chSysFanTrayOperStatus
|
||||
},
|
||||
mseries => {
|
||||
OperStatus => { oid => '.1.3.6.1.4.1.6027.3.19.1.2.3.1.2', map => \%map_status },
|
||||
status => { oid => '.1.3.6.1.4.1.6027.3.19.1.2.3.1.2', map => $map_status } # chSysFanTrayOperStatus
|
||||
},
|
||||
zseries => {
|
||||
OperStatus => { oid => '.1.3.6.1.4.1.6027.3.25.1.2.7.1.2', map => \%map_status },
|
||||
status => { oid => '.1.3.6.1.4.1.6027.3.25.1.2.7.1.2', map => $map_status } # chSysFanTrayOperStatus
|
||||
},
|
||||
os9 => {
|
||||
status => { oid => '.1.3.6.1.4.1.6027.3.26.1.4.7.1.4', map => $map_status } # dellNetFanTrayOperStatus
|
||||
}
|
||||
};
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $mapping->{sseries}->{OperStatus}->{oid} },
|
||||
{ oid => $mapping->{mseries}->{OperStatus}->{oid} }, { oid => $mapping->{zseries}->{OperStatus}->{oid} };
|
||||
|
||||
push @{$self->{request}},
|
||||
{ oid => $mapping->{sseries}->{status}->{oid} },
|
||||
{ oid => $mapping->{mseries}->{status}->{oid} },
|
||||
{ oid => $mapping->{zseries}->{status}->{oid} },
|
||||
{ oid => $mapping->{os9}->{status}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking fans");
|
||||
$self->{components}->{fan} = {name => 'fans', total => 0, skip => 0};
|
||||
|
||||
$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 $name (keys %{$mapping}) {
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping->{$name}->{OperStatus}->{oid}}})) {
|
||||
next if ($oid !~ /^$mapping->{$name}->{OperStatus}->{oid}\.(.*)$/);
|
||||
|
||||
foreach my $name (keys %$mapping) {
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{ $mapping->{$name}->{status}->{oid} }})) {
|
||||
next if ($oid !~ /^$mapping->{$name}->{status}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping->{$name}, results => $self->{results}->{$mapping->{$name}->{OperStatus}->{oid}}, instance => $instance);
|
||||
|
||||
next if ($result->{OperStatus} =~ /absent/i &&
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping->{$name}, results => $self->{results}->{ $mapping->{$name}->{status}->{oid} }, instance => $instance);
|
||||
|
||||
next if ($result->{status} =~ /absent/i &&
|
||||
$self->absent_problem(section => 'fan', 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]",
|
||||
$instance, $result->{OperStatus},
|
||||
$instance));
|
||||
my $exit = $self->get_severity(section => 'fan', value => $result->{OperStatus});
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"fan '%s' status is '%s' [instance: %s]",
|
||||
$instance, $result->{status},
|
||||
$instance
|
||||
)
|
||||
);
|
||||
my $exit = $self->get_severity(section => 'fan', 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->{OperStatus}));
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf(
|
||||
"Fan '%s' status is '%s'",
|
||||
$instance, $result->{status}
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
1;
|
||||
|
|
|
@ -23,68 +23,82 @@ package centreon::common::force10::snmp::mode::components::psu;
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %map_status = (
|
||||
my $map_status = {
|
||||
1 => 'up',
|
||||
2 => 'down',
|
||||
3 => 'absent',
|
||||
);
|
||||
my %map_mstatus = (
|
||||
3 => 'absent'
|
||||
};
|
||||
my $map_mstatus = {
|
||||
1 => 'normal',
|
||||
2 => 'warning',
|
||||
3 => 'critical',
|
||||
4 => 'shutdown',
|
||||
5 => 'notPresent',
|
||||
6 => 'notFunctioning',
|
||||
);
|
||||
6 => 'notFunctioning'
|
||||
};
|
||||
|
||||
my $mapping = {
|
||||
sseries => {
|
||||
OperStatus => { oid => '.1.3.6.1.4.1.6027.3.10.1.2.3.1.2', map => \%map_status },
|
||||
status => { oid => '.1.3.6.1.4.1.6027.3.10.1.2.3.1.2', map => $map_status } # chSysPowerSupplyOperStatus
|
||||
},
|
||||
mseries => {
|
||||
OperStatus => { oid => '.1.3.6.1.4.1.6027.3.19.1.2.2.1.2', map => \%map_mstatus },
|
||||
status => { oid => '.1.3.6.1.4.1.6027.3.19.1.2.2.1.2', map => $map_mstatus } # chSysPowerSupplyOperStatus
|
||||
},
|
||||
zseries => {
|
||||
OperStatus => { oid => '.1.3.6.1.4.1.6027.3.25.1.2.6.1.2', map => \%map_status },
|
||||
status => { oid => '.1.3.6.1.4.1.6027.3.25.1.2.6.1.2', map => $map_status } # chSysPowerSupplyOperStatus
|
||||
},
|
||||
os9 => {
|
||||
status => { oid => '.1.3.6.1.4.1.6027.3.26.1.4.6.1.4', map => $map_status } # dellNetPowerSupplyOperStatus
|
||||
}
|
||||
};
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $mapping->{sseries}->{OperStatus}->{oid} },
|
||||
{ oid => $mapping->{mseries}->{OperStatus}->{oid} }, { oid => $mapping->{zseries}->{OperStatus}->{oid} };
|
||||
|
||||
push @{$self->{request}},
|
||||
{ oid => $mapping->{sseries}->{status}->{oid} },
|
||||
{ oid => $mapping->{mseries}->{status}->{oid} },
|
||||
{ oid => $mapping->{zseries}->{status}->{oid} },
|
||||
{ oid => $mapping->{os9}->{status}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking power supplies");
|
||||
$self->{components}->{psu} = {name => 'power supplies', total => 0, skip => 0};
|
||||
|
||||
$self->{output}->output_add(long_msg => 'Checking power supplies');
|
||||
$self->{components}->{psu} = { name => 'power supplies', total => 0, skip => 0 };
|
||||
return if ($self->check_filter(section => 'psu'));
|
||||
|
||||
foreach my $name (keys %{$mapping}) {
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping->{$name}->{OperStatus}->{oid}}})) {
|
||||
next if ($oid !~ /^$mapping->{$name}->{OperStatus}->{oid}\.(.*)$/);
|
||||
|
||||
foreach my $name (keys %$mapping) {
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{ $mapping->{$name}->{status}->{oid} }})) {
|
||||
next if ($oid !~ /^$mapping->{$name}->{status}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping->{$name}, results => $self->{results}->{$mapping->{$name}->{OperStatus}->{oid}}, instance => $instance);
|
||||
|
||||
next if ($result->{OperStatus} =~ /absent|notPresent/i &&
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping->{$name}, results => $self->{results}->{ $mapping->{$name}->{status}->{oid} }, instance => $instance);
|
||||
|
||||
next if ($result->{status} =~ /absent|notPresent/i &&
|
||||
$self->absent_problem(section => 'psu', instance => $instance));
|
||||
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->{OperStatus},
|
||||
$instance));
|
||||
my $exit = $self->get_severity(section => 'psu', value => $result->{OperStatus});
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"power supply '%s' status is '%s' [instance: %s]",
|
||||
$instance, $result->{status},
|
||||
$instance
|
||||
)
|
||||
);
|
||||
my $exit = $self->get_severity(section => 'psu', value => $result->{status});
|
||||
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->{OperStatus}));
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf(
|
||||
"Power supply '%s' status is '%s'",
|
||||
$instance, $result->{status}
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
1;
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
#
|
||||
# Copyright 2020 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package centreon::common::force10::snmp::mode::components::stack;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $map_unit_status = {
|
||||
1 => 'ok', 2 => 'unsupported', 3 => 'codeMismatch', 4 => 'configMismatch',
|
||||
5 => 'unitDown', 6 => 'notPresent'
|
||||
};
|
||||
|
||||
my $mapping = {
|
||||
sseries => {
|
||||
status => { oid => '.1.3.6.1.4.1.6027.3.10.1.2.2.1.8', map => $map_unit_status }, # chStackUnitStatus
|
||||
temperature => { oid => '.1.3.6.1.4.1.6027.3.10.1.2.2.1.14' } # chStackUnitTemp
|
||||
},
|
||||
mseries => {
|
||||
status => { oid => '.1.3.6.1.4.1.6027.3.19.1.2.1.1.8', map => $map_unit_status }, # chStackUnitStatus
|
||||
temperature => { oid => '.1.3.6.1.4.1.6027.3.19.1.2.1.1.14' } # chStackUnitTemp
|
||||
},
|
||||
os9 => {
|
||||
status => { oid => '.1.3.6.1.4.1.6027.3.26.1.3.4.1.8', map => $map_unit_status }, # dellNetStackUnitStatus
|
||||
temperature => { oid => '.1.3.6.1.4.1.6027.3.26.1.3.4.1.13' } # dellNetStackUnitTemp
|
||||
}
|
||||
};
|
||||
my $stack_table = {
|
||||
sseries => '.1.3.6.1.4.1.6027.3.10.1.2.2.1',
|
||||
mseries => '.1.3.6.1.4.1.6027.3.19.1.2.1.1',
|
||||
os9 => '.1.3.6.1.4.1.6027.3.26.1.3.4.1'
|
||||
};
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}},
|
||||
{ oid => $stack_table->{sseries}, start => $mapping->{sseries}->{status}->{oid}, end => $mapping->{sseries}->{temperature}->{oid} },
|
||||
{ oid => $stack_table->{mseries}, start => $mapping->{mseries}->{status}->{oid}, end => $mapping->{mseries}->{temperature}->{oid} },
|
||||
{ oid => $stack_table->{os9}, start => $mapping->{os9}->{status}->{oid}, end => $mapping->{os9}->{temperature}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => 'Checking stack');
|
||||
$self->{components}->{stack} = { name => 'stack', total => 0, skip => 0 };
|
||||
return if ($self->check_filter(section => 'stack'));
|
||||
|
||||
foreach my $name (keys %$stack_table) {
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{ $stack_table->{$name} }})) {
|
||||
next if ($oid !~ /^$mapping->{$name}->{status}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping->{$name}, results => $self->{results}->{ $stack_table->{$name} }, instance => $instance);
|
||||
|
||||
next if ($result->{status} =~ /absent/i &&
|
||||
$self->absent_problem(section => 'stack', instance => $instance));
|
||||
next if ($self->check_filter(section => 'stack', instance => $instance));
|
||||
$self->{components}->{stack}->{total}++;
|
||||
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"stack '%s' status is '%s' [instance: %s, temperature: %s]",
|
||||
$instance,
|
||||
$result->{status},
|
||||
$instance,
|
||||
$result->{temperature}
|
||||
)
|
||||
);
|
||||
my $exit = $self->get_severity(section => 'stack', value => $result->{status});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf(
|
||||
"Stack '%s' status is '%s'",
|
||||
$instance, $result->{status}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => '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("stack '%s' temperature is %s C", $instance, $result->{temperature})
|
||||
);
|
||||
}
|
||||
$self->{output}->perfdata_add(
|
||||
nlabel => 'hardware.stack.temperature.celsius',
|
||||
unit => 'C',
|
||||
instances => $instance,
|
||||
value => $result->{temperature},
|
||||
warning => $warn,
|
||||
critical => $crit
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -1,80 +0,0 @@
|
|||
#
|
||||
# Copyright 2020 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package centreon::common::force10::snmp::mode::components::temperature;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $mapping = {
|
||||
sseries => {
|
||||
Temp => { oid => '.1.3.6.1.4.1.6027.3.10.1.2.2.1.14' },
|
||||
},
|
||||
mseries => {
|
||||
Temp => { oid => '.1.3.6.1.4.1.6027.3.19.1.2.1.1.14' },
|
||||
},
|
||||
};
|
||||
my $oid_deviceSensorValueEntry = '.1.3.6.1.4.1.3417.2.1.1.1.1.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $mapping->{sseries}->{Temp}->{oid} },
|
||||
{ oid => $mapping->{mseries}->{Temp}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking temperatures");
|
||||
$self->{components}->{temperature} = {name => 'temperatures', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'temperature'));
|
||||
|
||||
foreach my $name (keys %{$mapping}) {
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping->{$name}->{Temp}->{oid}}})) {
|
||||
next if ($oid !~ /^$mapping->{$name}->{Temp}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping->{$name}, results => $self->{results}->{$mapping->{$name}->{Temp}->{oid}}, 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 C [instance: %s]",
|
||||
$instance, $result->{Temp},
|
||||
$instance));
|
||||
|
||||
my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{Temp});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Temperature '%s' is %s C", $instance, $result->{Temp}));
|
||||
}
|
||||
$self->{output}->perfdata_add(
|
||||
label => 'temp', unit => 'C',
|
||||
nlabel => 'hardware.temperature.celsius',
|
||||
instances => $instance,
|
||||
value => $result->{Temp},
|
||||
warning => $warn,
|
||||
critical => $crit
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -25,41 +25,47 @@ use base qw(centreon::plugins::templates::counter);
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub prefix_cpu_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "CPU '" . $options{instance_value}->{display} . "' usage ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'cpu', type => 1, cb_prefix_output => 'prefix_cpu_output', message_multiple => 'All CPU usages are ok' }
|
||||
{ name => 'cpu', type => 1, cb_prefix_output => 'prefix_cpu_output', message_multiple => 'All CPU usages are ok', skipped_code => { -10 => 1 } }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{cpu} = [
|
||||
{ label => '5s', nlabel => 'cpu.utilization.5s.percentage', set => {
|
||||
key_values => [ { name => 'usage_5s' }, { name => 'display' } ],
|
||||
output_template => '%s %% (5sec)', output_error_template => "%s (5sec)",
|
||||
key_values => [ { name => 'cpu_5s' }, { name => 'display' } ],
|
||||
output_template => '%.2f %% (5s)',
|
||||
perfdatas => [
|
||||
{ label => 'cpu_5s', value => 'usage_5s', template => '%d',
|
||||
unit => '%', min => 0, max => 100, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ label => 'cpu_5s', template => '%.2f',
|
||||
unit => '%', min => 0, max => 100, label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => '1m', nlabel => 'cpu.utilization.1m.percentage', set => {
|
||||
key_values => [ { name => 'usage_1m' }, { name => 'display' } ],
|
||||
output_template => '%s %% (1m)', output_error_template => "%s (1min)",
|
||||
key_values => [ { name => 'cpu_1m' }, { name => 'display' } ],
|
||||
output_template => '%.2f %% (1m)',
|
||||
perfdatas => [
|
||||
{ label => 'cpu_1m', value => 'usage_1m', template => '%d',
|
||||
unit => '%', min => 0, max => 100, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ label => 'cpu_1m', template => '%.2f',
|
||||
unit => '%', min => 0, max => 100, label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => '5m', nlabel => 'cpu.utilization.5m.percentage', set => {
|
||||
key_values => [ { name => 'usage_5m' }, { name => 'display' } ],
|
||||
output_template => '%s %% (5min)', output_error_template => "%s (5min)",
|
||||
key_values => [ { name => 'cpu_5m' }, { name => 'display' } ],
|
||||
output_template => '%.2f %% (5m)',
|
||||
perfdatas => [
|
||||
{ label => 'cpu_5m', value => 'usage_5m', template => '%d',
|
||||
unit => '%', min => 0, max => 100, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ label => 'cpu_5m', template => '%.2f',
|
||||
unit => '%', min => 0, max => 100, label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -74,55 +80,91 @@ sub new {
|
|||
return $self;
|
||||
}
|
||||
|
||||
sub prefix_cpu_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "CPU '" . $options{instance_value}->{display} . "' Usage ";
|
||||
}
|
||||
|
||||
my $mapping = {
|
||||
sseries => {
|
||||
Util5Sec => { oid => '.1.3.6.1.4.1.6027.3.10.1.2.9.1.2' },
|
||||
Util1Min => { oid => '.1.3.6.1.4.1.6027.3.10.1.2.9.1.3' },
|
||||
Util5Min => { oid => '.1.3.6.1.4.1.6027.3.10.1.2.9.1.4' },
|
||||
cpu_5s => { oid => '.1.3.6.1.4.1.6027.3.10.1.2.9.1.2' }, # chStackUnitCpuUtil5Sec
|
||||
cpu_1m => { oid => '.1.3.6.1.4.1.6027.3.10.1.2.9.1.3' }, # chStackUnitCpuUtil1Min
|
||||
cpu_5m => { oid => '.1.3.6.1.4.1.6027.3.10.1.2.9.1.4' } # chStackUnitCpuUtil5Min
|
||||
},
|
||||
mseries => {
|
||||
Util5Sec => { oid => '.1.3.6.1.4.1.6027.3.19.1.2.8.1.2' },
|
||||
Util1Min => { oid => '.1.3.6.1.4.1.6027.3.19.1.2.8.1.3' },
|
||||
Util5Min => { oid => '.1.3.6.1.4.1.6027.3.19.1.2.8.1.4' },
|
||||
cpu_5s => { oid => '.1.3.6.1.4.1.6027.3.19.1.2.8.1.2' }, # chStackUnitCpuUtil5Sec
|
||||
cpu_1m => { oid => '.1.3.6.1.4.1.6027.3.19.1.2.8.1.3' }, # chStackUnitCpuUtil1Min
|
||||
cpu_5m => { oid => '.1.3.6.1.4.1.6027.3.19.1.2.8.1.4' } # chStackUnitCpuUtil5Min
|
||||
},
|
||||
zseries => {
|
||||
Util5Sec => { oid => '.1.3.6.1.4.1.6027.3.25.1.2.3.1.1' },
|
||||
Util1Min => { oid => '.1.3.6.1.4.1.6027.3.25.1.2.3.1.2' },
|
||||
Util5Min => { oid => '.1.3.6.1.4.1.6027.3.25.1.2.3.1.3' },
|
||||
cpu_5s => { oid => '.1.3.6.1.4.1.6027.3.25.1.2.3.1.1' }, # chSysCpuUtil5Sec
|
||||
cpu_1m => { oid => '.1.3.6.1.4.1.6027.3.25.1.2.3.1.2' }, # chSysCpuUtil1Min
|
||||
cpu_5m => { oid => '.1.3.6.1.4.1.6027.3.25.1.2.3.1.3' } # chSysCpuUtil5Min
|
||||
},
|
||||
os9 => {
|
||||
cpu_5s => { oid => '.1.3.6.1.4.1.6027.3.26.1.4.4.1.1' }, # dellNetCpuUtil5Sec
|
||||
cpu_1m => { oid => '.1.3.6.1.4.1.6027.3.26.1.4.4.1.4' }, # dellNetCpuUtil1Min
|
||||
cpu_5m => { oid => '.1.3.6.1.4.1.6027.3.26.1.4.4.1.5' } # dellNetCpuUtil5Min
|
||||
}
|
||||
};
|
||||
my $map_device_type = {
|
||||
1 => 'chassis', 2 => 'stack', 3 => 'rpm', 4 => 'supervisor', 5 => 'linecard', 6 => 'port-extender'
|
||||
};
|
||||
|
||||
sub load_series {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach my $oid (keys %{$options{snmp_result}}) {
|
||||
next if ($oid !~ /^$mapping->{ $options{name} }->{cpu_5m}->{oid}\.(.*)/);
|
||||
my $instance = $1;
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping->{ $options{name} }, results => $options{snmp_result}, instance => $instance);
|
||||
|
||||
$self->{cpu}->{$instance} = {
|
||||
display => $instance,
|
||||
%$result
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
sub load_os9 {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach my $oid (keys %{$options{snmp_result}}) {
|
||||
next if ($oid !~ /^$mapping->{ $options{name} }->{cpu_5m}->{oid}\.(\d+)\.(\d+)\.(\d+)/);
|
||||
my $name = $map_device_type->{$1} . ':' . $2 . ':' . $3;
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping->{ $options{name} }, results => $options{snmp_result}, instance => $1 . '.' . $2 . '.' . $3);
|
||||
|
||||
$self->{cpu}->{$name} = {
|
||||
display => $name,
|
||||
%$result
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $oids = { sseries => '.1.3.6.1.4.1.6027.3.10.1.2.9.1', mseries => '.1.3.6.1.4.1.6027.3.19.1.2.8.1', zseries => '.1.3.6.1.4.1.6027.3.25.1.2.3.1' };
|
||||
|
||||
my $oids = {
|
||||
sseries => { oid => '.1.3.6.1.4.1.6027.3.10.1.2.9.1', load => $self->can('load_series') },
|
||||
mseries => { oid => '.1.3.6.1.4.1.6027.3.19.1.2.8.1', load => $self->can('load_series') },
|
||||
zseries => { oid => '.1.3.6.1.4.1.6027.3.25.1.2.3.1', load => $self->can('load_series') },
|
||||
os9 => { oid => '.1.3.6.1.4.1.6027.3.26.1.4.4.1', load => $self->can('load_os9') }
|
||||
};
|
||||
my $snmp_result = $options{snmp}->get_multiple_table(
|
||||
oids => [ { oid => $oids->{sseries} }, { oid => $oids->{mseries} }, { oid => $oids->{zseries} } ],
|
||||
oids => [
|
||||
{ oid => $oids->{sseries}->{oid}, start => $mapping->{sseries}->{cpu_5s}->{oid}, end => $mapping->{sseries}->{cpu_5m}->{oid} },
|
||||
{ oid => $oids->{mseries}->{oid}, start => $mapping->{mseries}->{cpu_5s}->{oid}, end => $mapping->{mseries}->{cpu_5m}->{oid} },
|
||||
{ oid => $oids->{zseries}->{oid}, end => $mapping->{zseries}->{cpu_5m}->{oid} },
|
||||
{ oid => $oids->{os9}->{oid}, end => $mapping->{os9}->{cpu_5m}->{oid} }
|
||||
],
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{cpu} = {};
|
||||
foreach my $name (keys %{$oids}) {
|
||||
foreach my $oid (keys %{$snmp_result->{$oids->{$name}}}) {
|
||||
next if ($oid !~ /^$mapping->{$name}->{Util5Min}->{oid}\.(.*)/);
|
||||
my $instance = $1;
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping->{$name}, results => $snmp_result->{$oids->{$name}}, instance => $instance);
|
||||
|
||||
$self->{cpu}->{$instance} = {
|
||||
display => $instance,
|
||||
usage_5s => $result->{Util5Sec},
|
||||
usage_1m => $result->{Util1Min},
|
||||
usage_5m => $result->{Util5Min},
|
||||
};
|
||||
}
|
||||
foreach my $name (keys %$oids) {
|
||||
$oids->{$name}->{load}->(
|
||||
$self,
|
||||
name => $name,
|
||||
snmp => $options{snmp},
|
||||
snmp_result => $snmp_result->{ $oids->{$name}->{oid} }
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (scalar(keys %{$self->{cpu}}) <= 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "No entry found.");
|
||||
$self->{output}->option_exit();
|
||||
|
|
|
@ -27,16 +27,16 @@ use warnings;
|
|||
|
||||
sub set_system {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{regexp_threshold_numeric_check_section_option} = '^(temperature)$';
|
||||
|
||||
|
||||
$self->{regexp_threshold_numeric_check_section_option} = '^(?:temperature)$';
|
||||
|
||||
$self->{cb_hook2} = 'snmp_execute';
|
||||
|
||||
|
||||
$self->{thresholds} = {
|
||||
fan => [
|
||||
['up', 'OK'],
|
||||
['absent', 'OK'],
|
||||
['down', 'CRITICAL'],
|
||||
['down', 'CRITICAL']
|
||||
],
|
||||
psu => [
|
||||
['up', 'OK'],
|
||||
|
@ -48,12 +48,20 @@ sub set_system {
|
|||
['critical', 'CRITICAL'],
|
||||
['shutdown', 'CRITICAL'],
|
||||
['notPresent', 'OK'],
|
||||
['notFunctioning', 'CRITICAL'],
|
||||
['notFunctioning', 'CRITICAL']
|
||||
],
|
||||
stack => [
|
||||
['ok', 'OK'],
|
||||
['unsupported', 'CRITICAL'],
|
||||
['codeMismatch', 'CRITICAL'],
|
||||
['configMismatch', 'WARNING'],
|
||||
['unitDown', 'CRITICAL'],
|
||||
['notPresent', 'OK']
|
||||
]
|
||||
};
|
||||
|
||||
$self->{components_path} = 'centreon::common::force10::snmp::mode::components';
|
||||
$self->{components_module} = ['fan', 'psu', 'temperature'];
|
||||
$self->{components_module} = ['fan', 'psu', 'stack'];
|
||||
}
|
||||
|
||||
sub snmp_execute {
|
||||
|
@ -65,7 +73,7 @@ sub snmp_execute {
|
|||
|
||||
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 => {
|
||||
|
|
|
@ -25,6 +25,12 @@ use base qw(centreon::plugins::templates::counter);
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub prefix_memory_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Memory '" . $options{instance_value}->{display} . "' usage ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
@ -35,22 +41,16 @@ sub set_counters {
|
|||
$self->{maps_counters}->{memory} = [
|
||||
{ label => 'usage', nlabel => 'memory.usage.percentage', set => {
|
||||
key_values => [ { name => 'usage' }, { name => 'display' } ],
|
||||
output_template => '%s %%', output_error_template => "%s",
|
||||
output_template => '%.2f %%', output_error_template => "%s",
|
||||
perfdatas => [
|
||||
{ label => 'used', value => 'usage', template => '%d',
|
||||
unit => '%', min => 0, max => 100, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ label => 'used', template => '%.2f',
|
||||
unit => '%', min => 0, max => 100, label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub prefix_memory_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Memory '" . $options{instance_value}->{display} . "' Usage ";
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
|
@ -64,39 +64,81 @@ sub new {
|
|||
|
||||
my $mapping = {
|
||||
sseries => {
|
||||
MemUsageUtil => { oid => '.1.3.6.1.4.1.6027.3.10.1.2.9.1.5' },
|
||||
mem_used => { oid => '.1.3.6.1.4.1.6027.3.10.1.2.9.1.5' } # chStackUnitMemUsageUtil
|
||||
},
|
||||
mseries => {
|
||||
MemUsageUtil => { oid => '.1.3.6.1.4.1.6027.3.19.1.2.8.1.5' },
|
||||
mem_used => { oid => '.1.3.6.1.4.1.6027.3.19.1.2.8.1.5' } # chStackUnitMemUsageUtil
|
||||
},
|
||||
zseries => {
|
||||
MemUsageUtil => { oid => '.1.3.6.1.4.1.6027.3.25.1.2.3.1.4' },
|
||||
mem_used => { oid => '.1.3.6.1.4.1.6027.3.25.1.2.3.1.4' } # chSysCpuUtilMemUsage
|
||||
},
|
||||
os9 => {
|
||||
mem_used => { oid => '.1.3.6.1.4.1.6027.3.26.1.4.4.1.6' } # dellNetCpuUtilMemUsage
|
||||
}
|
||||
};
|
||||
my $map_device_type = {
|
||||
1 => 'chassis', 2 => 'stack', 3 => 'rpm', 4 => 'supervisor', 5 => 'linecard', 6 => 'port-extender'
|
||||
};
|
||||
|
||||
sub load_series {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach (keys %{$options{snmp_result}}) {
|
||||
/^$mapping->{ $options{name} }->{mem_used}->{oid}\.(.*)/;
|
||||
my $instance = $1;
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping->{ $options{name} }, results => $options{snmp_result}, instance => $instance);
|
||||
|
||||
$self->{memory}->{$instance} = {
|
||||
display => $instance,
|
||||
usage => $result->{mem_used}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
sub load_os9 {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach (keys %{$options{snmp_result}}) {
|
||||
/^$mapping->{ $options{name} }->{mem_used}->{oid}\.(\d+)\.(\d+)\.(\d+)/;
|
||||
my $name = $map_device_type->{$1} . ':' . $2 . ':' . $3;
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping->{ $options{name} }, results => $options{snmp_result}, instance => $1 . '.' . $2 . '.' . $3);
|
||||
|
||||
$self->{memory}->{$name} = {
|
||||
display => $name,
|
||||
usage => $result->{mem_used}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $oids = { sseries => '.1.3.6.1.4.1.6027.3.10.1.2.9.1', mseries => '.1.3.6.1.4.1.6027.3.19.1.2.8.1', zseries => '.1.3.6.1.4.1.6027.3.25.1.2.3.1' };
|
||||
|
||||
my $snmp_result = $options{snmp}->get_multiple_table(
|
||||
oids => [ { oid => $oids->{sseries} }, { oid => $oids->{mseries} }, { oid => $oids->{zseries} } ],
|
||||
oids => [
|
||||
{ oid => $mapping->{sseries}->{mem_used}->{oid} },
|
||||
{ oid => $mapping->{mseries}->{mem_used}->{oid} },
|
||||
{ oid => $mapping->{zseries}->{mem_used}->{oid} },
|
||||
{ oid => $mapping->{os9}->{mem_used}->{oid} }
|
||||
],
|
||||
nothing_quit => 1
|
||||
);
|
||||
my $cb_load = {
|
||||
sseries => $self->can('load_series'),
|
||||
mseries => $self->can('load_series'),
|
||||
zseries => $self->can('load_series'),
|
||||
os9 => $self->can('load_os9')
|
||||
};
|
||||
|
||||
$self->{memory} = {};
|
||||
foreach my $name (keys %{$oids}) {
|
||||
foreach my $oid (keys %{$snmp_result->{$oids->{$name}}}) {
|
||||
next if ($oid !~ /^$mapping->{$name}->{MemUsageUtil}->{oid}\.(.*)/);
|
||||
my $instance = $1;
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping->{$name}, results => $snmp_result->{$oids->{$name}}, instance => $instance);
|
||||
|
||||
$self->{memory}->{$instance} = {
|
||||
display => $instance,
|
||||
usage => $result->{MemUsageUtil},
|
||||
};
|
||||
}
|
||||
foreach my $name (keys %$mapping) {
|
||||
$cb_load->{$name}->(
|
||||
$self,
|
||||
name => $name,
|
||||
snmp => $options{snmp},
|
||||
snmp_result => $snmp_result->{ $mapping->{$name}->{mem_used}->{oid} }
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (scalar(keys %{$self->{memory}}) <= 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "No entry found.");
|
||||
$self->{output}->option_exit();
|
||||
|
|
Loading…
Reference in New Issue