shorter option for filter refs #5643

This commit is contained in:
Kevin Duret 2014-11-10 15:04:30 +01:00
parent 970806d8ae
commit ccc09a4b5c
5 changed files with 14 additions and 16 deletions

View File

@ -50,7 +50,7 @@ sub new {
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"filter-database:s" => { name => 'filter_database', },
"filter:s" => { name => 'filter', },
"skip" => { name => 'skip', },
"skip-no-backup" => { name => 'skip_no_backup', },
});
@ -99,7 +99,7 @@ sub run {
$self->{sql}->query(query => $query);
my $result = $self->{sql}->fetchall_arrayref();
foreach my $row (@$result) {
next if (defined($self->{option_results}->{filter_database}) && $$row[0] !~ /$self->{option_results}->{filter_database}/);
next if (defined($self->{option_results}->{filter}) && $$row[0] !~ /$self->{option_results}->{filter}/);
$count++;
#dbt_backup_start: 0x1686303d8 (dtdays=40599, dttime=7316475) Feb 27 2011 6:46:28:250AM
my $last_backup = $$row[2];
@ -157,7 +157,7 @@ Check MSSQL backup age.
=over 8
=item B<--filter-database>
=item B<--filter>
Filter database.

View File

@ -50,7 +50,7 @@ sub new {
{
"warning:s" => { name => 'warning', },
"critical:s" => { name => 'critical', },
"filter-database:s" => { name => 'filter_database', },
"filter:s" => { name => 'filter', },
"free" => { name => 'free', },
});
@ -86,7 +86,7 @@ sub run {
my @databases_selected;
foreach my $row (@$result) {
next if (defined($self->{option_results}->{filter_database}) && $$row[0] !~ /$self->{option_results}->{filter_database}/);
next if (defined($self->{option_results}->{filter}) && $$row[0] !~ /$self->{option_results}->{filter}/);
push @databases_selected, $$row[0];
}

View File

@ -50,7 +50,7 @@ sub new {
{
"warning:s" => { name => 'warning', },
"critical:s" => { name => 'critical', },
"filter-database:s" => { name => 'filter_database', },
"filter:s" => { name => 'filter', },
});
return $self;
@ -94,8 +94,7 @@ sub run {
$self->{output}->output_add(severity => 'OK',
short_msg => "0 dead locks/s.");
foreach my $row (@$result) {
next if (defined($self->{option_results}->{filter_database}) &&
$$row[0] !~ /$self->{option_results}->{filter_database}/);
next if (defined($self->{option_results}->{filter}) && $$row[0] !~ /$self->{option_results}->{filter}/);
$locks += $$row[1];
}
my $exit_code = $self->{perfdata}->threshold_check(value => $locks, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
@ -133,7 +132,7 @@ Threshold warning number of dead locks per second.
Threshold critical number of dead locks per second.
=item B<--filter-database>
=item B<--filter>
Filter database to check.

View File

@ -53,7 +53,7 @@ sub new {
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"filter-job:s" => { name => 'filter_job', },
"filter:s" => { name => 'filter', },
"skip" => { name => 'skip', },
"warning:s" => { name => 'warning', },
"critical:s" => { name => 'critical', },
@ -89,7 +89,7 @@ sub run {
$self->{sql}->query(query => $query);
my $result = $self->{sql}->fetchall_arrayref();
foreach my $row (@$result) {
next if (defined($self->{option_results}->{filter_job}) && $$row[0] !~ /$self->{option_results}->{filter_job}/);
next if (defined($self->{option_results}->{filter}) && $$row[0] !~ /$self->{option_results}->{filter}/);
$count++;
my $job_name = $$row[0];
my $run_status = $$row[1];
@ -130,7 +130,7 @@ Check MSSQL failed jobs.
=over 8
=item B<--filter-job>
=item B<--filter>
Filter job.

View File

@ -50,7 +50,7 @@ sub new {
{
"warning:s" => { name => 'warning', },
"critical:s" => { name => 'critical', },
"filter-database:s" => { name => 'filter_database', },
"filter:s" => { name => 'filter', },
});
return $self;
@ -94,8 +94,7 @@ sub run {
$self->{output}->output_add(severity => 'OK',
short_msg => "0 Locks Waits/s.");
foreach my $row (@$result) {
next if (defined($self->{option_results}->{filter_database}) &&
$$row[0] !~ /$self->{option_results}->{filter_database}/);
next if (defined($self->{option_results}->{filter}) && $$row[0] !~ /$self->{option_results}->{filter}/);
$locks += $$row[1];
}
my $exit_code = $self->{perfdata}->threshold_check(value => $locks, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
@ -132,7 +131,7 @@ Threshold warning number of lock-waits per second.
Threshold critical number of lock-waits per second.
=item B<--filter-database>
=item B<--filter>
Filter database to check.