network::lenovo::flexsystem new plugin
This commit is contained in:
parent
69817df147
commit
ee2d590e43
|
@ -0,0 +1,66 @@
|
|||
#
|
||||
# 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 network::lenovo::flexsystem::snmp::mode::components::faultled;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %map_faultled_states = ( 1 => 'on', 2 => 'off' );
|
||||
|
||||
sub load {}
|
||||
|
||||
sub check_faultled {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{components}->{faultled}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg =>
|
||||
sprintf(
|
||||
"Fault LED state is %s",
|
||||
$options{value}
|
||||
)
|
||||
);
|
||||
my $exit = $self->get_severity(section => 'faultled', value => $options{value});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf(
|
||||
"Fault LED state is %s",
|
||||
$options{value}
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking fault LED");
|
||||
$self->{components}->{faultled} = { name => 'faultled', total => 0, skip => 0 };
|
||||
return if ($self->check_filter(section => 'faultled'));
|
||||
|
||||
my $oid_mmspFaultLED = '.1.3.6.1.4.1.20301.2.5.1.3.10.12.0';
|
||||
my $results = $self->{snmp}->get_leef(oids => [$oid_mmspFaultLED], nothing_quit => 1);
|
||||
|
||||
check_faultled($self, value => $map_faultled_states{$results->{$oid_mmspFaultLED}});
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,86 @@
|
|||
#
|
||||
# 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 network::lenovo::flexsystem::snmp::mode::components::temperature;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub load {}
|
||||
|
||||
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'));
|
||||
|
||||
my $oid_hwTemperatureWarn = '.1.3.6.1.4.1.20301.2.5.1.3.1.22.0';
|
||||
my $oid_hwTemperatureShut = '.1.3.6.1.4.1.20301.2.5.1.3.1.23.0';
|
||||
my $results = $self->{snmp}->get_leef(oids => [$oid_hwTemperatureWarn, $oid_hwTemperatureShut], nothing_quit => 1);
|
||||
|
||||
# .1.3.6.1.4.1.20301.2.5.1.3.1.41.1.1.20.1 = STRING: "44 C (Warning at 66 C / Recover at 61 C)"
|
||||
# .1.3.6.1.4.1.20301.2.5.1.3.1.41.1.1.21.1 = STRING: "44 C (Shutdown at 72 C / Recover at 67 C)"
|
||||
$results->{$oid_hwTemperatureWarn} =~ /^([.0-9]+)\s*C\s*\(Warn(?:ing)?\s*at\s*([.0-9]+)\s*C/i;
|
||||
my $temperature = $1;
|
||||
my $warning = $2;
|
||||
$results->{$oid_hwTemperatureShut} =~ /^([.0-9]+)\s*C\s*\(Shutdown\s*at\s*([.0-9]+)\s*C/i;
|
||||
if ($1 > $temperature) {
|
||||
$temperature = $1;
|
||||
}
|
||||
my $critical = ($warning + $2) / 2;
|
||||
|
||||
$self->{components}->{temperature}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg =>
|
||||
sprintf(
|
||||
"Temperature is %.1f C",
|
||||
$temperature
|
||||
)
|
||||
);
|
||||
|
||||
my $exit = 'OK';
|
||||
if ($temperature >= $warning) {
|
||||
$exit = 'WARNING';
|
||||
}
|
||||
if ($temperature >= $critical) {
|
||||
$exit = 'CRITICAL';
|
||||
}
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf(
|
||||
"Temperature is %.1f C",
|
||||
$temperature
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$self->{output}->perfdata_add(
|
||||
label => 'temperature', unit => 'C',
|
||||
nlabel => 'hardware.temperature.celsius',
|
||||
instances => 'system',
|
||||
value => $temperature,
|
||||
warning => $warning,
|
||||
critical => $critical
|
||||
);
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,127 @@
|
|||
#
|
||||
# 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 network::lenovo::flexsystem::snmp::mode::cpu;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'cpu', type => 1, cb_prefix_output => 'prefix_message_output', message_multiple => 'All CPU usages are ok' },
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{cpu} = [
|
||||
{ label => 'average', nlabel => 'cpu.utilization.percentage', set => {
|
||||
key_values => [ { name => 'average' }, { name => 'display' } ],
|
||||
output_template => '%.2f %%',
|
||||
perfdatas => [
|
||||
{ label => 'total_cpu_avg', value => 'average_absolute', template => '%.2f',
|
||||
min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||
],
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
sub prefix_message_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Switch '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter:s' => { name => 'filter', default => '.*' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $oid_mpCpuSwitchNumberRev = '.1.3.6.1.4.1.20301.2.5.1.2.2.12.1.1.1';
|
||||
my $oid_mpCpuStatsUtil1MinuteSwRev = '.1.3.6.1.4.1.20301.2.5.1.2.2.12.1.1.5';
|
||||
|
||||
my $result = $options{snmp}->get_table(oid => $oid_mpCpuSwitchNumberRev, nothing_quit => 1);
|
||||
my @instance_oids = ();
|
||||
foreach my $oid (keys %$result) {
|
||||
if ($result->{$oid} =~ /$self->{option_results}->{filter}/i) {
|
||||
push @instance_oids, $oid;
|
||||
}
|
||||
}
|
||||
|
||||
if (scalar(@instance_oids) == 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "Cannot find switch number '$self->{option_results}->{filter}'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$options{snmp}->load(
|
||||
oids => [$oid_mpCpuStatsUtil1MinuteSwRev],
|
||||
instances => \@instance_oids,
|
||||
instance_regexp => "^" . $oid_mpCpuSwitchNumberRev . '\.(.+)'
|
||||
);
|
||||
my $result2 = $options{snmp}->get_leef();
|
||||
|
||||
foreach my $instance (@instance_oids) {
|
||||
$instance =~ /^$oid_mpCpuSwitchNumberRev\.(.+)/;
|
||||
$instance = $1;
|
||||
|
||||
$self->{cpu}->{$instance} = {
|
||||
display => $result->{$oid_mpCpuSwitchNumberRev . '.' . $instance},
|
||||
average => $result2->{$oid_mpCpuStatsUtil1MinuteSwRev . '.' . $instance},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check CPU usage (over the last minute).
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter>
|
||||
|
||||
Filter switch number (Default: '.*').
|
||||
|
||||
=item B<--warning-average>
|
||||
|
||||
Warning threshold average CPU utilization.
|
||||
|
||||
=item B<--critical-average>
|
||||
|
||||
Critical threshold average CPU utilization.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,104 @@
|
|||
#
|
||||
# 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 network::lenovo::flexsystem::snmp::mode::disk;
|
||||
|
||||
use base qw(snmp_standard::mode::storage);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub default_storage_type {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return '^(?!(hrStorageRam)$)';
|
||||
}
|
||||
|
||||
sub prefix_storage_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Disk '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check disk.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-usage>
|
||||
|
||||
Threshold warning.
|
||||
|
||||
=item B<--critical-usage>
|
||||
|
||||
Threshold critical.
|
||||
|
||||
=item B<--units>
|
||||
|
||||
Units of thresholds (Default: '%') ('%', 'B').
|
||||
|
||||
=item B<--free>
|
||||
|
||||
Thresholds are on free space left.
|
||||
|
||||
=item B<--storage>
|
||||
|
||||
Set the storage (number expected) ex: 1, 2,... (empty means 'check all storage').
|
||||
|
||||
=item B<--name>
|
||||
|
||||
Allows to use storage name with option --storage instead of storage oid index.
|
||||
|
||||
=item B<--regexp>
|
||||
|
||||
Allows to use regexp to filter storage (with option --name).
|
||||
|
||||
=item B<--regexp-isensitive>
|
||||
|
||||
Allows to use regexp non case-sensitive (with --regexp).
|
||||
|
||||
=item B<--reload-cache-time>
|
||||
|
||||
Time in minutes before reloading cache file (default: 180).
|
||||
|
||||
=item B<--show-cache>
|
||||
|
||||
Display cache storage datas.
|
||||
|
||||
=item B<--filter-storage-type>
|
||||
|
||||
Filter storage types with a regexp (Default: '^(?!(hrStorageRam)$)').
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,84 @@
|
|||
#
|
||||
# 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 network::lenovo::flexsystem::snmp::mode::environment;
|
||||
|
||||
use base qw(centreon::plugins::templates::hardware);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub set_system {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{regexp_threshold_overload_check_section_option} = '^(faultled|temperature)$';
|
||||
|
||||
$self->{cb_hook2} = 'snmp_execute';
|
||||
$self->{thresholds} = {
|
||||
'faultled' => [
|
||||
['on', 'CRITICAL'],
|
||||
['off', 'OK'],
|
||||
],
|
||||
};
|
||||
|
||||
$self->{components_path} = 'network::lenovo::flexsystem::snmp::mode::components';
|
||||
$self->{components_module} = ['faultled', 'temperature'];
|
||||
}
|
||||
|
||||
sub snmp_execute {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{snmp} = $options{snmp};
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check hardware.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--component>
|
||||
|
||||
Which component to check (Default: '.*').
|
||||
Can be: 'faultled', 'temperature'.
|
||||
|
||||
=item B<--no-component>
|
||||
|
||||
Return an error if no compenents are checked.
|
||||
If total (with skipped) is 0. (Default: 'critical' returns).
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,163 @@
|
|||
#
|
||||
# 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 network::lenovo::flexsystem::snmp::mode::memory;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub custom_usage_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf(
|
||||
'Ram Total: %s %s Used: %s %s (%.2f%%) Free: %s %s (%.2f%%)',
|
||||
$self->{perfdata}->change_bytes(value => $self->{result_values}->{total_absolute}),
|
||||
$self->{perfdata}->change_bytes(value => $self->{result_values}->{used_absolute}),
|
||||
$self->{result_values}->{prct_used_absolute},
|
||||
$self->{perfdata}->change_bytes(value => $self->{result_values}->{free_absolute}),
|
||||
$self->{result_values}->{prct_free_absolute}
|
||||
);
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'memory', type => 1, cb_prefix_output => 'prefix_message_output', message_multiple => 'All memory usages are ok' },
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{memory} = [
|
||||
{ label => 'usage', nlabel => 'memory.usage.bytes', set => {
|
||||
key_values => [ { name => 'used' }, { name => 'free' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' }, { name => 'display' } ],
|
||||
closure_custom_output => $self->can('custom_usage_output'),
|
||||
perfdatas => [
|
||||
{ label => 'used', value => 'used_absolute', template => '%d', min => 0, max => 'total_absolute',
|
||||
unit => 'B', cast_int => 1, label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'usage-free', display_ok => 0, nlabel => 'memory.free.bytes', set => {
|
||||
key_values => [ { name => 'free' }, { name => 'used' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' } ],
|
||||
closure_custom_output => $self->can('custom_usage_output'),
|
||||
perfdatas => [
|
||||
{ label => 'free', value => 'free_absolute', template => '%d', min => 0, max => 'total_absolute',
|
||||
unit => 'B', cast_int => 1, label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'usage-prct', display_ok => 0, nlabel => 'memory.usage.percentage', set => {
|
||||
key_values => [ { name => 'prct_used' } ],
|
||||
output_template => 'Used : %.2f %%',
|
||||
perfdatas => [
|
||||
{ label => 'used_prct', value => 'prct_used_absolute', template => '%.2f', min => 0, max => 100,
|
||||
unit => '%', label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||
],
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
sub prefix_message_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Switch '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter:s' => { name => 'filter', default => '.*' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $oid_switchNumber = '.1.3.6.1.4.1.20301.2.5.1.2.12.9.1.1.1';
|
||||
my $oid_totalMemoryStatsRev = '.1.3.6.1.4.1.20301.2.5.1.2.12.9.1.1.3'; # in bytes
|
||||
my $oid_memoryFreeStatsRev = '.1.3.6.1.4.1.20301.2.5.1.2.12.9.1.1.4'; # in bytes
|
||||
|
||||
my $result = $options{snmp}->get_table(oid => $oid_switchNumber, nothing_quit => 1);
|
||||
my @instance_oids = ();
|
||||
foreach my $oid (keys %$result) {
|
||||
if ($result->{$oid} =~ /$self->{option_results}->{filter}/i) {
|
||||
push @instance_oids, $oid;
|
||||
}
|
||||
}
|
||||
|
||||
if (scalar(@instance_oids) == 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "Cannot find switch number '$self->{option_results}->{filter}'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$options{snmp}->load(
|
||||
oids => [$oid_totalMemoryStatsRev, $oid_memoryFreeStatsRev],
|
||||
instances => \@instance_oids,
|
||||
instance_regexp => "^" . $oid_switchNumber . '\.(.+)'
|
||||
);
|
||||
my $result2 = $options{snmp}->get_leef();
|
||||
|
||||
foreach my $instance (@instance_oids) {
|
||||
$instance =~ /^$oid_switchNumber\.(.+)/;
|
||||
$instance = $1;
|
||||
|
||||
my $free = $result2->{$oid_memoryFreeStatsRev . '.' . $instance};
|
||||
my $total = $result2->{$oid_totalMemoryStatsRev . '.' . $instance};
|
||||
my $prct_used = ($total - $free) * 100 / $total;
|
||||
$self->{memory}->{$instance} = {
|
||||
display => $result->{$oid_switchNumber . '.' . $instance},
|
||||
total => $total,
|
||||
used => $total - $free,
|
||||
free => $free,
|
||||
prct_used => $prct_used,
|
||||
prct_free => 100 - $prct_used,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check memory usage.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter>
|
||||
|
||||
Filter switch number (Default: '.*').
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Thresholds.
|
||||
Can be: 'usage' (B), 'usage-free' (B), 'usage-prct' (%).
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,55 @@
|
|||
#
|
||||
# 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 network::lenovo::flexsystem::snmp::plugin;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use base qw(centreon::plugins::script_snmp);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
%{$self->{modes}} = (
|
||||
'cpu' => 'network::lenovo::flexsystem::snmp::mode::cpu',
|
||||
'disk' => 'network::lenovo::flexsystem::snmp::mode::disk',
|
||||
'environment' => 'network::lenovo::flexsystem::snmp::mode::environment',
|
||||
'interfaces' => 'snmp_standard::mode::interfaces',
|
||||
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
||||
'memory' => 'network::lenovo::flexsystem::snmp::mode::memory',
|
||||
'time' => 'snmp_standard::mode::ntp',
|
||||
'uptime' => 'snmp_standard::mode::uptime',
|
||||
);
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check Lenovo Flex System switches in SNMP.
|
||||
|
||||
=cut
|
Loading…
Reference in New Issue