mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-24 06:05:17 +02:00
add(plugin): lenovo rackswitch snmp
This commit is contained in:
parent
d95fd527fa
commit
30503882f2
116
centreon-plugins/network/lenovo/rackswitch/snmp/mode/cpu.pm
Normal file
116
centreon-plugins/network/lenovo/rackswitch/snmp/mode/cpu.pm
Normal file
@ -0,0 +1,116 @@
|
||||
#
|
||||
# Copyright 2021 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::rackswitch::snmp::mode::cpu;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use network::lenovo::rackswitch::snmp::mode::resources;
|
||||
|
||||
sub prefix_cpu_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return 'mp cpu average usage: ';
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'global', type => 0, cb_prefix_output => 'prefix_cpu_output' }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{global} = [
|
||||
{ label => 'cpu-utilization-5s', nlabel => 'cpu.utilization.5s.percentage', set => {
|
||||
key_values => [ { name => 'cpu5s' } ],
|
||||
output_template => '%.2f %% (5s)',
|
||||
perfdatas => [
|
||||
{ template => '%.2f', unit => '%', min => 0, max => 100 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'cpu-utilization-1m', nlabel => 'cpu.utilization.1m.percentage', set => {
|
||||
key_values => [ { name => 'cpu1m' } ],
|
||||
output_template => '%.2f %% (1m)',
|
||||
perfdatas => [
|
||||
{ template => '%.2f', unit => '%', min => 0, max => 100 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'cpu-utilization-5m', nlabel => 'cpu.utilization.5m.percentage', set => {
|
||||
key_values => [ { name => 'cpu5m' } ],
|
||||
output_template => '%.2f %% (5m)',
|
||||
perfdatas => [
|
||||
{ template => '%.2f', unit => '%', min => 0, max => 100 }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $branch = network::lenovo::rackswitch::snmp::mode::resources::find_rackswitch_branch(
|
||||
output => $self->{output}, snmp => $options{snmp}
|
||||
);
|
||||
my $oid_cpu5s = $branch . '.1.2.2.8.0'; # mpCpuStatsUtil5SecondsRev
|
||||
my $oid_cpu1m = $branch . '.1.2.2.9.0'; # mpCpuStatsUtil1MinuteRev
|
||||
my $oid_cpu5m = $branch . '.1.2.2.10.0'; # mpCpuStatsUtil5MinutesRev
|
||||
my $snmp_result = $options{snmp}->get_leef(
|
||||
oids => [$oid_cpu5s, $oid_cpu1m, $oid_cpu5m],
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{global} = {
|
||||
cpu5s => $snmp_result->{$oid_cpu5s},
|
||||
cpu1m => $snmp_result->{$oid_cpu1m},
|
||||
cpu5m => $snmp_result->{$oid_cpu5m}
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check management processor cpu.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Thresholds.
|
||||
Can be: 'cpu-utilization-5s', 'cpu-utilization-1m', 'cpu-utilization-5m'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
159
centreon-plugins/network/lenovo/rackswitch/snmp/mode/hardware.pm
Normal file
159
centreon-plugins/network/lenovo/rackswitch/snmp/mode/hardware.pm
Normal file
@ -0,0 +1,159 @@
|
||||
#
|
||||
# Copyright 2021 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::rackswitch::snmp::mode::hardware;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||
use network::lenovo::rackswitch::snmp::mode::resources;
|
||||
|
||||
sub prefix_sensor_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "sensor '" . $options{instance} . "' ";
|
||||
}
|
||||
|
||||
sub prefix_fan_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "fan '" . $options{instance} . "' ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'global', type => 0 },
|
||||
{ name => 'sensors', type => 1, cb_prefix_output => 'prefix_sensor_output', message_multiple => 'All sensors are ok', skipped_code => { -10 => 1 } },
|
||||
{ name => 'fans', type => 1, cb_prefix_output => 'prefix_fan_output', message_multiple => 'All fans are ok', skipped_code => { -10 => 1 } }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{global} = [
|
||||
{
|
||||
label => 'status',
|
||||
type => 2,
|
||||
warning_default => '%{status} eq "noncritical"',
|
||||
critical_default => '%{status} eq "critical"',
|
||||
set => {
|
||||
key_values => [ { name => 'status' } ],
|
||||
output_template => 'global health status: %s',
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{sensors} = [
|
||||
{ label => 'sensor-temperature', nlabel => 'hardware.sensor.temperature.celsius', set => {
|
||||
key_values => [ { name => 'temp' } ],
|
||||
output_template => 'temperature is %s C',
|
||||
perfdatas => [
|
||||
{ template => '%s', unit => 'C', label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{fans} = [
|
||||
{ label => 'fan-speed', nlabel => 'hardware.fan.speed.rpm', set => {
|
||||
key_values => [ { name => 'speed' } ],
|
||||
output_template => 'speed is %s rpm',
|
||||
perfdatas => [
|
||||
{ template => '%s', unit => 'rpm', min => 0, label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $map_status = {
|
||||
1 => 'ok', 2 => 'noncritical', 3 => 'critical'
|
||||
};
|
||||
|
||||
my $branch = network::lenovo::rackswitch::snmp::mode::resources::find_rackswitch_branch(
|
||||
output => $self->{output}, snmp => $options{snmp}
|
||||
);
|
||||
my $oid_fan_speed = $branch . '.1.3.1.13.0'; # hwFanSpeed
|
||||
my $oid_temp_sensors = $branch . '.1.3.1.14.0'; # hwTempSensors
|
||||
my $oid_health_status = $branch . '.1.3.1.15.0'; # hwGlobalHealthStatus
|
||||
my $snmp_result = $options{snmp}->get_leef(
|
||||
oids => [$oid_fan_speed, $oid_temp_sensors, $oid_health_status],
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{global} = { status => $map_status->{ $snmp_result->{$oid_health_status} } };
|
||||
$self->{sensors} = {};
|
||||
while ($snmp_result->{$oid_temp_sensors} =~ /Sensor\s+(\d+):\s*([0-9\.]+)/ig) {
|
||||
$self->{sensors}->{$1} = { temp => $2 };
|
||||
}
|
||||
|
||||
$self->{fans} = {};
|
||||
while ($snmp_result->{$oid_fan_speed} =~ /Fan\s+(\d+):\s*([0-9\.]+)\s*RPM/ig) {
|
||||
$self->{fans}->{$1} = { speed => $2 };
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check hardware.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--unknown-status>
|
||||
|
||||
Set unknown threshold for status.
|
||||
Can used special variables like: %{status}
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status (Default: '%{status} eq "noncritical"').
|
||||
Can used special variables like: %{status}
|
||||
|
||||
=item B<--critical-status>
|
||||
|
||||
Set critical threshold for status (Default: '%{status} eq "critical"').
|
||||
Can used special variables like: %{status}
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Thresholds.
|
||||
Can be: 'sensor-temperature', 'fan-speed'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
@ -0,0 +1,178 @@
|
||||
#
|
||||
# Copyright 2021 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::rackswitch::snmp::mode::interfaces;
|
||||
|
||||
use base qw(snmp_standard::mode::interfaces);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check interfaces.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--add-global>
|
||||
|
||||
Check global port statistics (By default if no --add-* option is set).
|
||||
|
||||
=item B<--add-status>
|
||||
|
||||
Check interface status.
|
||||
|
||||
=item B<--add-duplex-status>
|
||||
|
||||
Check duplex status (with --warning-status and --critical-status).
|
||||
|
||||
=item B<--add-traffic>
|
||||
|
||||
Check interface traffic.
|
||||
|
||||
=item B<--add-errors>
|
||||
|
||||
Check interface errors.
|
||||
|
||||
=item B<--add-cast>
|
||||
|
||||
Check interface cast.
|
||||
|
||||
=item B<--add-speed>
|
||||
|
||||
Check interface speed.
|
||||
|
||||
=item B<--add-volume>
|
||||
|
||||
Check interface data volume between two checks (not supposed to be graphed, useful for BI reporting).
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
Can used special variables like: %{admstatus}, %{opstatus}, %{duplexstatus}, %{display}
|
||||
|
||||
=item B<--critical-status>
|
||||
|
||||
Set critical threshold for status (Default: '%{admstatus} eq "up" and %{opstatus} ne "up"').
|
||||
Can used special variables like: %{admstatus}, %{opstatus}, %{duplexstatus}, %{display}
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Thresholds.
|
||||
Can be: 'total-port', 'total-admin-up', 'total-admin-down', 'total-oper-up', 'total-oper-down',
|
||||
'in-traffic', 'out-traffic', 'in-error', 'in-discard', 'out-error', 'out-discard',
|
||||
'in-ucast', 'in-bcast', 'in-mcast', 'out-ucast', 'out-bcast', 'out-mcast',
|
||||
'speed' (b/s).
|
||||
|
||||
=item B<--units-traffic>
|
||||
|
||||
Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta', 'bps', 'counter').
|
||||
|
||||
=item B<--units-errors>
|
||||
|
||||
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
|
||||
|
||||
=item B<--units-cast>
|
||||
|
||||
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
|
||||
|
||||
=item B<--nagvis-perfdata>
|
||||
|
||||
Display traffic perfdata to be compatible with nagvis widget.
|
||||
|
||||
=item B<--interface>
|
||||
|
||||
Set the interface (number expected) ex: 1,2,... (empty means 'check all interface').
|
||||
|
||||
=item B<--name>
|
||||
|
||||
Allows to use interface name with option --interface instead of interface oid index (Can be a regexp)
|
||||
|
||||
=item B<--speed>
|
||||
|
||||
Set interface speed for incoming/outgoing traffic (in Mb).
|
||||
|
||||
=item B<--speed-in>
|
||||
|
||||
Set interface speed for incoming traffic (in Mb).
|
||||
|
||||
=item B<--speed-out>
|
||||
|
||||
Set interface speed for outgoing traffic (in Mb).
|
||||
|
||||
=item B<--map-speed-dsl>
|
||||
|
||||
Get interface speed configuration for interface type 'adsl' and 'vdsl2'.
|
||||
|
||||
Syntax: --map-speed-dsl=interface-src-name,interface-dsl-name
|
||||
|
||||
E.g: --map-speed-dsl=Et0.835,Et0-vdsl2
|
||||
|
||||
=item B<--force-counters64>
|
||||
|
||||
Force to use 64 bits counters only. Can be used to improve performance.
|
||||
|
||||
=item B<--force-counters32>
|
||||
|
||||
Force to use 32 bits counters (even in snmp v2c and v3). Should be used when 64 bits counters are buggy.
|
||||
|
||||
=item B<--reload-cache-time>
|
||||
|
||||
Time in minutes before reloading cache file (default: 180).
|
||||
|
||||
=item B<--oid-filter>
|
||||
|
||||
Choose OID used to filter interface (default: ifName) (values: ifDesc, ifAlias, ifName, IpAddr).
|
||||
|
||||
=item B<--oid-display>
|
||||
|
||||
Choose OID used to display interface (default: ifName) (values: ifDesc, ifAlias, ifName, IpAddr).
|
||||
|
||||
=item B<--oid-extra-display>
|
||||
|
||||
Add an OID to display.
|
||||
|
||||
=item B<--display-transform-src>
|
||||
|
||||
Regexp src to transform display value.
|
||||
|
||||
=item B<--display-transform-dst>
|
||||
|
||||
Regexp dst to transform display value.
|
||||
|
||||
=item B<--show-cache>
|
||||
|
||||
Display cache interface datas.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
129
centreon-plugins/network/lenovo/rackswitch/snmp/mode/memory.pm
Normal file
129
centreon-plugins/network/lenovo/rackswitch/snmp/mode/memory.pm
Normal file
@ -0,0 +1,129 @@
|
||||
#
|
||||
# Copyright 2021 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::rackswitch::snmp::mode::memory;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use network::lenovo::rackswitch::snmp::mode::resources;
|
||||
|
||||
sub custom_usage_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf(
|
||||
'Memory total: %s %s used: %s %s (%.2f%%) free: %s %s (%.2f%%)',
|
||||
$self->{perfdata}->change_bytes(value => $self->{result_values}->{total}),
|
||||
$self->{perfdata}->change_bytes(value => $self->{result_values}->{used}),
|
||||
$self->{result_values}->{prct_used},
|
||||
$self->{perfdata}->change_bytes(value => $self->{result_values}->{free}),
|
||||
$self->{result_values}->{prct_free}
|
||||
);
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'ram', type => 0, skipped_code => { -10 => 1 } }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{ram} = [
|
||||
{ label => 'usage', nlabel => 'memory.usage.bytes', set => {
|
||||
key_values => [ { name => 'used' }, { name => 'free' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' } ],
|
||||
closure_custom_output => $self->can('custom_usage_output'),
|
||||
perfdatas => [
|
||||
{ template => '%d', min => 0, max => 'total', unit => 'B', cast_int => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ 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 => [
|
||||
{ template => '%d', min => 0, max => 'total', unit => 'B', cast_int => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'usage-prct', display_ok => 0, nlabel => 'memory.usage.percentage', set => {
|
||||
key_values => [ { name => 'prct_used' }, { name => 'used' }, { name => 'free' }, { name => 'prct_free' }, { name => 'total' } ],
|
||||
closure_custom_output => $self->can('custom_usage_output'),
|
||||
perfdatas => [
|
||||
{ template => '%.2f', min => 0, max => 100, unit => '%' }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
if ($options{snmp}->is_snmpv1()) {
|
||||
$self->{output}->add_option_msg(short_msg => 'Need to use SNMP v2c or v3.');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
my $branch = network::lenovo::rackswitch::snmp::mode::resources::find_rackswitch_branch(
|
||||
output => $self->{output}, snmp => $options{snmp}
|
||||
);
|
||||
my $oid_total = $branch . '.1.2.12.1.0'; # totalMemoryStats
|
||||
my $oid_free = $branch . '.1.2.12.2.0'; # memoryFreeStats
|
||||
my $snmp_result = $options{snmp}->get_leef(
|
||||
oids => [ $oid_total, $oid_free ],
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{ram} = {
|
||||
total => $snmp_result->{$oid_total},
|
||||
used => $snmp_result->{$oid_total} - $snmp_result->{$oid_free},
|
||||
free => $snmp_result->{$oid_free},
|
||||
prct_used => 100 - ($snmp_result->{$oid_free} * 100 / $snmp_result->{$oid_total}),
|
||||
prct_free => $snmp_result->{$oid_free} * 100 / $snmp_result->{$oid_total}
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check memory.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Thresholds.
|
||||
Can be: 'usage' (B), 'usage-free' (B), 'usage-prct' (%).
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
@ -0,0 +1,61 @@
|
||||
#
|
||||
# Copyright 2021 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::rackswitch::snmp::mode::resources;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Exporter;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT_OK = qw(find_rackswitch_branch);
|
||||
|
||||
my $branches = {
|
||||
'g8124' => '.1.3.6.1.4.1.26543.2.7.4',
|
||||
'g7028' => '.1.3.6.1.4.1.20301.2.7.17',
|
||||
'g7052' => '.1.3.6.1.4.1.20301.2.7.18',
|
||||
'g8052' => '.1.3.6.1.4.1.26543.2.7.7',
|
||||
'g8264cs' => '.1.3.6.1.4.1.20301.2.7.15',
|
||||
# g8264cs_sif not same oids
|
||||
'g8254' => '.1.3.6.1.4.1.26543.2.7.6', # there is some extra stack OIDs
|
||||
'g8272' => '.1.3.6.1.4.1.19046.2.7.24',
|
||||
'g8296' => '.1.3.6.1.4.1.19046.2.7.22',
|
||||
'g8332' => '.1.3.6.1.4.1.20301.2.7.16'
|
||||
|
||||
};
|
||||
|
||||
sub find_rackswitch_branch {
|
||||
my (%options) = @_;
|
||||
|
||||
my $oid_software = '1.1.1.10.0';
|
||||
my $snmp_result = $options{snmp}->get_leef(
|
||||
oids => [ map($_ . '.' . $oid_software, values(%$branches)) ]
|
||||
);
|
||||
foreach (keys %$snmp_result) {
|
||||
return $1 if (defined($snmp_result->{$_}) && /^(.*)\.$oid_software/);
|
||||
}
|
||||
|
||||
$options{output}->add_option_msg(short_msg => 'unsupported device');
|
||||
$options{output}->option_exit();
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
@ -0,0 +1,77 @@
|
||||
#
|
||||
# Copyright 2021 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::rackswitch::snmp::mode::uptime;
|
||||
|
||||
use base qw(snmp_standard::mode::uptime);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check system uptime.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-uptime>
|
||||
|
||||
Threshold warning.
|
||||
|
||||
=item B<--critical-uptime>
|
||||
|
||||
Threshold critical.
|
||||
|
||||
=item B<--add-sysdesc>
|
||||
|
||||
Display system description.
|
||||
|
||||
=item B<--force-oid>
|
||||
|
||||
Can choose your oid (numeric format only).
|
||||
|
||||
=item B<--check-overload>
|
||||
|
||||
Uptime counter limit is 4294967296 and overflow.
|
||||
With that option, we manage the counter going back. But there is a few chance we can miss a reboot.
|
||||
|
||||
=item B<--reboot-window>
|
||||
|
||||
To be used with check-overload option. Time in milliseconds (Default: 5000)
|
||||
You increase the chance of not missing a reboot if you decrease that value.
|
||||
|
||||
=item B<--unit>
|
||||
|
||||
Select the unit for performance data and thresholds. May be 's' for seconds, 'm' for minutes,
|
||||
'h' for hours, 'd' for days, 'w' for weeks. Default is seconds
|
||||
|
||||
=back
|
52
centreon-plugins/network/lenovo/rackswitch/snmp/plugin.pm
Normal file
52
centreon-plugins/network/lenovo/rackswitch/snmp/plugin.pm
Normal file
@ -0,0 +1,52 @@
|
||||
#
|
||||
# Copyright 2021 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::rackswitch::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->{modes} = {
|
||||
'cpu' => 'network::lenovo::rackswitch::snmp::mode::cpu',
|
||||
'hardware' => 'network::lenovo::rackswitch::snmp::mode::hardware',
|
||||
'interfaces' => 'network::lenovo::rackswitch::snmp::mode::interfaces',
|
||||
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
||||
'memory' => 'network::lenovo::rackswitch::snmp::mode::memory',
|
||||
'uptime' => 'network::lenovo::rackswitch::snmp::mode::uptime'
|
||||
};
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check Lenovo Rackswitch in SNMP.
|
||||
|
||||
=cut
|
Loading…
x
Reference in New Issue
Block a user