+ add filter-type option
This commit is contained in:
parent
e7d322d565
commit
79fb00d942
|
@ -97,7 +97,8 @@ sub new {
|
||||||
|
|
||||||
$self->{version} = '1.0';
|
$self->{version} = '1.0';
|
||||||
$options{options}->add_options(arguments =>
|
$options{options}->add_options(arguments =>
|
||||||
{
|
{
|
||||||
|
"filter-type:s" => { name => 'filter_type' },
|
||||||
});
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
|
@ -124,6 +125,7 @@ sub manage_selection {
|
||||||
my $results = $options{snmp}->get_table(oid => $oid_sophosStatisticsEmail, nothing_quit => 1);
|
my $results = $options{snmp}->get_table(oid => $oid_sophosStatisticsEmail, nothing_quit => 1);
|
||||||
|
|
||||||
$self->{cache_name} = "sophos_es_" . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' . $self->{mode} . '_' .
|
$self->{cache_name} = "sophos_es_" . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' . $self->{mode} . '_' .
|
||||||
|
(defined($self->{option_results}->{filter_type}) ? md5_hex($self->{option_results}->{filter_type}) : md5_hex('all')) . '_' .
|
||||||
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all'));
|
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all'));
|
||||||
|
|
||||||
$self->{global} = { total_in => 0, total_out => 0 };
|
$self->{global} = { total_in => 0, total_out => 0 };
|
||||||
|
@ -135,6 +137,11 @@ sub manage_selection {
|
||||||
my $instance = $1;
|
my $instance = $1;
|
||||||
|
|
||||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $results, instance => $instance);
|
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $results, instance => $instance);
|
||||||
|
if (defined($self->{option_results}->{filter_type}) && $self->{option_results}->{filter_type} ne '' &&
|
||||||
|
$result->{counterType} !~ /$self->{option_results}->{filter_type}/i) {
|
||||||
|
$self->{output}->output_add(long_msg => "skipping '" . $result->{counterType} . "': no matching filter.", debug => 1);
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
$self->{sea_msg}->{lc($result->{counterType})} = { display => lc($result->{counterType}),
|
$self->{sea_msg}->{lc($result->{counterType})} = { display => lc($result->{counterType}),
|
||||||
in => $result->{counterInbound}, out => $result->{counterOutbound}
|
in => $result->{counterInbound}, out => $result->{counterOutbound}
|
||||||
|
@ -155,6 +162,10 @@ Check message statistics.
|
||||||
|
|
||||||
=over 8
|
=over 8
|
||||||
|
|
||||||
|
=item B<--filter-type>
|
||||||
|
|
||||||
|
Filter message type (can be a regexp).
|
||||||
|
|
||||||
=item B<--filter-counters>
|
=item B<--filter-counters>
|
||||||
|
|
||||||
Only display some counters (regexp can be used).
|
Only display some counters (regexp can be used).
|
||||||
|
|
Loading…
Reference in New Issue