diff --git a/centreon-plugins/network/paloalto/snmp/mode/sessions.pm b/centreon-plugins/network/paloalto/snmp/mode/sessions.pm index 58d914495..0148c33c2 100644 --- a/centreon-plugins/network/paloalto/snmp/mode/sessions.pm +++ b/centreon-plugins/network/paloalto/snmp/mode/sessions.pm @@ -63,6 +63,18 @@ sub custom_active_output { ); } +sub prefix_global_output { + my ($self, %options) = @_; + + return "Sessions "; +} + +sub prefix_vsys_output { + my ($self, %options) = @_; + + return "Vsys '" . $options{instance_value}->{display} . "' sessions "; +} + sub set_counters { my ($self, %options) = @_; @@ -158,25 +170,14 @@ sub set_counters { ]; } -sub prefix_global_output { - my ($self, %options) = @_; - - return "Sessions "; -} - -sub prefix_vsys_output { - my ($self, %options) = @_; - - return "Vsys '" . $options{instance_value}->{display} . "' sessions "; -} - sub new { my ($class, %options) = @_; - my $self = $class->SUPER::new(package => __PACKAGE__, force_new_perfdata => 1, %options); + my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1); bless $self, $class; $options{options}->add_options(arguments => { - 'add-vsys' => { name => 'add_vsys' }, + 'add-vsys' => { name => 'add_vsys' }, + 'filter-vsys-name:s' => { name => 'filter_vsys_name' } }); return $self; @@ -214,6 +215,12 @@ sub add_vsys { my $instance = $1; my $result = $options{snmp}->map_instance(mapping => $mapping_vsys, results => $snmp_result, instance => $instance); + if (defined($self->{option_results}->{filter_vsys_name}) && $self->{option_results}->{filter_vsys_name} ne '' && + $result->{display} !~ /$self->{option_results}->{filter_vsys_name}/) { + $self->{output}->output_add(long_msg => "skipping '" . $result->{display} . "'.", debug => 1); + next; + } + $self->{vsys}->{$result->{display}} = $result; $self->{vsys}->{$result->{display}}->{sessions_max} = 0 if (!defined($result->{sessions_max})); $self->{vsys}->{$result->{display}}->{sessions_active_prct} = $result->{sessions_active} * 100 / $self->{vsys}->{$result->{display}}->{sessions_max} @@ -247,6 +254,14 @@ Check sessions. =over 8 +=item B<--add-vsys> + +Monitor virtual systems. + +=item B<--filter-vsys-name> + +Filter virtual systems by name (can be a regexp). + =item B<--warning-*> B<--critical-*> Thresholds.