+ change filter
This commit is contained in:
parent
e46ed8941e
commit
e42de5927a
|
@ -38,7 +38,8 @@ sub new {
|
||||||
"oid-leef:s" => { name => 'oid_leef' },
|
"oid-leef:s" => { name => 'oid_leef' },
|
||||||
"oid-table:s" => { name => 'oid_table' },
|
"oid-table:s" => { name => 'oid_table' },
|
||||||
"oid-instance:s" => { name => 'oid_instance' },
|
"oid-instance:s" => { name => 'oid_instance' },
|
||||||
"filter-table:s" => { name => 'filter_table' },
|
"filter-table-value:s" => { name => 'filter_table_value' },
|
||||||
|
"filter-table-instance:s" => { name => 'filter_table_instance' },
|
||||||
|
|
||||||
"warning-regexp:s" => { name => 'warning_regexp' },
|
"warning-regexp:s" => { name => 'warning_regexp' },
|
||||||
"critical-regexp:s" => { name => 'critical_regexp' },
|
"critical-regexp:s" => { name => 'critical_regexp' },
|
||||||
|
@ -147,11 +148,16 @@ sub get_snmp_values {
|
||||||
my $instance = $self->get_instance_value(instance => $1);
|
my $instance = $self->get_instance_value(instance => $1);
|
||||||
my $value = $self->get_map_value(value => $self->{results}->{$_});
|
my $value = $self->get_map_value(value => $self->{results}->{$_});
|
||||||
$self->{output}->output_add(long_msg => sprintf("[instance: %s][value: %s]", $_, $value), debug => 1);
|
$self->{output}->output_add(long_msg => sprintf("[instance: %s][value: %s]", $_, $value), debug => 1);
|
||||||
if (defined($self->{option_results}->{filter_table}) && $self->{option_results}->{filter_table} ne '' &&
|
if (defined($self->{option_results}->{filter_table_value}) && $self->{option_results}->{filter_table_value} ne '' &&
|
||||||
$value !~ /$self->{option_results}->{filter_table}/) {
|
$value !~ /$self->{option_results}->{filter_table_value}/) {
|
||||||
$self->{output}->output_add(long_msg => sprintf("skipping oid '%s' value '%s': not matching the filter", $_, $value), debug => 1);
|
$self->{output}->output_add(long_msg => sprintf("skipping oid '%s' value '%s': not matching the filter", $_, $value), debug => 1);
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
if (defined($self->{option_results}->{filter_table_instance}) && $self->{option_results}->{filter_table_instance} ne '' &&
|
||||||
|
$instance !~ /$self->{option_results}->{filter_table_instance}/) {
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("skipping oid '%s' instance '%s': not matching the filter", $_, $instance), debug => 1);
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
$self->{instances}->{$instance} = $value;
|
$self->{instances}->{$instance} = $value;
|
||||||
$filter_row++;
|
$filter_row++;
|
||||||
|
@ -304,7 +310,7 @@ Check SNMP string values (can be a String or an Integer).
|
||||||
|
|
||||||
Check values absent:
|
Check values absent:
|
||||||
centreon_plugins.pl --plugin=snmp_standard::plugin --mode=string-value --hostname=127.0.0.1 --snmp-version=2c --snmp-community=public
|
centreon_plugins.pl --plugin=snmp_standard::plugin --mode=string-value --hostname=127.0.0.1 --snmp-version=2c --snmp-community=public
|
||||||
--oid-table='.1.3.6.1.2.1.25.4.2.1.2' --format-ok='%{filter_rows} processes' --format-critical='processes are absent: %{details_critical}' --critical-absent='centengine' --critical-absent='crond' --filter-table='centengine|crond'
|
--oid-table='.1.3.6.1.2.1.25.4.2.1.2' --format-ok='%{filter_rows} processes' --format-critical='processes are absent: %{details_critical}' --critical-absent='centengine' --critical-absent='crond' --filter-table-value='centengine|crond'
|
||||||
|
|
||||||
Check table status:
|
Check table status:
|
||||||
centreon_plugins.pl --plugin=snmp_standard::plugin --mode=string-value --hostname=127.0.0.1 --snmp-version=2c --snmp-community=akcp
|
centreon_plugins.pl --plugin=snmp_standard::plugin --mode=string-value --hostname=127.0.0.1 --snmp-version=2c --snmp-community=akcp
|
||||||
|
@ -329,10 +335,14 @@ OID table value to check (numeric format only).
|
||||||
OID table value for the instance (numeric format only).
|
OID table value for the instance (numeric format only).
|
||||||
Can be used to have human readable instance name.
|
Can be used to have human readable instance name.
|
||||||
|
|
||||||
=item B<--filter-table>
|
=item B<--filter-table-value>
|
||||||
|
|
||||||
Filter value from --oid-table option (can be a regexp).
|
Filter value from --oid-table option (can be a regexp).
|
||||||
|
|
||||||
|
=item B<--filter-table-instance>
|
||||||
|
|
||||||
|
Filter instance from --oid-table option (can be a regexp).
|
||||||
|
|
||||||
=item B<--warning-regexp>
|
=item B<--warning-regexp>
|
||||||
|
|
||||||
Return Warning if an oid value match the regexp.
|
Return Warning if an oid value match the regexp.
|
||||||
|
|
Loading…
Reference in New Issue