mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-30 00:55:18 +02:00
Ctor 1019 plugin centreon plugin applications databases postgresql modes hitratio and backends exclude option is behaving the opposite way more like a filter (#5262)
CTOR-1019 fix(plugin): fix option exclude
This commit is contained in:
parent
938557e2fd
commit
39d6d4bbf9
@ -89,7 +89,7 @@ sub run {
|
|||||||
my $result = $options{sql}->fetchall_arrayref();
|
my $result = $options{sql}->fetchall_arrayref();
|
||||||
|
|
||||||
foreach my $row (@{$result}) {
|
foreach my $row (@{$result}) {
|
||||||
if (defined($self->{option_results}->{exclude}) && $$row[2] !~ /$self->{option_results}->{exclude}/) {
|
if (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} ne '' && $$row[2] =~ /$self->{option_results}->{exclude}/) {
|
||||||
$self->{output}->output_add(long_msg => "Skipping database '" . $$row[2] . '"');
|
$self->{output}->output_add(long_msg => "Skipping database '" . $$row[2] . '"');
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ sub run {
|
|||||||
$new_datas->{$row->[2] . '_blks_hit'} = $row->[0];
|
$new_datas->{$row->[2] . '_blks_hit'} = $row->[0];
|
||||||
$new_datas->{$row->[2] . '_blks_read'} = $row->[1];
|
$new_datas->{$row->[2] . '_blks_read'} = $row->[1];
|
||||||
|
|
||||||
if (defined($self->{option_results}->{exclude}) && $row->[2] !~ /$self->{option_results}->{exclude}/) {
|
if (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} ne '' && $row->[2] =~ /$self->{option_results}->{exclude}/) {
|
||||||
$self->{output}->output_add(long_msg => "Skipping database '" . $row->[2] . '"');
|
$self->{output}->output_add(long_msg => "Skipping database '" . $row->[2] . '"');
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
@ -165,7 +165,7 @@ __END__
|
|||||||
|
|
||||||
=head1 MODE
|
=head1 MODE
|
||||||
|
|
||||||
Check hitratio (in buffer cache) for databases.
|
Check hit ratio (in buffer cache) for databases.
|
||||||
|
|
||||||
=over 8
|
=over 8
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ sub manage_selection {
|
|||||||
);
|
);
|
||||||
$self->{list_db} = [];
|
$self->{list_db} = [];
|
||||||
while ((my $row = $self->{sql}->fetchrow_hashref())) {
|
while ((my $row = $self->{sql}->fetchrow_hashref())) {
|
||||||
if (defined($self->{option_results}->{exclude}) && $row->{datname} !~ /$self->{option_results}->{exclude}/) {
|
if (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} ne '' && $row->{datname} =~ /$self->{option_results}->{exclude}/) {
|
||||||
$self->{output}->output_add(long_msg => "Skipping database '" . $row->{datname} . "': no matching filter name");
|
$self->{output}->output_add(long_msg => "Skipping database '" . $row->{datname} . "': no matching filter name");
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
@ -87,9 +87,7 @@ sub run {
|
|||||||
my $dblocks = {};
|
my $dblocks = {};
|
||||||
foreach my $row (@{$result}) {
|
foreach my $row (@{$result}) {
|
||||||
my ($granted, $mode, $dbname) = ($$row[0], $$row[1], $$row[2]);
|
my ($granted, $mode, $dbname) = ($$row[0], $$row[1], $$row[2]);
|
||||||
if (defined($self->{option_results}->{exclude}) && $dbname !~ /$self->{option_results}->{exclude}/) {
|
next if (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} ne '' && $dbname =~ /$self->{option_results}->{exclude}/);
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!defined($dblocks->{$dbname})) {
|
if (!defined($dblocks->{$dbname})) {
|
||||||
$dblocks->{$dbname} = {total => 0, waiting => 0};
|
$dblocks->{$dbname} = {total => 0, waiting => 0};
|
||||||
@ -155,12 +153,12 @@ Check locks for one or more databases
|
|||||||
=item B<--warning>
|
=item B<--warning>
|
||||||
|
|
||||||
Warning threshold. (example: "total=250,waiting=5,exclusive=20")
|
Warning threshold. (example: "total=250,waiting=5,exclusive=20")
|
||||||
'total', 'waiting', or the name of a lock type used by Postgres.
|
'total', 'waiting', or the name of a lock type used by PostgreSQL.
|
||||||
|
|
||||||
=item B<--critical>
|
=item B<--critical>
|
||||||
|
|
||||||
Critical threshold. (example: "total=250,waiting=5,exclusive=20")
|
Critical threshold. (example: "total=250,waiting=5,exclusive=20")
|
||||||
'total', 'waiting', or the name of a lock type used by Postgres.
|
'total', 'waiting', or the name of a lock type used by PostgreSQL.
|
||||||
|
|
||||||
=item B<--exclude>
|
=item B<--exclude>
|
||||||
|
|
||||||
|
@ -98,6 +98,7 @@ ldap
|
|||||||
--legacy-api-beta
|
--legacy-api-beta
|
||||||
license-instances-usage-prct
|
license-instances-usage-prct
|
||||||
Loggly
|
Loggly
|
||||||
|
--lookback
|
||||||
--lookup-perfdatas-nagios
|
--lookup-perfdatas-nagios
|
||||||
machineaccount
|
machineaccount
|
||||||
--map-speed-dsl
|
--map-speed-dsl
|
||||||
@ -134,6 +135,7 @@ Netscaler
|
|||||||
net-snmp
|
net-snmp
|
||||||
NLCapacity
|
NLCapacity
|
||||||
--noeventlog
|
--noeventlog
|
||||||
|
--noidle
|
||||||
-NoLogo
|
-NoLogo
|
||||||
--nomachineaccount
|
--nomachineaccount
|
||||||
--ntlmv2
|
--ntlmv2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user