diff --git a/packaging/centreon-plugin-Network-Firewalls-Forcepoint-Sdwan-Snmp/deb.json b/packaging/centreon-plugin-Network-Firewalls-Forcepoint-Sdwan-Snmp/deb.json new file mode 100644 index 000000000..663aaaceb --- /dev/null +++ b/packaging/centreon-plugin-Network-Firewalls-Forcepoint-Sdwan-Snmp/deb.json @@ -0,0 +1,5 @@ +{ + "dependencies": [ + "libsnmp-perl" + ] +} \ No newline at end of file diff --git a/packaging/centreon-plugin-Network-Firewalls-Forcepoint-Sdwan-Snmp/pkg.json b/packaging/centreon-plugin-Network-Firewalls-Forcepoint-Sdwan-Snmp/pkg.json new file mode 100644 index 000000000..0759f2dfd --- /dev/null +++ b/packaging/centreon-plugin-Network-Firewalls-Forcepoint-Sdwan-Snmp/pkg.json @@ -0,0 +1,20 @@ +{ + "pkg_name": "centreon-plugin-Network-Firewalls-Forcepoint-Sdwan-Snmp", + "pkg_summary": "Centreon Plugin to monitor Forcepoint SD-WAN using SNMP", + "plugin_name": "centreon_forcepoint_sdwan_snmp.pl", + "files": [ + "centreon/plugins/script_snmp.pm", + "centreon/plugins/snmp.pm", + "snmp_standard/mode/cpu.pm", + "snmp_standard/mode/cpudetailed.pm", + "snmp_standard/mode/interfaces.pm", + "snmp_standard/mode/listinterfaces.pm", + "snmp_standard/mode/loadaverage.pm", + "snmp_standard/mode/memory.pm", + "snmp_standard/mode/resources/", + "snmp_standard/mode/storage.pm", + "snmp_standard/mode/swap.pm", + "snmp_standard/mode/uptime.pm", + "network/forcepoint/sdwan/snmp/" + ] +} diff --git a/packaging/centreon-plugin-Network-Firewalls-Forcepoint-Sdwan-Snmp/rpm.json b/packaging/centreon-plugin-Network-Firewalls-Forcepoint-Sdwan-Snmp/rpm.json new file mode 100644 index 000000000..418a331fc --- /dev/null +++ b/packaging/centreon-plugin-Network-Firewalls-Forcepoint-Sdwan-Snmp/rpm.json @@ -0,0 +1,5 @@ +{ + "dependencies": [ + "perl(SNMP)" + ] +} \ No newline at end of file diff --git a/src/network/forcepoint/sdwan/snmp/mode/clusterload.pm b/src/network/forcepoint/sdwan/snmp/mode/clusterload.pm new file mode 100644 index 000000000..9a46881cb --- /dev/null +++ b/src/network/forcepoint/sdwan/snmp/mode/clusterload.pm @@ -0,0 +1,95 @@ +# +# Copyright 2025 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::forcepoint::sdwan::snmp::mode::clusterload; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'global', type => 0, skipped_code => { -10 => 1 } } + ]; + + $self->{maps_counters}->{global} = [ + { + label => 'cpu-load', + nlabel => 'cluster.cpu.load.percentage', + set => { + key_values => [ { name => 'cluster_cpu_load' } ], + output_template => 'cluster cpu load: %.2f%%', + 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; + + $options{options}->add_options(arguments => {}); + + return $self; +} + +sub manage_selection { + my ($self, %options) = @_; + + my $oid_load = '.1.3.6.1.4.1.47565.1.1.1.19.4.0';# systemLoad + my $snmp_result = $options{snmp}->get_leef( + oids => [ $oid_load ], + nothing_quit => 1 + ); + + $self->{global} = { + cluster_cpu_load => $snmp_result->{$oid_load} + }; +} + +1; + +__END__ + +=head1 MODE + +Check cluster CPU load. + +=over 8 + + +=item B<--warning-cpu-load> + +Threshold in percentage. + +=item B<--critical-cpu-load> + +Threshold in percentage. + +=back + +=cut diff --git a/src/network/forcepoint/sdwan/snmp/mode/clusterstate.pm b/src/network/forcepoint/sdwan/snmp/mode/clusterstate.pm new file mode 100644 index 000000000..802a1086a --- /dev/null +++ b/src/network/forcepoint/sdwan/snmp/mode/clusterstate.pm @@ -0,0 +1,132 @@ +# +# Copyright 2025 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::forcepoint::sdwan::snmp::mode::clusterstate; + +use base qw(centreon::plugins::templates::counter); +use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng); + +use strict; +use warnings; + +sub custom_status_output { + my ($self, %options) = @_; + + return sprintf( + "Node status is '%s' [Member id: %s]", + $self->{result_values}->{node_status}, + $self->{result_values}->{node_member_id} + ); +} + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'global', type => 0 } + ]; + + $self->{maps_counters}->{global} = [ + { + label => 'status', + type => 2, + unknown_default => '%{node_status} =~ /unknown/i', + warning_default => '%{node_status} =~ /lockedOnline/i', + critical_default => + '%{node_status} =~ /^(?:offline|goingOffline|lockedOffline|goingLockedOffline)$/i', + set => + { + key_values => [ { name => 'node_status' }, { name => 'node_member_id' } ], + closure_custom_output => $self->can('custom_status_output'), + closure_custom_threshold_check => \&catalog_status_threshold_ng + } + } + ] +} + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options); + bless $self, $class; + + $options{options}->add_options(arguments => { + }); + + return $self; +} + +my $map_oper_state = { + 0 => 'unknown', + 1 => 'online', + 2 => 'goingOnline', + 3 => 'lockedOnline', + 4 => 'goingLockedOnline', + 5 => 'offline', + 6 => 'goingOffline', + 7 => 'lockedOffline', + 8 => 'goingLockedOffline', + 9 => 'standby', + 10 => 'goingStandby' +}; + +sub manage_selection { + my ($self, %options) = @_; + + my $oid_nodeMemberId = '.1.3.6.1.4.1.47565.1.1.1.19.2.0'; + my $oid_nodeOperState = '.1.3.6.1.4.1.47565.1.1.1.19.3.0'; + my $snmp_result = $options{snmp}->get_leef(oids => [ $oid_nodeMemberId, $oid_nodeOperState ], nothing_quit => 1); + $self->{global} = { + node_status => $map_oper_state->{ $snmp_result->{$oid_nodeOperState} }, + node_member_id => $snmp_result->{$oid_nodeMemberId} + }; +} + +1; + +__END__ + +=head1 MODE + +Check status of clustered node. + +=over 8 + +=item B<--warning-status> + +Threshold. +Define the conditions to match for the status to be WARNING (default: '%{node_status} =~ /lockedOnline/i'). +You can use the following variables: %{node_status}, %{node_member_id}. + +=item B<--critical-status> + +Threshold. +Define the conditions to match for the status to be CRITICAL (default: '%{node_status} =~ /^(?:offline|goingOffline|lockedOffline|goingLockedOffline)$/i'). +You can use the following variables: %{node_status}, %{node_member_id}. + +=item B<--unknown-status> + +Threshold. +Define the conditions to match for the status to be UNKNOWN (default: '%{node_status} =~ /unknown/i'). +You can use the following variables: %{node_status}, %{node_member_id}. + +=back + +=cut + diff --git a/src/network/forcepoint/sdwan/snmp/mode/connections.pm b/src/network/forcepoint/sdwan/snmp/mode/connections.pm new file mode 100644 index 000000000..760ffb0f5 --- /dev/null +++ b/src/network/forcepoint/sdwan/snmp/mode/connections.pm @@ -0,0 +1,174 @@ +# +# Copyright 2025 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::forcepoint::sdwan::snmp::mode::connections; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'global', type => 0, skipped_code => { -10 => 1 } }, + ]; + + $self->{maps_counters}->{global} = [ + { + label => 'total-connections', + nlabel => 'connections.total.count', + set => { + key_values => [ { name => 'fwConnNumber' } ], + output_template => 'Total connections : %s', + perfdatas => [ + { label => 'total_connections', template => '%s', unit => 'con', min => 0 }, + ], + } + }, + { + label => 'new-connections-sec', + nlabel => 'connections.new.persecond', + set => { + key_values => [ { name => 'fwNewConnectionsS' } ], + output_template => 'New Connections : %.2f /s', + perfdatas => [ + { label => 'new_connections', template => '%.2f', unit => 'con/s', min => 0 } + ], + } + }, + { + label => 'discarded-connections-sec', + nlabel => 'connections.discarded.persecond', + set => { + key_values => [ { name => 'fwDiscardedConnectionsS' } ], + output_template => 'Discarded Connections : %.2f /s', + perfdatas => [ + { label => 'discarded_connections', template => '%.2f', unit => 'con/s', min => 0 } + ], + } + }, + { + label => 'refused-connections-sec', + nlabel => 'connections.refused.persecond', + set => { + key_values => [ { name => 'fwRefusedConnectionsS' } ], + output_template => 'Refused Connections : %.2f /s', + perfdatas => [ + { label => 'refused_connections', template => '%.2f', unit => 'con/s', min => 0 } + ], + } + } + ]; +} + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options); + bless $self, $class; + + $options{options}->add_options(arguments => {}); + + 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 $oid_fwConnNumber = '.1.3.6.1.4.1.47565.1.1.1.4.0'; + my $oid_fwNewConnectionsS = '.1.3.6.1.4.1.47565.1.1.1.11.4.0'; + my $oid_fwDiscardedConnectionsS = '.1.3.6.1.4.1.47565.1.1.1.11.5.0'; + my $oid_fwRefusedConnectionsS = '.1.3.6.1.4.1.47565.1.1.1.11.6.0'; + my $snmp_result = $options{snmp}->get_leef( + oids => + [ + $oid_fwConnNumber, + $oid_fwNewConnectionsS, + $oid_fwDiscardedConnectionsS, + $oid_fwRefusedConnectionsS + ], + nothing_quit => 1 + ); + + $self->{global} = { + fwConnNumber => $snmp_result->{$oid_fwConnNumber}, + fwNewConnectionsS => $snmp_result->{$oid_fwNewConnectionsS}, + fwDiscardedConnectionsS => $snmp_result->{$oid_fwDiscardedConnectionsS}, + fwRefusedConnectionsS => $snmp_result->{$oid_fwRefusedConnectionsS}, + }; +} + +1; + +__END__ + +=head1 MODE + +Check firewall connections. + +=over 8 + +=item B<--filter-counters> + +Only display some counters (regexp can be used). +Can be : total-connections, new-connections-sec, discarded-connections-sec, refused-connections-sec +Example : --filter-counters='^total-connections$' + +=item B<--warning-total-connections> + +Threshold in con. + +=item B<--critical-total-connections> + +Threshold in con. + +=item B<--warning-discarded-connections-sec> + +Threshold in con/s. + +=item B<--critical-discarded-connections-sec> + +Threshold in con/s. + +=item B<--warning-new-connections-sec> + +Threshold in con/s. + +=item B<--critical-new-connections-sec> + +Threshold in con/s. + +=item B<--warning-refused-connections-sec> + +Threshold in con/s. + +=item B<--critical-refused-connections-sec> + +Threshold in con/s + +=back + +=cut diff --git a/src/network/forcepoint/sdwan/snmp/mode/diskusage.pm b/src/network/forcepoint/sdwan/snmp/mode/diskusage.pm new file mode 100644 index 000000000..deebb39b5 --- /dev/null +++ b/src/network/forcepoint/sdwan/snmp/mode/diskusage.pm @@ -0,0 +1,233 @@ +# +# Copyright 2025 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::forcepoint::sdwan::snmp::mode::diskusage; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; + +sub custom_space_usage_output { + my ($self, %options) = @_; + + my ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes( + value => $self->{result_values}->{total_space} + ); + my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes( + value => $self->{result_values}->{used_space} + ); + my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes( + value => $self->{result_values}->{free_space} + ); + return sprintf( + 'space usage total: %s used: %s (%.2f%%) free: %s (%.2f%%)', + $total_size_value . " " . $total_size_unit, + $total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used_space}, + $total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free_space} + ); +} + +sub prefix_disk_output { + my ($self, %options) = @_; + + return "Disk '" . $options{instance} . "' "; +} + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'disks', type => 1, cb_prefix_output => 'prefix_disk_output', message_multiple => 'All disks are ok' } + ]; + + $self->{maps_counters}->{disks} = [ + { + label => 'space-usage', + nlabel => 'disk.space.usage.bytes', + set => { + key_values => + [ + { name => 'used_space' }, + { name => 'free_space' }, + { name => 'prct_used_space' }, + { name => 'prct_free_space' }, + { name => 'total_space' } + ], + closure_custom_output => $self->can('custom_space_usage_output'), + perfdatas => + [ + { + template => '%d', + min => 0, + max => 'total_space', + unit => 'B', + cast_int => 1, + label_extra_instance => 1 + } + ] + } + }, + { + label => 'space-usage-free', + nlabel => 'disk.space.free.bytes', + display_ok => 0, + set => { + key_values => + [ + { name => 'free_space' }, + { name => 'used_space' }, + { name => 'prct_used_space' }, + { name => 'prct_free_space' }, + { name => 'total_space' } + ], + closure_custom_output => $self->can('custom_space_usage_output'), + perfdatas => + [ + { + template => '%d', + min => 0, + max => 'total_space', + unit => 'B', + cast_int => 1, + label_extra_instance => 1 + } + ] + } + }, + { + label => 'space-usage-prct', + nlabel => 'disk.space.usage.percentage', + display_ok => 0, + set => { + key_values => + [ + { name => 'prct_used_space' }, + { name => 'used_space' }, + { name => 'free_space' }, + { name => 'prct_free_space' }, + { name => 'total_space' } + ], + closure_custom_output => $self->can('custom_space_usage_output'), + perfdatas => + [ + { template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1 } + ] + } + } + ]; +} + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1); + bless $self, $class; + + $options{options}->add_options(arguments => { 'filter-name:s' => { name => 'filter_name' } }); + + return $self; +} + +sub manage_selection { + my ($self, %options) = @_; + + my $mapping = { + name => { oid => '.1.3.6.1.4.1.47565.1.1.1.11.3.1.2' },# fwPartitionDevName + total => { oid => '.1.3.6.1.4.1.47565.1.1.1.11.3.1.4' },# fwPartitionSize + free => { oid => '.1.3.6.1.4.1.47565.1.1.1.11.3.1.6' },# fwPartitionAvail + used => { oid => '.1.3.6.1.4.1.47565.1.1.1.11.3.1.5' }# fwPartitionUsed + }; + my $oid_fwDiskStatsEntry = '.1.3.6.1.4.1.47565.1.1.1.11.3.1'; + + my $snmp_result = $options{snmp}->get_multiple_table( + oids => [ + { oid => $oid_fwDiskStatsEntry, start => $mapping->{name}->{oid}, end => $mapping->{free}->{oid} }, + { oid => $mapping->{name}->{oid} } + ], + return_type => 1, + nothing_quit => 1 + ); + + $self->{disks} = {}; + foreach my $oid (sort keys %$snmp_result) { + next if ($oid !~ /^$mapping->{name}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance); + + # Filter disks by partition dev name + next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && + $result->{name} !~ /$self->{option_results}->{filter_name}/); + + $self->{disks}->{ $result->{name} } = { + free_space => $result->{free}, + total_space => $result->{total}, + used_space => $result->{used}, + prct_used_space => $result->{used} * 100 / $result->{total}, + prct_free_space => $result->{free} * 100 / $result->{total}, + }; + } + + if (scalar(keys %{$self->{disks}}) <= 0) { + $self->{output}->add_option_msg(short_msg => "No disk found."); + $self->{output}->option_exit(); + } +} + +1; + +__END__ + +=head1 MODE + +Check disks. + +=over 8 + +=item B<--filter-name> + +Filter disks by partition dev name (can be a regexp). + +=item B<--warning-space-usage> + +Threshold in bytes. + +=item B<--critical-space-usage> + +Threshold in bytes. + +=item B<--warning-space-usage-free> + +Threshold in bytes. + +=item B<--critical-space-usage-free> + +Threshold in bytes. + +=item B<--warning-space-usage-prct> + +Threshold in percentage. + +=item B<--critical-space-usage-prct> + +Threshold in percentage. + +=back + +=cut diff --git a/src/network/forcepoint/sdwan/snmp/mode/droppedpackets.pm b/src/network/forcepoint/sdwan/snmp/mode/droppedpackets.pm new file mode 100644 index 000000000..f023f48fe --- /dev/null +++ b/src/network/forcepoint/sdwan/snmp/mode/droppedpackets.pm @@ -0,0 +1,123 @@ +# +# Copyright 2025 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::forcepoint::sdwan::snmp::mode::droppedpackets; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; +use Digest::MD5 qw(md5_hex); + +sub custom_drop_calc { + my ($self, %options) = @_; + + # First call or reboot or counter goes back + if (!defined($options{old_datas}->{global_dropped}) + || $options{new_datas}->{global_dropped} < $options{old_datas}->{global_dropped} + ) { + $self->{error_msg} = 'buffer creation'; + return -1; + } + + my $dropped = $options{new_datas}->{global_dropped} - $options{old_datas}->{global_dropped}; + $self->{result_values}->{dropped_packets_per_sec} = $dropped / $options{delta_time}; + + return 0; +} + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'global', type => 0, skipped_code => { -10 => 1 } }, + ]; + + $self->{maps_counters}->{global} = [ + { + label => 'dropped-packets-sec', + nlabel => 'dropped.packets.persecond', + set => { + key_values => [], + manual_keys => 1, + closure_custom_calc => $self->can('custom_drop_calc'), + output_template => 'Packets Dropped : %.2f /s', + output_use => 'dropped_packets_per_sec', threshold_use => 'dropped_packets_per_sec', + perfdatas => [ + { value => 'dropped_packets_per_sec', template => '%.2f', unit => 'packets/s', min => 0 } + ], + } + } + ]; +} + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1, force_new_perfdata => 1); + bless $self, $class; + + $options{options}->add_options(arguments => {}); + + $self->{cache_policy} = centreon::plugins::statefile->new(%options); + return $self; +} + +sub manage_selection { + my ($self, %options) = @_; + + if ($options{snmp}->is_snmpv1()) { + $self->{output}->add_option_msg(short_msg => "Can't check SNMP 64 bits counters with SNMPv1."); + $self->{output}->option_exit(); + } + + my $oid_fwDropped = '.1.3.6.1.4.1.47565.1.1.1.6.0'; + my $result = $options{snmp}->get_leef(oids => [ $oid_fwDropped ], nothing_quit => 1); + + $self->{global} = { + dropped => $result->{$oid_fwDropped} + }; + + $self->{cache_name} = "forcepoint_sdwan_" . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . $self->{mode} . '_' . + (defined($self->{option_results}->{filter_counters}) ? + md5_hex($self->{option_results}->{filter_counters}) : + md5_hex('all')); +} + +1; + +__END__ + +=head1 MODE + +Check dropped packets per second by firewall. + +=over 8 + +=item B<--warning-dropped-packets-sec> + +Threshold in packets/s. + +=item B<--critical-dropped-packets-sec> + +Threshold in packets/s. + +=back + +=cut diff --git a/src/network/forcepoint/sdwan/snmp/mode/listdisks.pm b/src/network/forcepoint/sdwan/snmp/mode/listdisks.pm new file mode 100644 index 000000000..a1956b1b9 --- /dev/null +++ b/src/network/forcepoint/sdwan/snmp/mode/listdisks.pm @@ -0,0 +1,122 @@ +# +# Copyright 2025 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::forcepoint::sdwan::snmp::mode::listdisks; + +use strict; +use warnings; + +use base qw(centreon::plugins::mode); + +use centreon::plugins::misc; + +my %map_state = ( + 1 => 'online', + 2 => 'offline', +); + +my $mapping = { + hrstorageMount => { oid => '.1.3.6.1.2.1.25.3.8.1.2' }, +}; + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options); + bless $self, $class; + + $options{options}->add_options(arguments => { + 'filter-name:s' => { name => 'filter_name' }, + }); + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::init(%options); +} + +sub manage_selection { + my ($self, %options) = @_; + + my $snmp_result = $self->{snmp}->get_table( + oid => $mapping->{hrstorageMount}->{oid}, + dont_quit => 1 + ); + $self->{disks} = {}; + + while (my ($oid, $value) = each %{$snmp_result}) { + $self->{disks}->{ $oid } = { name => $value }; + } +} + +# Sorts the disks hash by name +sub _sort_output { + my ($self, %disks) = @_; + + sort { + $self->{disks}->{$a}->{name} cmp $self->{disks}->{$b}->{name} + } keys %disks; +} + +sub run { + my ($self, %options) = @_; + $self->{snmp} = $options{snmp}; + + $self->manage_selection(); + + foreach my $oid ($self->_sort_output(%{$self->{disks}})) { + $self->{output}->output_add(long_msg => "[name = " . $self->{disks}->{$oid}->{name} . "]"); + } + + $self->{output}->output_add( + severity => 'OK', + short_msg => 'List disks:' + ); + $self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1); + $self->{output}->exit(); +} + +sub disco_format { + my ($self, %options) = @_; + + $self->{output}->add_disco_format(elements => ['name']); +} + +sub disco_show { + my ($self, %options) = @_; + $self->{snmp} = $options{snmp}; + + $self->manage_selection(); + foreach my $oid ($self->_sort_output(%{$self->{disks}})) { + $self->{output}->add_disco_entry( + name => $self->{disks}->{$oid}->{name}, + ); + } +} + +1; + +__END__ + +=head1 MODE + +List disks. + +=cut diff --git a/src/network/forcepoint/sdwan/snmp/mode/rejectedpackets.pm b/src/network/forcepoint/sdwan/snmp/mode/rejectedpackets.pm new file mode 100644 index 000000000..9686afe45 --- /dev/null +++ b/src/network/forcepoint/sdwan/snmp/mode/rejectedpackets.pm @@ -0,0 +1,123 @@ +# +# Copyright 2025 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::forcepoint::sdwan::snmp::mode::rejectedpackets; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; +use Digest::MD5 qw(md5_hex); + +sub custom_reject_calc { + my ($self, %options) = @_; + + # First call or reboot or counter goes back + if (!defined($options{old_datas}->{global_rejected}) + || $options{new_datas}->{global_rejected} < $options{old_datas}->{global_rejected} + ) { + $self->{error_msg} = 'buffer creation'; + return -1; + } + + my $rejected = $options{new_datas}->{global_rejected} - $options{old_datas}->{global_rejected}; + $self->{result_values}->{rejected_packets_per_sec} = $rejected / $options{delta_time}; + + return 0; +} + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'global', type => 0, skipped_code => { -10 => 1 } }, + ]; + + $self->{maps_counters}->{global} = [ + { + label => 'rejected-packets-sec', + nlabel => 'rejected.packets.persecond', + set => { + key_values => [], + manual_keys => 1, + closure_custom_calc => $self->can('custom_reject_calc'), + output_template => 'Packets Rejected : %.2f /s', + output_use => 'rejected_packets_per_sec', threshold_use => 'rejected_packets_per_sec', + perfdatas => [ + { value => 'rejected_packets_per_sec', template => '%.2f', unit => 'packets/s', min => 0 } + ], + } + } + ]; +} + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1, force_new_perfdata => 1); + bless $self, $class; + + $options{options}->add_options(arguments => {}); + + $self->{cache_policy} = centreon::plugins::statefile->new(%options); + return $self; +} + +sub manage_selection { + my ($self, %options) = @_; + + if ($options{snmp}->is_snmpv1()) { + $self->{output}->add_option_msg(short_msg => "Can't check SNMP 64 bits counters with SNMPv1."); + $self->{output}->option_exit(); + } + + my $oid_fwRejected = '.1.3.6.1.4.1.47565.1.1.1.9.0'; + my $result = $options{snmp}->get_leef(oids => [ $oid_fwRejected ], nothing_quit => 1); + + $self->{global} = { + rejected => $result->{$oid_fwRejected} + }; + + $self->{cache_name} = "forcepoint_sdwan_" . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . $self->{mode} . '_' . + (defined($self->{option_results}->{filter_counters}) ? + md5_hex($self->{option_results}->{filter_counters}) : + md5_hex('all')); +} + +1; + +__END__ + +=head1 MODE + +Check rejected packets per second by firewall. + +=over 8 + +=item B<--warning-rejected-packets-sec> + +Threshold in packets/s. + +=item B<--critical-rejected-packets-sec> + +Threshold in packets/s. + +=back + +=cut diff --git a/src/network/forcepoint/sdwan/snmp/plugin.pm b/src/network/forcepoint/sdwan/snmp/plugin.pm new file mode 100644 index 000000000..b2cc4a049 --- /dev/null +++ b/src/network/forcepoint/sdwan/snmp/plugin.pm @@ -0,0 +1,63 @@ +# +# Copyright 2025 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::forcepoint::sdwan::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} = { + 'cluster-load' => 'network::forcepoint::sdwan::snmp::mode::clusterload', + 'cluster-state' => 'network::forcepoint::sdwan::snmp::mode::clusterstate', + 'connections' => 'network::forcepoint::sdwan::snmp::mode::connections', + 'cpu' => 'snmp_standard::mode::cpu', + 'cpu-detailed' => 'snmp_standard::mode::cpudetailed', + 'disk-usage' => 'network::forcepoint::sdwan::snmp::mode::diskusage', + 'dropped-packets' => 'network::forcepoint::sdwan::snmp::mode::droppedpackets', + 'interfaces' => 'snmp_standard::mode::interfaces', + 'list-disks' => 'network::forcepoint::sdwan::snmp::mode::listdisks', + 'list-interfaces' => 'snmp_standard::mode::listinterfaces', + 'load' => 'snmp_standard::mode::loadaverage', + 'memory' => 'snmp_standard::mode::memory', + 'rejected-packets' => 'network::forcepoint::sdwan::snmp::mode::rejectedpackets', + 'storage' => 'snmp_standard::mode::storage', + 'swap' => 'snmp_standard::mode::swap', + 'uptime' => 'snmp_standard::mode::uptime', + }; + + return $self; +} + +1; + +__END__ + +=head1 PLUGIN DESCRIPTION + +Check Forcepoint SD-WAN firewall in SNMP. + +=cut diff --git a/src/snmp_standard/mode/cpudetailed.pm b/src/snmp_standard/mode/cpudetailed.pm index f5d9cd3aa..d9b5d4224 100644 --- a/src/snmp_standard/mode/cpudetailed.pm +++ b/src/snmp_standard/mode/cpudetailed.pm @@ -255,20 +255,98 @@ __END__ =head1 MODE -Check system CPUs (UCD-SNMP-MIB) (User, Nice, System, Idle, Wait, Kernel, Interrupt, SoftIRQ, Steal, Guest, GuestNice) +Check system CPUs (UCD-SNMP-MIB) (C, C, C, C, C, C, C, C, C, C, C) An average of all CPUs. =over 8 -=item B<--warning-*> +=item B<--warning-guest> -Warning threshold in percent. -Can be: 'user', 'nice', 'system', 'idle', 'wait', 'kernel', 'interrupt', 'softirq', 'steal', 'guest', 'guestnice'. +Threshold in percentage. -=item B<--critical-*> +=item B<--critical-guest> -Critical threshold in percent. -Can be: 'user', 'nice', 'system', 'idle', 'wait', 'kernel', 'interrupt', 'softirq', 'steal', 'guest', 'guestnice'. +Threshold in percentage. + +=item B<--warning-guestnice> + +Threshold in percentage. + +=item B<--critical-guestnice> + +Threshold in percentage. + +=item B<--warning-idle> + +Threshold in percentage. + +=item B<--critical-idle> + +Threshold in percentage. + +=item B<--warning-interrupt> + +Threshold in percentage. + +=item B<--critical-interrupt> + +Threshold in percentage. + +=item B<--warning-kernel> + +Threshold in percentage. + +=item B<--critical-kernel> + +Threshold in percentage. + +=item B<--warning-nice> + +Threshold in percentage. + +=item B<--critical-nice> + +Threshold in percentage. + +=item B<--warning-softirq> + +Threshold in percentage. + +=item B<--critical-softirq> + +Threshold in percentage. + +=item B<--warning-steal> + +Threshold in percentage. + +=item B<--critical-steal> + +Threshold in percentage. + +=item B<--warning-system> + +Threshold in percentage. + +=item B<--critical-system> + +Threshold in percentage. + +=item B<--warning-user> + +Threshold in percentage. + +=item B<--critical-user> + +Threshold in percentage. + +=item B<--warning-wait> + +Threshold in percentage. + +=item B<--critical-wait> + +Threshold in percentage. =back diff --git a/src/snmp_standard/mode/memory.pm b/src/snmp_standard/mode/memory.pm index 44c767eea..a17a2fbf6 100644 --- a/src/snmp_standard/mode/memory.pm +++ b/src/snmp_standard/mode/memory.pm @@ -302,12 +302,77 @@ Thresholds are on free space left (deprecated. Please use new counters directly) Check swap also. -=item B<--warning-*> B<--critical-*> +=item B<--warning-buffer> -Thresholds. -Can be: 'usage' (B), 'usage-free' (B), 'usage-prct' (%), -'swap' (B), 'swap-free' (B), 'swap-prct' (%), -'buffer' (B), 'cached' (B), 'shared' (B). +Threshold in bytes. + +=item B<--critical-buffer> + +Threshold in bytes. + +=item B<--warning-cached> + +Threshold in bytes. + +=item B<--critical-cached> + +Threshold in bytes. + +=item B<--warning-shared> + +Threshold in bytes. + +=item B<--critical-shared> + +Threshold in bytes. + +=item B<--warning-swap> + +Threshold in bytes. + +=item B<--critical-swap> + +Threshold in bytes. + +=item B<--warning-swap-free> + +Threshold in bytes. + +=item B<--critical-swap-free> + +Threshold in bytes. + +=item B<--warning-swap-prct> + +Threshold in percentage. + +=item B<--critical-swap-prct> + +Threshold in percentage. + +=item B<--warning-usage> + +Threshold in bytes. + +=item B<--critical-usage> + +Threshold in bytes. + +=item B<--warning-usage-free> + +Threshold in bytes. + +=item B<--critical-usage-free> + +Threshold in bytes. + +=item B<--warning-usage-prct> + +Threshold in percentage. + +=item B<--critical-usage-prct> + +Threshold in percentage. =item B<--patch-redhat> diff --git a/src/snmp_standard/mode/swap.pm b/src/snmp_standard/mode/swap.pm index cb6b34518..be226a28d 100644 --- a/src/snmp_standard/mode/swap.pm +++ b/src/snmp_standard/mode/swap.pm @@ -140,10 +140,29 @@ Check swap memory (UCD-SNMP-MIB). Threshold if no active swap (default: 'critical'). -=item B<--warning-*> B<--critical-*> +=item B<--warning-usage> -Thresholds. -Can be: 'usage' (B), 'usage-free' (B), 'usage-prct' (%). +Threshold in bytes. + +=item B<--critical-usage> + +Threshold in bytes. + +=item B<--warning-usage-free> + +Threshold in bytes. + +=item B<--critical-usage-free> + +Threshold in bytes. + +=item B<--warning-usage-prct> + +Threshold in percentage. + +=item B<--critical-usage-prct> + +Threshold in percentage. =back diff --git a/tests/network/forcepoint/sdwan/snmp/clusterload.robot b/tests/network/forcepoint/sdwan/snmp/clusterload.robot new file mode 100644 index 000000000..ff821f549 --- /dev/null +++ b/tests/network/forcepoint/sdwan/snmp/clusterload.robot @@ -0,0 +1,30 @@ +*** Settings *** +Documentation Forcepoint SD-WAN Mode ClusterLoad + +Resource ${CURDIR}${/}../..${/}..${/}..${/}resources/import.resource + +Suite Setup Ctn Generic Suite Setup +Test Timeout 120s + + +*** Variables *** +${CMD} ${CENTREON_PLUGINS} --plugin=network::forcepoint::sdwan::snmp::plugin + +*** Test Cases *** +Cluster-Load ${tc} + [Tags] network forcepoint sdwan snmp + ${command} Catenate + ... ${CMD} + ... --mode=cluster-load + ... --hostname=${HOSTNAME} + ... --snmp-version=${SNMPVERSION} + ... --snmp-port=${SNMPPORT} + ... --snmp-community=network/forcepoint/sdwan/snmp/forcepoint + ... ${extra_options} + + Ctn Run Command And Check Result As Strings ${command} ${expected_result} + + Examples: tc extra_options expected_result -- + ... 1 ${EMPTY} OK: cluster cpu load: 3.00% | 'cluster.cpu.load.percentage'=3.00%;;;0;100 + ... 2 --warning-cpu-load=10: WARNING: cluster cpu load: 3.00% | 'cluster.cpu.load.percentage'=3.00%;10:;;0;100 + ... 3 --critical-cpu-load=5: CRITICAL: cluster cpu load: 3.00% | 'cluster.cpu.load.percentage'=3.00%;;5:;0;100 diff --git a/tests/network/forcepoint/sdwan/snmp/clusterstate.robot b/tests/network/forcepoint/sdwan/snmp/clusterstate.robot new file mode 100644 index 000000000..8d4d34e18 --- /dev/null +++ b/tests/network/forcepoint/sdwan/snmp/clusterstate.robot @@ -0,0 +1,31 @@ +*** Settings *** +Documentation Forcepoint SD-WAN Mode ClusterState + +Resource ${CURDIR}${/}../..${/}..${/}..${/}resources/import.resource + +Suite Setup Ctn Generic Suite Setup +Test Timeout 120s + + +*** Variables *** +${CMD} ${CENTREON_PLUGINS} --plugin=network::forcepoint::sdwan::snmp::plugin + +*** Test Cases *** +ClusterState ${tc} + [Tags] network forcepoint sdwan snmp + ${command} Catenate + ... ${CMD} + ... --mode=cluster-state + ... --hostname=${HOSTNAME} + ... --snmp-version=${SNMPVERSION} + ... --snmp-port=${SNMPPORT} + ... --snmp-community=network/forcepoint/sdwan/snmp/forcepoint + ... ${extra_options} + + Ctn Run Command And Check Result As Strings ${command} ${expected_result} + + Examples: tc extra_options expected_result -- + ... 1 ${EMPTY} OK: Node status is 'standby' [Member id: 2] + ... 2 --warning-status='\\\%{node_status} =~ /standby/i' WARNING: Node status is 'standby' [Member id: 2] + ... 3 --critical-status='\\\%{node_status} =~ /standby/i' CRITICAL: Node status is 'standby' [Member id: 2] + ... 4 --unknown-status='\\\%{node_status} =~ /standby/i' UNKNOWN: Node status is 'standby' [Member id: 2] diff --git a/tests/network/forcepoint/sdwan/snmp/connections.robot b/tests/network/forcepoint/sdwan/snmp/connections.robot new file mode 100644 index 000000000..d889be72b --- /dev/null +++ b/tests/network/forcepoint/sdwan/snmp/connections.robot @@ -0,0 +1,33 @@ +*** Settings *** +Documentation Forcepoint SD-WAN Mode Connections + +Resource ${CURDIR}${/}../..${/}..${/}..${/}resources/import.resource + +Suite Setup Ctn Generic Suite Setup +Test Timeout 120s + + +*** Variables *** +${CMD} ${CENTREON_PLUGINS} --plugin=network::forcepoint::sdwan::snmp::plugin + +*** Test Cases *** +Connections ${tc} + [Tags] network forcepoint sdwan snmp + ${command} Catenate + ... ${CMD} + ... --mode=connections + ... --hostname=${HOSTNAME} + ... --snmp-version=${SNMPVERSION} + ... --snmp-port=${SNMPPORT} + ... --snmp-community=network/forcepoint/sdwan/snmp/forcepoint + ... ${extra_options} + + Ctn Run Command And Check Result As Strings ${command} ${expected_result} + + Examples: tc extra_options expected_result -- + ... 1 ${EMPTY} OK: Total connections : 41, New Connections : 0.00 /s, Discarded Connections : 0.00 /s, Refused Connections : 0.00 /s | 'total_connections'=41con;;;0; 'new_connections'=0.00con/s;;;0; 'discarded_connections'=0.00con/s;;;0; 'refused_connections'=0.00con/s;;;0; + ... 2 --filter-counters=discarded-connections-sec OK: Discarded Connections : 0.00 /s | 'discarded_connections'=0.00con/s;;;0; + ... 3 --warning-total-connections=:1 WARNING: Total connections : 41 | 'total_connections'=41con;0:1;;0; 'new_connections'=0.00con/s;;;0; 'discarded_connections'=0.00con/s;;;0; 'refused_connections'=0.00con/s;;;0; + ... 4 --critical-discarded-connections-sec=1: CRITICAL: Discarded Connections : 0.00 /s | 'total_connections'=41con;;;0; 'new_connections'=0.00con/s;;;0; 'discarded_connections'=0.00con/s;;1:;0; 'refused_connections'=0.00con/s;;;0; + ... 5 --warning-new-connections-sec=1: WARNING: New Connections : 0.00 /s | 'total_connections'=41con;;;0; 'new_connections'=0.00con/s;1:;;0; 'discarded_connections'=0.00con/s;;;0; 'refused_connections'=0.00con/s;;;0; + ... 6 --critical-refused-connections-sec=1: CRITICAL: Refused Connections : 0.00 /s | 'total_connections'=41con;;;0; 'new_connections'=0.00con/s;;;0; 'discarded_connections'=0.00con/s;;;0; 'refused_connections'=0.00con/s;;1:;0; diff --git a/tests/network/forcepoint/sdwan/snmp/diskusage.robot b/tests/network/forcepoint/sdwan/snmp/diskusage.robot new file mode 100644 index 000000000..0b6d7610d --- /dev/null +++ b/tests/network/forcepoint/sdwan/snmp/diskusage.robot @@ -0,0 +1,33 @@ +*** Settings *** +Documentation Forcepoint SD-WAN Mode Diskusage + +Resource ${CURDIR}${/}../..${/}..${/}..${/}resources/import.resource + +Suite Setup Ctn Generic Suite Setup +Test Timeout 120s + + +*** Variables *** +${CMD} ${CENTREON_PLUGINS} --plugin=network::forcepoint::sdwan::snmp::plugin + +*** Test Cases *** +Diskusage ${tc} + [Tags] network forcepoint sdwan snmp + ${command} Catenate + ... ${CMD} + ... --mode=disk-usage + ... --hostname=${HOSTNAME} + ... --snmp-version=${SNMPVERSION} + ... --snmp-port=${SNMPPORT} + ... --snmp-community=network/forcepoint/sdwan/snmp/forcepoint + ... ${extra_options} + + Ctn Run Command And Check Result As Strings ${command} ${expected_result} + + Examples: tc extra_options expected_result -- + ... 1 ${EMPTY} OK: All disks are ok | '/dev/XXXX/disc0/XXXX#disk.space.usage.bytes'=484992B;;;0;484992 '/dev/XXXX/disc0/XXXX#disk.space.free.bytes'=0B;;;0;484992 '/dev/XXXX/disc0/XXXX#disk.space.usage.percentage'=100.00%;;;0;100 '/dev/xxx8#disk.space.usage.bytes'=236900B;;;0;1980080 '/dev/xxx8#disk.space.free.bytes'=1743180B;;;0;1980080 '/dev/xxx8#disk.space.usage.percentage'=11.96%;;;0;100 '/dev/xxx9#disk.space.usage.bytes'=406892B;;;0;3286984 '/dev/xxx9#disk.space.free.bytes'=2880092B;;;0;3286984 '/dev/xxx9#disk.space.usage.percentage'=12.38%;;;0;100 + ... 2 --filter-counters=space-usage-prct OK: All disks are ok | '/dev/XXXX/disc0/XXXX#disk.space.usage.percentage'=100.00%;;;0;100 '/dev/xxx8#disk.space.usage.percentage'=11.96%;;;0;100 '/dev/xxx9#disk.space.usage.percentage'=12.38%;;;0;100 + ... 3 --warning-space-usage=:10000 --filter-name=XXXX WARNING: Disk '/dev/XXXX/disc0/XXXX' space usage total: 473.62 KB used: 473.62 KB (100.00%) free: 0.00 B (0.00%) | '/dev/XXXX/disc0/XXXX#disk.space.usage.bytes'=484992B;0:10000;;0;484992 '/dev/XXXX/disc0/XXXX#disk.space.free.bytes'=0B;;;0;484992 '/dev/XXXX/disc0/XXXX#disk.space.usage.percentage'=100.00%;;;0;100 + ... 4 --warning-space-usage-free=:1000 --filter-name=xxx8 WARNING: Disk '/dev/xxx8' space usage total: 1.89 MB used: 231.35 KB (11.96%) free: 1.66 MB (88.04%) | '/dev/xxx8#disk.space.usage.bytes'=236900B;;;0;1980080 '/dev/xxx8#disk.space.free.bytes'=1743180B;0:1000;;0;1980080 '/dev/xxx8#disk.space.usage.percentage'=11.96%;;;0;100 + ... 5 --critical-space-usage-prct=1000: --filter-name=xxx9 CRITICAL: Disk '/dev/xxx9' space usage total: 3.13 MB used: 397.36 KB (12.38%) free: 2.75 MB (87.62%) | '/dev/xxx9#disk.space.usage.bytes'=406892B;;;0;3286984 '/dev/xxx9#disk.space.free.bytes'=2880092B;;;0;3286984 '/dev/xxx9#disk.space.usage.percentage'=12.38%;;1000:;0;100 + ... 6 --filter-name=NOMATCH UNKNOWN: No disk found. diff --git a/tests/network/forcepoint/sdwan/snmp/droppedpackets.robot b/tests/network/forcepoint/sdwan/snmp/droppedpackets.robot new file mode 100644 index 000000000..9cb7bc159 --- /dev/null +++ b/tests/network/forcepoint/sdwan/snmp/droppedpackets.robot @@ -0,0 +1,31 @@ +*** Settings *** +Documentation Forcepoint SD-WAN Mode DroppedPackets + +Resource ${CURDIR}${/}../..${/}..${/}..${/}resources/import.resource + +Suite Setup Ctn Generic Suite Setup +Test Timeout 120s + + +*** Variables *** +${CMD} ${CENTREON_PLUGINS} --plugin=network::forcepoint::sdwan::snmp::plugin + +*** Test Cases *** +DroppedPackets ${tc} + [Tags] network forcepoint sdwan snmp + ${command} Catenate + ... ${CMD} + ... --mode=dropped-packets + ... --hostname=${HOSTNAME} + ... --snmp-version=${SNMPVERSION} + ... --snmp-port=${SNMPPORT} + ... --snmp-community=network/forcepoint/sdwan/snmp/forcepoint + ... ${extra_options} + + Ctn Run Command And Check Result As Strings ${command} ${expected_result} + + Examples: tc extra_options expected_result -- + ... 1 ${EMPTY} OK: dropped-packets-sec : buffer creation + ... 2 ${EMPTY} OK: Packets Dropped : 0.00 /s | 'dropped.packets.persecond'=0.00packets/s;;;0; + ... 3 --warning-dropped-packets-sec=1: WARNING: Packets Dropped : 0.00 /s | 'dropped.packets.persecond'=0.00packets/s;1:;;0; + ... 4 --critical-dropped-packets-sec=1: CRITICAL: Packets Dropped : 0.00 /s | 'dropped.packets.persecond'=0.00packets/s;;1:;0; diff --git a/tests/network/forcepoint/sdwan/snmp/forcepoint.snmpwalk b/tests/network/forcepoint/sdwan/snmp/forcepoint.snmpwalk new file mode 100644 index 000000000..d233f1eee --- /dev/null +++ b/tests/network/forcepoint/sdwan/snmp/forcepoint.snmpwalk @@ -0,0 +1,24 @@ +.1.3.6.1.4.1.47565.1.1.1.4.0 = Counter64: 41 +.1.3.6.1.4.1.47565.1.1.1.6.0 = Counter64: 21450 +.1.3.6.1.4.1.47565.1.1.1.9.0 = Counter64: 0 +.1.3.6.1.4.1.47565.1.1.1.11.3.1.2.1 = STRING: "/dev/XXXX/disc0/XXXX" +.1.3.6.1.4.1.47565.1.1.1.11.3.1.2.2 = STRING: "/dev/xxx8" +.1.3.6.1.4.1.47565.1.1.1.11.3.1.2.3 = STRING: "/dev/xxx9" +.1.3.6.1.4.1.47565.1.1.1.11.3.1.3.1 = STRING: "/" +.1.3.6.1.4.1.47565.1.1.1.11.3.1.3.2 = STRING: "/xxxx" +.1.3.6.1.4.1.47565.1.1.1.11.3.1.3.3 = STRING: "/xxxX" +.1.3.6.1.4.1.47565.1.1.1.11.3.1.4.1 = Counter64: 484992 +.1.3.6.1.4.1.47565.1.1.1.11.3.1.4.2 = Counter64: 1980080 +.1.3.6.1.4.1.47565.1.1.1.11.3.1.4.3 = Counter64: 3286984 +.1.3.6.1.4.1.47565.1.1.1.11.3.1.5.1 = Counter64: 484992 +.1.3.6.1.4.1.47565.1.1.1.11.3.1.5.2 = Counter64: 236900 +.1.3.6.1.4.1.47565.1.1.1.11.3.1.5.3 = Counter64: 406892 +.1.3.6.1.4.1.47565.1.1.1.11.3.1.6.1 = Counter64: 0 +.1.3.6.1.4.1.47565.1.1.1.11.3.1.6.2 = Counter64: 1743180 +.1.3.6.1.4.1.47565.1.1.1.11.3.1.6.3 = Counter64: 2880092 +.1.3.6.1.4.1.47565.1.1.1.11.4.0 = Counter64: 0 +.1.3.6.1.4.1.47565.1.1.1.11.5.0 = Counter64: 0 +.1.3.6.1.4.1.47565.1.1.1.11.6.0 = Counter64: 0 +.1.3.6.1.4.1.47565.1.1.1.19.2.0 = INTEGER: 2 +.1.3.6.1.4.1.47565.1.1.1.19.3.0 = INTEGER: 9 +.1.3.6.1.4.1.47565.1.1.1.19.4.0 = INTEGER: 3 diff --git a/tests/network/forcepoint/sdwan/snmp/rejectedpackets.robot b/tests/network/forcepoint/sdwan/snmp/rejectedpackets.robot new file mode 100644 index 000000000..fec350632 --- /dev/null +++ b/tests/network/forcepoint/sdwan/snmp/rejectedpackets.robot @@ -0,0 +1,31 @@ +*** Settings *** +Documentation Forcepoint SD-WAN Mode RejectedPackets + +Resource ${CURDIR}${/}../..${/}..${/}..${/}resources/import.resource + +Suite Setup Ctn Generic Suite Setup +Test Timeout 120s + + +*** Variables *** +${CMD} ${CENTREON_PLUGINS} --plugin=network::forcepoint::sdwan::snmp::plugin + +*** Test Cases *** +RejectedPackets ${tc} + [Tags] network forcepoint sdwan snmp + ${command} Catenate + ... ${CMD} + ... --mode=rejected-packets + ... --hostname=${HOSTNAME} + ... --snmp-version=${SNMPVERSION} + ... --snmp-port=${SNMPPORT} + ... --snmp-community=network/forcepoint/sdwan/snmp/forcepoint + ... ${extra_options} + + Ctn Run Command And Check Result As Strings ${command} ${expected_result} + + Examples: tc extra_options expected_result -- + ... 1 ${EMPTY} OK: rejected-packets-sec : buffer creation + ... 2 ${EMPTY} OK: Packets Rejected : 0.00 /s | 'rejected.packets.persecond'=0.00packets/s;;;0; + ... 3 --warning-rejected-packets-sec=1: WARNING: Packets Rejected : 0.00 /s | 'rejected.packets.persecond'=0.00packets/s;1:;;0; + ... 4 --critical-rejected-packets-sec=1: CRITICAL: Packets Rejected : 0.00 /s | 'rejected.packets.persecond'=0.00packets/s;;1:;0; diff --git a/tests/network/forcepoint/sdwan/snmp/standard.robot b/tests/network/forcepoint/sdwan/snmp/standard.robot new file mode 100644 index 000000000..064021409 --- /dev/null +++ b/tests/network/forcepoint/sdwan/snmp/standard.robot @@ -0,0 +1,35 @@ +*** Settings *** +Documentation Forcepoint SD-WAN Standard SNMP Mode + +Resource ${CURDIR}${/}../..${/}..${/}..${/}resources/import.resource + +Suite Setup Ctn Generic Suite Setup +Test Timeout 120s + + +*** Variables *** +${CMD} ${CENTREON_PLUGINS} --plugin=network::forcepoint::sdwan::snmp::plugin + +*** Test Cases *** +Standard ${tc} - ${mode} + [Tags] network forcepoint sdwan snmp + ${command} Catenate + ... ${CMD} + ... --mode=${mode} + ... --help + + # Only check that plugin knowns those modes because they are already tested with os::linux::snmp::plugin + + Ctn Run Command And Check Result As Regexp ${command} ${expected_result} + + Examples: tc mode expected_result -- + ... 1 cpu ^Plugin Description: + ... 2 cpu-detailed ^Plugin Description: + ... 3 interfaces ^Plugin Description: + ... 4 list-interfaces ^Plugin Description: + ... 5 load ^Plugin Description: + ... 6 memory ^Plugin Description: + ... 7 storage ^Plugin Description: + ... 8 swap ^Plugin Description: + ... 9 uptime ^Plugin Description: + diff --git a/tests/resources/spellcheck/stopwords.txt b/tests/resources/spellcheck/stopwords.txt index 4a03fcd3b..4ac0d00a8 100644 --- a/tests/resources/spellcheck/stopwords.txt +++ b/tests/resources/spellcheck/stopwords.txt @@ -96,6 +96,7 @@ fibre --force-counters32 --force-counters64 --force-oid +Forcepoint Fortigate Fortinet FQDN