diff --git a/centreon-plugins/centreon/common/dell/fastpath/snmp/mode/components/fan.pm b/centreon-plugins/centreon/common/dell/fastpath/snmp/mode/components/fan.pm index 1a3e5311e..b1ebe826e 100644 --- a/centreon-plugins/centreon/common/dell/fastpath/snmp/mode/components/fan.pm +++ b/centreon-plugins/centreon/common/dell/fastpath/snmp/mode/components/fan.pm @@ -30,18 +30,18 @@ my %map_fan_status = ( 4 => 'powering', 5 => 'nopower', 6 => 'notpowering', - 7 => 'incompatible', + 7 => 'incompatible' ); my $mapping = { boxServicesFanItemState => { oid => '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.6.1.3', map => \%map_fan_status }, - boxServicesFanSpeed => { oid => '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.6.1.4' }, + boxServicesFanSpeed => { oid => '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.6.1.4' } }; my $oid_boxServicesFansEntry = '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.6.1'; sub load { my ($self) = @_; - + push @{$self->{request}}, { oid => $oid_boxServicesFansEntry, start => $mapping->{boxServicesFanItemState}->{oid} }; } @@ -57,31 +57,39 @@ sub check { next if ($oid !~ /^$mapping->{boxServicesFanItemState}->{oid}\.(.*)$/); my $instance = $1; my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_boxServicesFansEntry}, instance => $instance); - + next if ($self->check_filter(section => 'fan', instance => $instance)); if ($result->{boxServicesFanItemState} =~ /notPresent/i) { $self->absent_problem(section => 'fan', instance => $instance); next; } - + $self->{components}->{fan}->{total}++; - $self->{output}->output_add(long_msg => sprintf("fan '%s' status is '%s' [instance = %s, speed = %s]", - $instance, $result->{boxServicesFanItemState}, $instance, defined($result->{boxServicesFanSpeed}) ? $result->{boxServicesFanSpeed} : 'unknown')); + $self->{output}->output_add( + long_msg => sprintf( + "fan '%s' status is '%s' [instance = %s, speed = %s]", + $instance, $result->{boxServicesFanItemState}, $instance, defined($result->{boxServicesFanSpeed}) ? $result->{boxServicesFanSpeed} : 'unknown' + ) + ); $exit = $self->get_severity(label => 'default', section => 'fan', value => $result->{boxServicesFanItemState}); 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->{boxServicesFanItemState})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Fan '%s' status is '%s'", $instance, $result->{boxServicesFanItemState}) + ); next; } - + ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'fan', instance => $instance, value => $result->{boxServicesFanSpeed}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Fan '%s' is '%s' rpm", $instance, $result->{boxServicesFanSpeed})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Fan '%s' is '%s' rpm", $instance, $result->{boxServicesFanSpeed}) + ); } $self->{output}->perfdata_add( - label => 'fan', unit => 'rpm', nlabel => 'hardware.fan.speed.rpm', + unit => 'rpm', instances => $instance, value => $result->{boxServicesFanSpeed}, warning => $warn, diff --git a/centreon-plugins/centreon/common/dell/fastpath/snmp/mode/components/psu.pm b/centreon-plugins/centreon/common/dell/fastpath/snmp/mode/components/psu.pm index 6741ce38d..ccf189ec8 100644 --- a/centreon-plugins/centreon/common/dell/fastpath/snmp/mode/components/psu.pm +++ b/centreon-plugins/centreon/common/dell/fastpath/snmp/mode/components/psu.pm @@ -30,11 +30,11 @@ my %map_status = ( 4 => 'powering', 5 => 'nopower', 6 => 'notpowering', - 7 => 'incompatible', + 7 => 'incompatible' ); my $mapping = { - boxServicesPowSupplyItemState => { oid => '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.7.1.3', map => \%map_status }, + boxServicesPowSupplyItemState => { oid => '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.7.1.3', map => \%map_status } }; my $oid_boxServicesPowSuppliesEntry = '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.7.1'; @@ -62,15 +62,20 @@ sub check { $self->absent_problem(section => 'psu', instance => $instance); next; } - + $self->{components}->{psu}->{total}++; - $self->{output}->output_add(long_msg => sprintf("power supply '%s' status is '%s' [instance = %s]", - $instance, $result->{boxServicesPowSupplyItemState}, $instance)); + $self->{output}->output_add( + long_msg => sprintf( + "power supply '%s' status is '%s' [instance = %s]", + $instance, $result->{boxServicesPowSupplyItemState}, $instance + ) + ); $exit = $self->get_severity(label => 'default', section => 'psu', value => $result->{boxServicesPowSupplyItemState}); 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->{boxServicesPowSupplyItemState})); - next; + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Power supply '%s' status is '%s'", $instance, $result->{boxServicesPowSupplyItemState}) + ); } } } diff --git a/centreon-plugins/centreon/common/dell/fastpath/snmp/mode/components/temperature.pm b/centreon-plugins/centreon/common/dell/fastpath/snmp/mode/components/temperature.pm index 229af8248..22c0370b8 100644 --- a/centreon-plugins/centreon/common/dell/fastpath/snmp/mode/components/temperature.pm +++ b/centreon-plugins/centreon/common/dell/fastpath/snmp/mode/components/temperature.pm @@ -30,16 +30,16 @@ my %map_temp_status = ( 3 => 'critical', 4 => 'shutdown', 5 => 'notpresent', - 6 => 'notoperational', + 6 => 'notoperational' ); my $mapping1 = { boxServicesTempSensorState => { oid => '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.8.1.3', map => \%map_temp_status }, - boxServicesTempSensorTemperature => { oid => '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.8.1.4' }, + boxServicesTempSensorTemperature => { oid => '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.8.1.4' } }; my $mapping2 = { boxServicesTempSensorState => { oid => '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.8.1.4', map => \%map_temp_status }, - boxServicesTempSensorTemperature => { oid => '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.8.1.5' }, + boxServicesTempSensorTemperature => { oid => '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.8.1.5' } }; my $oid_boxServicesTempSensorsEntry = '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.8.1'; @@ -60,36 +60,45 @@ sub check { foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_boxServicesTempSensorsEntry}})) { next if ($oid !~ /^$mapping2->{boxServicesTempSensorState}->{oid}\.(.*)$/); my $instance = $1; - + if (defined($self->{results}->{$oid_boxServicesTempSensorsEntry}->{$mapping2->{boxServicesTempSensorTemperature}->{oid} . '.' . $instance})) { $result = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_boxServicesTempSensorsEntry}, instance => $instance); } else { $result = $self->{snmp}->map_instance(mapping => $mapping1, results => $self->{results}->{$oid_boxServicesTempSensorsEntry}, instance => $instance); } - + next if ($self->check_filter(section => 'temperature', instance => $instance)); if ($result->{boxServicesTempSensorState} =~ /notPresent/i) { $self->absent_problem(section => 'temperature', instance => $instance); next; } - + $self->{components}->{temperature}->{total}++; - $self->{output}->output_add(long_msg => sprintf("temperature '%s' status is '%s' [instance = %s, temperature = %s]", - $instance, $result->{boxServicesTempSensorState}, $instance, defined($result->{boxServicesTempSensorTemperature}) ? $result->{boxServicesTempSensorTemperature} : 'unknown')); + $self->{output}->output_add( + long_msg => sprintf( + "temperature '%s' status is '%s' [instance = %s, temperature = %s]", + $instance, $result->{boxServicesTempSensorState}, $instance, defined($result->{boxServicesTempSensorTemperature}) ? $result->{boxServicesTempSensorTemperature} : 'unknown' + ) + ); $exit = $self->get_severity(section => 'temperature', value => $result->{boxServicesTempSensorState}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Temperature '%s' status is '%s'", $instance, $result->{boxServicesTempSensorState})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Temperature '%s' status is '%s'", $instance, $result->{boxServicesTempSensorState}) + ); } ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{boxServicesTempSensorTemperature}); 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->{boxServicesTempSensorTemperature})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Temperature '%s' is '%s' C", $instance, $result->{boxServicesTempSensorTemperature}) + ); } + $self->{output}->perfdata_add( - label => 'temp', unit => 'C', nlabel => 'hardware.temperature.celsius', + unit => 'C', instances => $instance, value => $result->{boxServicesTempSensorTemperature}, warning => $warn, diff --git a/centreon-plugins/centreon/common/dell/fastpath/snmp/mode/cpu.pm b/centreon-plugins/centreon/common/dell/fastpath/snmp/mode/cpu.pm index a0ee9cc27..b1294218d 100644 --- a/centreon-plugins/centreon/common/dell/fastpath/snmp/mode/cpu.pm +++ b/centreon-plugins/centreon/common/dell/fastpath/snmp/mode/cpu.pm @@ -27,12 +27,12 @@ use warnings; 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 => { 'warning:s' => { name => 'warning', default => '' }, - 'critical:s' => { name => 'critical', default => '' }, + 'critical:s' => { name => 'critical', default => '' } }); return $self; @@ -77,8 +77,10 @@ sub run { my $oid_agentSwitchCpuProcessTotalUtilization1 = '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.9.0'; my $oid_agentSwitchCpuProcessTotalUtilization2 = '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.4.0'; # oid for 6200 series - $self->{result} = $self->{snmp}->get_leef(oids => [ $oid_agentSwitchCpuProcessTotalUtilization1, $oid_agentSwitchCpuProcessTotalUtilization2 ], - nothing_quit => 1); + $self->{result} = $self->{snmp}->get_leef( + oids => [ $oid_agentSwitchCpuProcessTotalUtilization1, $oid_agentSwitchCpuProcessTotalUtilization2 ], + nothing_quit => 1 + ); my $cpu_usage; if ((defined($self->{result}->{$oid_agentSwitchCpuProcessTotalUtilization1})) && ($self->{result}->{$oid_agentSwitchCpuProcessTotalUtilization1} =~ /sec.*(sec|min).*(sec|min)/i)) { @@ -86,8 +88,10 @@ sub run { } elsif ((defined($self->{result}->{$oid_agentSwitchCpuProcessTotalUtilization2})) && ($self->{result}->{$oid_agentSwitchCpuProcessTotalUtilization2} =~ /sec.*(sec|min).*(sec|min)/i)) { $cpu_usage = $self->{result}->{$oid_agentSwitchCpuProcessTotalUtilization2}; } else { - $self->{output}->output_add(severity => 'UNKNOWN', - short_msg => sprintf("Can't get CPU information.")); + $self->{output}->output_add( + severity => 'UNKNOWN', + short_msg => sprintf("Can't get CPU information.") + ); $self->{output}->display(); $self->{output}->exit(); } @@ -96,33 +100,52 @@ sub run { my $cpu1min = $2; my $cpu5min = $3; - my $exit1 = $self->{perfdata}->threshold_check(value => $cpu5sec, - threshold => [ { label => 'crit5s', 'exit_litteral' => 'critical' }, { label => 'warn5s', exit_litteral => 'warning' } ]); - my $exit2 = $self->{perfdata}->threshold_check(value => $cpu1min, - threshold => [ { label => 'crit1m', 'exit_litteral' => 'critical' }, { label => 'warn1m', exit_litteral => 'warning' } ]); - my $exit3 = $self->{perfdata}->threshold_check(value => $cpu5min, - threshold => [ { label => 'crit5m', 'exit_litteral' => 'critical' }, { label => 'warn5m', exit_litteral => 'warning' } ]); + my $exit1 = $self->{perfdata}->threshold_check( + value => $cpu5sec, + threshold => [ { label => 'crit5s', 'exit_litteral' => 'critical' }, { label => 'warn5s', exit_litteral => 'warning' } ] + ); + my $exit2 = $self->{perfdata}->threshold_check( + value => $cpu1min, + threshold => [ { label => 'crit1m', 'exit_litteral' => 'critical' }, { label => 'warn1m', exit_litteral => 'warning' } ] + ); + my $exit3 = $self->{perfdata}->threshold_check( + value => $cpu5min, + threshold => [ { label => 'crit5m', 'exit_litteral' => 'critical' }, { label => 'warn5m', exit_litteral => 'warning' } ] + ); my $exit = $self->{output}->get_most_critical(status => [ $exit1, $exit2, $exit3 ]); - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("CPU Usage: %.2f%% (5sec), %.2f%% (1min), %.2f%% (5min)", - $cpu5sec, $cpu1min, $cpu5min)); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf( + "CPU Usage: %.2f%% (5sec), %.2f%% (1min), %.2f%% (5min)", + $cpu5sec, $cpu1min, $cpu5min + ) + ); - $self->{output}->perfdata_add(label => "cpu_5s", unit => '%', - value => $cpu5sec, - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn5s'), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit5s'), - min => 0, max => 100); - $self->{output}->perfdata_add(label => "cpu_1m", unit => '%', - value => $cpu1min, - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1m'), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1m'), - min => 0, max => 100); - $self->{output}->perfdata_add(label => "cpu_5m", unit => '%', - value => $cpu5min, - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn5m'), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit5m'), - min => 0, max => 100); + $self->{output}->perfdata_add( + nlabel => 'cpu.utilization.5s.percentage', + unit => '%', + value => $cpu5sec, + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn5s'), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit5s'), + min => 0, max => 100 + ); + $self->{output}->perfdata_add( + nlabel => 'cpu.utilization.1m.percentage', + unit => '%', + value => $cpu1min, + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1m'), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1m'), + min => 0, max => 100 + ); + $self->{output}->perfdata_add( + nlabel => 'cpu.utilization.5m.percentage', + unit => '%', + value => $cpu5min, + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn5m'), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit5m'), + min => 0, max => 100 + ); } else { $self->{output}->output_add(severity => 'UNKNOWN', short_msg => sprintf("Can't parse CPU usage.")); diff --git a/centreon-plugins/centreon/common/dell/fastpath/snmp/mode/environment.pm b/centreon-plugins/centreon/common/dell/fastpath/snmp/mode/environment.pm index 1ffb9acd4..48c9d9084 100644 --- a/centreon-plugins/centreon/common/dell/fastpath/snmp/mode/environment.pm +++ b/centreon-plugins/centreon/common/dell/fastpath/snmp/mode/environment.pm @@ -40,7 +40,7 @@ sub set_system { ['powering', 'WARNING'], ['nopower', 'CRITICAL'], ['notpowering', 'CRITICAL'], - ['incompatible', 'CRITICAL'], + ['incompatible', 'CRITICAL'] ], temperature => [ ['low', 'WARNING'], @@ -49,8 +49,8 @@ sub set_system { ['critical', 'CRITICAL'], ['shutdown', 'CRITICAL'], ['notpresent', 'OK'], - ['notoperational', 'CRITICAL'], - ], + ['notoperational', 'CRITICAL'] + ] }; $self->{components_path} = 'centreon::common::dell::fastpath::snmp::mode::components'; @@ -66,7 +66,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 => {}); diff --git a/centreon-plugins/centreon/common/dell/fastpath/snmp/mode/memory.pm b/centreon-plugins/centreon/common/dell/fastpath/snmp/mode/memory.pm index b6303b5a9..ff34ce4ea 100644 --- a/centreon-plugins/centreon/common/dell/fastpath/snmp/mode/memory.pm +++ b/centreon-plugins/centreon/common/dell/fastpath/snmp/mode/memory.pm @@ -27,12 +27,12 @@ use warnings; 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 => { 'warning:s' => { name => 'warning' }, - 'critical:s' => { name => 'critical' }, + 'critical:s' => { name => 'critical' } }); return $self; @@ -59,9 +59,10 @@ sub run { my $oid_agentSwitchCpuProcessMemFree = '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.1.0'; # in KB my $oid_agentSwitchCpuProcessMemAvailable = '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.2.0'; # in KB - my $result = $self->{snmp}->get_leef(oids => [$oid_agentSwitchCpuProcessMemFree, - $oid_agentSwitchCpuProcessMemAvailable], - nothing_quit => 1); + my $result = $self->{snmp}->get_leef( + oids => [$oid_agentSwitchCpuProcessMemFree, $oid_agentSwitchCpuProcessMemAvailable], + nothing_quit => 1 + ); my $memory_free = $result->{$oid_agentSwitchCpuProcessMemFree} * 1024; my $memory_available = $result->{$oid_agentSwitchCpuProcessMemAvailable} * 1024; @@ -75,17 +76,24 @@ sub run { my ($memory_available_value, $memory_available_unit) = $self->{perfdata}->change_bytes(value => $memory_available); my ($memory_free_value, $memory_free_unit) = $self->{perfdata}->change_bytes(value => $memory_free); - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Memory used: %s (%.2f%%), Size: %s, Free: %s (%.2f%%)", - $memory_used_value . " " . $memory_used_unit, $prct_used, - $memory_available_value . " " . $memory_available_unit, - $memory_free_value . " " . $memory_free_unit, $prct_free)); - - $self->{output}->perfdata_add(label => "used", unit => 'B', - value => $memory_used, - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $memory_available, cast_int => 1), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $memory_available, cast_int => 1), - min => 0, max => $memory_available); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf( + "Memory used: %s (%.2f%%), Size: %s, Free: %s (%.2f%%)", + $memory_used_value . " " . $memory_used_unit, $prct_used, + $memory_available_value . " " . $memory_available_unit, + $memory_free_value . " " . $memory_free_unit, $prct_free + ) + ); + + $self->{output}->perfdata_add( + nlabel => 'memory.usage.bytes', + unit => 'B', + value => $memory_used, + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $memory_available, cast_int => 1), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $memory_available, cast_int => 1), + min => 0, max => $memory_available + ); $self->{output}->display(); $self->{output}->exit(); @@ -113,4 +121,3 @@ Threshold critical in percent. =back =cut - diff --git a/centreon-plugins/network/dell/nseries/snmp/mode/interfaces.pm b/centreon-plugins/network/dell/nseries/snmp/mode/interfaces.pm new file mode 100644 index 000000000..ff2f202ec --- /dev/null +++ b/centreon-plugins/network/dell/nseries/snmp/mode/interfaces.pm @@ -0,0 +1,182 @@ +# +# Copyright 2022 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::dell::nseries::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<--check-metrics> + +If the expression is true, metrics are checked (Default: '%{opstatus} eq "up"'). + +=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 diff --git a/centreon-plugins/network/dell/nseries/snmp/mode/time.pm b/centreon-plugins/network/dell/nseries/snmp/mode/time.pm new file mode 100644 index 000000000..172dc51c0 --- /dev/null +++ b/centreon-plugins/network/dell/nseries/snmp/mode/time.pm @@ -0,0 +1,75 @@ +# +# Copyright 2022 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::dell::nseries::snmp::mode::time; + +use base qw(snmp_standard::mode::ntp); + +use strict; +use warnings; +use Date::Parse; + +sub get_target_time { + my ($self, %options) = @_; + + my $oid_agentSystemTime = '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.42.1.1.0'; + my $oid_agentSystemDate = '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.42.1.2.0'; + my $snmp_result = $options{snmp}->get_leef(oids => [ $oid_agentSystemTime, $oid_agentSystemDate ], nothing_quit => 1); + + my $epoch = Date::Parse::str2time($snmp_result->{$oid_agentSystemDate} . ' ' . $snmp_result->{$oid_agentSystemTime}); + return $self->get_from_epoch(date => $epoch); +} + +1; + +__END__ + +=head1 MODE + +Check time offset of server with ntp server. Use local time if ntp-host option is not set. +SNMP gives a date with second precision (no milliseconds). Time precision is not very accurate. +Use threshold with (+-) 2 seconds offset (minimum). + +=over 8 + +=item B<--warning-offset> + +Time offset warning threshold (in seconds). + +=item B<--critical-offset> + +Time offset critical Threshold (in seconds). + +=item B<--ntp-hostname> + +Set the ntp hostname (if not set, localtime is used). + +=item B<--ntp-port> + +Set the ntp port (Default: 123). + +=item B<--timezone> + +Set the timezone of distant server. For Windows, you need to set it. +Can use format: 'Europe/London' or '+0100'. + +=back + +=cut diff --git a/centreon-plugins/network/dell/nseries/snmp/mode/uptime.pm b/centreon-plugins/network/dell/nseries/snmp/mode/uptime.pm new file mode 100644 index 000000000..780701afc --- /dev/null +++ b/centreon-plugins/network/dell/nseries/snmp/mode/uptime.pm @@ -0,0 +1,77 @@ +# +# Copyright 2022 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::dell::nseries::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 diff --git a/centreon-plugins/network/dell/n4000/snmp/plugin.pm b/centreon-plugins/network/dell/nseries/snmp/plugin.pm similarity index 81% rename from centreon-plugins/network/dell/n4000/snmp/plugin.pm rename to centreon-plugins/network/dell/nseries/snmp/plugin.pm index 1dfa02b5d..1532e1120 100644 --- a/centreon-plugins/network/dell/n4000/snmp/plugin.pm +++ b/centreon-plugins/network/dell/nseries/snmp/plugin.pm @@ -18,7 +18,7 @@ # limitations under the License. # -package network::dell::n4000::snmp::plugin; +package network::dell::nseries::snmp::plugin; use strict; use warnings; @@ -29,15 +29,16 @@ sub new { my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; - $self->{version} = '1.0'; - %{$self->{modes}} = ( + $self->{modes} = { 'cpu' => 'centreon::common::dell::fastpath::snmp::mode::cpu', 'environment' => 'centreon::common::dell::fastpath::snmp::mode::environment', 'global-status' => 'centreon::common::dell::powerconnect3000::mode::globalstatus', - 'interfaces' => 'snmp_standard::mode::interfaces', + 'interfaces' => 'network::dell::nseries::snmp::mode::interfaces', 'list-interfaces' => 'snmp_standard::mode::listinterfaces', 'memory' => 'centreon::common::dell::fastpath::snmp::mode::memory', - ); + 'time' => 'network::dell::nseries::snmp::mode::time', + 'uptime' => 'network::dell::nseries::snmp::mode::uptime' + }; return $self; } @@ -48,6 +49,6 @@ __END__ =head1 PLUGIN DESCRIPTION -Check Dell N4000 series in SNMP. +Check Dell N-series in SNMP. =cut