fix(typo): isensitive by insensitive (#4660)

This commit is contained in:
qgarnier 2023-11-02 17:46:08 +01:00 committed by GitHub
parent 0dbbc6414e
commit b3f4132f6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 102 additions and 73 deletions

View File

@ -71,11 +71,11 @@ sub check_options {
foreach my $status (split(',', $self->{option_results}->{status_sequence})) {
if (!defined($self->{option_results}->{host}) && $status !~ /^[0-3]$/ && $status !~ /ok|warning|critical|unknown/i) {
$self->{output}->add_option_msg(short_msg => "Status should be in '0,1,2,3' or 'ok,warning,critical,unknown' (case isensitive).");
$self->{output}->add_option_msg(short_msg => "Status should be in '0,1,2,3' or 'ok,warning,critical,unknown' (case insensitive).");
$self->{output}->option_exit();
}
if (defined($self->{option_results}->{host}) && $status !~ /^[0-1]$/ && $status !~ /up|down/i) {
$self->{output}->add_option_msg(short_msg => "Status should be in '0,1' or 'up,down' (case isensitive).");
$self->{output}->add_option_msg(short_msg => "Status should be in '0,1' or 'up,down' (case insensitive).");
$self->{output}->option_exit();
}
push @{$self->{status_sequence}}, $status;

View File

@ -82,7 +82,7 @@ Allows to use storage name with option --storage instead of storage oid index.
Allows to use regexp to filter storage (with option --name).
=item B<--regexp-isensitive>
=item B<--regexp-insensitive>
Allows to use regexp non case-sensitive (with --regexp).

View File

@ -83,7 +83,7 @@ Allows to use storage name with option --storage instead of storage oid index.
Allows to use regexp to filter storage (with option --name).
=item B<--regexp-isensitive>
=item B<--regexp-insensitive>
Allows to use regexp non case-sensitive (with --regexp).

View File

@ -82,7 +82,7 @@ Allows to use storage name with option --storage instead of storage oid index.
Allows to use regexp to filter storage (with option --name).
=item B<--regexp-isensitive>
=item B<--regexp-insensitive>
Allows to use regexp non case-sensitive (with --regexp).

View File

@ -83,7 +83,7 @@ Allows to use storage name with option --storage instead of storage oid index.
Allows to use regexp to filter storage (with option --name).
=item B<--regexp-isensitive>
=item B<--regexp-insensitive>
Allows to use regexp non case-sensitive (with --regexp).

View File

@ -83,7 +83,7 @@ Allows to use storage name with option --storage instead of storage oid index.
Allows to use regexp to filter storage (with option --name).
=item B<--regexp-isensitive>
=item B<--regexp-insensitive>
Allows to use regexp non case-sensitive (with --regexp).

View File

@ -77,7 +77,7 @@ Allows to use storage name with option --storage instead of storage oid index.
Allows to use regexp to filter storage (with option --name).
=item B<--regexp-isensitive>
=item B<--regexp-insensitive>
Allows to use regexp non case-sensitive (with --regexp).

View File

@ -82,7 +82,7 @@ Allows to use storage name with option --storage instead of storage oid index.
Allows to use regexp to filter storage (with option --name).
=item B<--regexp-isensitive>
=item B<--regexp-insensitive>
Allows to use regexp non case-sensitive (with --regexp).

View File

@ -34,16 +34,16 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments =>
{
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"units:s" => { name => 'units', default => '%' },
"free" => { name => 'free' },
"storage:s" => { name => 'storage' },
"regexp" => { name => 'use_regexp' },
"regexp-isensitive" => { name => 'use_regexpi' },
});
$options{options}->add_options(arguments => {
'warning:s' => { name => 'warning' },
'critical:s' => { name => 'critical' },
'units:s' => { name => 'units', default => '%' },
'free' => { name => 'free' },
'storage:s' => { name => 'storage' },
'regexp' => { name => 'use_regexp' },
'regexp-isensitive' => { name => 'use_regexpi' }, # compatibility
'regexp-insensitive' => { name => 'use_regexpi' }
});
$self->{storage_id_selected} = [];
@ -98,17 +98,25 @@ sub run {
my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $total_used);
my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => ($total_size - $total_used));
$self->{output}->output_add(long_msg => sprintf("Partition '%s' Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)", $name_storage,
$total_size_value . " " . $total_size_unit,
$total_used_value . " " . $total_used_unit, $prct_used,
$total_free_value . " " . $total_free_unit, $prct_free));
$self->{output}->output_add(
long_msg => sprintf(
"Partition '%s' Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)", $name_storage,
$total_size_value . " " . $total_size_unit,
$total_used_value . " " . $total_used_unit, $prct_used,
$total_free_value . " " . $total_free_unit, $prct_free
)
);
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1) || (defined($self->{option_results}->{storage}) && !defined($self->{option_results}->{use_regexp}))) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Partition '%s' Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)", $name_storage,
$total_size_value . " " . $total_size_unit,
$total_used_value . " " . $total_used_unit, $prct_used,
$total_free_value . " " . $total_free_unit, $prct_free));
}
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"Partition '%s' Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)", $name_storage,
$total_size_value . " " . $total_size_unit,
$total_used_value . " " . $total_used_unit, $prct_used,
$total_free_value . " " . $total_free_unit, $prct_free
)
);
}
my $label = 'used';
my $value_perf = $total_used;
@ -123,21 +131,29 @@ sub run {
$total_options{total} = $total_size;
$total_options{cast_int} = 1;
}
$self->{output}->perfdata_add(label => $label . $extra_label, unit => 'B',
value => $value_perf,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', %total_options),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', %total_options),
min => 0, max => $total_size);
$self->{output}->perfdata_add(
label => $label . $extra_label,
unit => 'B',
value => $value_perf,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', %total_options),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', %total_options),
min => 0, max => $total_size
);
}
if (!defined($self->{option_results}->{storage}) || defined($self->{option_results}->{use_regexp})) {
$self->{output}->output_add(severity => 'OK',
short_msg => 'All partitions are ok.');
$self->{output}->output_add(
severity => 'OK',
short_msg => 'All partitions are ok.'
);
} elsif ($num_disk_check == 0) {
$self->{output}->output_add(severity => 'OK',
short_msg => 'No usage for partition.');
$self->{output}->output_add(
severity => 'OK',
short_msg => 'No usage for partition.'
);
}
$self->{output}->display();
$self->{output}->exit();
}
@ -145,12 +161,15 @@ sub run {
sub manage_selection {
my ($self, %options) = @_;
$self->{results} = $self->{snmp}->get_multiple_table(oids => [
{ oid => $oid_fwMountPointName },
{ oid => $oid_fwPartitionSize },
{ oid => $oid_fwPartitionUsed }
],
nothing_quit => 1);
$self->{results} = $self->{snmp}->get_multiple_table(
oids => [
{ oid => $oid_fwMountPointName },
{ oid => $oid_fwPartitionSize },
{ oid => $oid_fwPartitionUsed }
],
nothing_quit => 1
);
foreach my $key ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_fwMountPointName}})) {
$key =~ /\.([0-9]+)$/;
my $instance = $1;
@ -222,7 +241,7 @@ Set the storage name (empty means 'check all storage').
Allows to use regexp to filter storage.
=item B<--regexp-isensitive>
=item B<--regexp-insensitive>
Allows to use regexp non case-sensitive (with --regexp).

View File

@ -57,10 +57,11 @@ sub new {
bless $self, $class;
$options{options}->add_options(arguments => {
'filter-fs:s' => { name => 'filter_fs', },
'name:s' => { name => 'name' },
'regexp' => { name => 'use_regexp' },
'regexp-isensitive' => { name => 'use_regexpi' }
'filter-fs:s' => { name => 'filter_fs', },
'name:s' => { name => 'name' },
'regexp' => { name => 'use_regexp' },
'regexp-isensitive' => { name => 'use_regexpi' }, # compatibility
'regexp-insensitive' => { name => 'use_regexpi' }
});
return $self;
@ -138,7 +139,7 @@ Set the storage mount point (empty means 'check all storages')
Allows to use regexp to filter storage mount point (with option --name).
=item B<--regexp-isensitive>
=item B<--regexp-insensitive>
Allows to use regexp non case-sensitive (with --regexp).

View File

@ -134,7 +134,8 @@ sub new {
'free' => { name => 'free' },
'name:s' => { name => 'name' },
'regexp' => { name => 'use_regexp' },
'regexp-isensitive' => { name => 'use_regexpi' },
'regexp-isensitive' => { name => 'use_regexpi' }, # compatibility
'regexp-insensitive' => { name => 'use_regexpi' },
'space-reservation:s' => { name => 'space_reservation' }
});
@ -224,7 +225,7 @@ Set the storage mount point (empty means 'check all storages')
Allows to use regexp to filter storage mount point (with option --name).
=item B<--regexp-isensitive>
=item B<--regexp-insensitive>
Allows to use regexp non case-sensitive (with --regexp).

View File

@ -145,10 +145,11 @@ sub new {
bless $self, $class;
$options{options}->add_options(arguments => {
'name' => { name => 'use_name' },
'device:s' => { name => 'device' },
'regexp' => { name => 'use_regexp' },
'regexp-isensitive' => { name => 'use_regexpi' }
'name' => { name => 'use_name' },
'device:s' => { name => 'device' },
'regexp' => { name => 'use_regexp' },
'regexp-isensitive' => { name => 'use_regexpi' }, # compatibility
'regexp-insensitive' => { name => 'use_regexpi' }
});
return $self;
@ -333,7 +334,7 @@ Allows to use device name with option --device instead of devoce oid index.
Allows to use regexp to filter devices (with option --name).
=item B<--regexp-isensitive>
=item B<--regexp-insensitive>
Allows to use regexp non case-sensitive (with --regexp).

View File

@ -123,6 +123,7 @@ sub new {
'diskpath:s' => { name => 'diskpath' }, # legacy
'regexp' => { name => 'use_regexp' }, # legacy
'regexp-isensitive' => { name => 'use_regexpi' }, # legacy
'regexp-insensitive' => { name => 'use_regexpi' }, # legacy
'display-transform-src:s' => { name => 'display_transform_src' },
'display-transform-dst:s' => { name => 'display_transform_dst' },
'show-cache' => { name => 'show_cache' },

View File

@ -61,7 +61,8 @@ sub new {
'name' => { name => 'use_name' },
'diskpath:s' => { name => 'diskpath' },
'regexp' => { name => 'use_regexp' },
'regexp-isensitive' => { name => 'use_regexpi' },
'regexp-isensitive' => { name => 'use_regexpi' }, # compatibility
'regexp-insensitive' => { name => 'use_regexpi' },
'filter-device:s' => { name => 'filter_device' },
'filter-path:s' => { name => 'filter_path' },
'display-transform-src:s' => { name => 'display_transform_src' },
@ -200,7 +201,7 @@ Allows to use disk path name with option --diskpath instead of disk path oid ind
Allows to use regexp to filter diskpath (with option --name).
=item B<--regexp-isensitive>
=item B<--regexp-insensitive>
Allows to use regexp non case-sensitive (with --regexp).

View File

@ -39,7 +39,8 @@ sub new {
'diskpath:s' => { name => 'diskpath' },
'name' => { name => 'use_name' },
'regexp' => { name => 'use_regexp' },
'regexp-isensitive' => { name => 'use_regexpi' },
'regexp-isensitive' => { name => 'use_regexpi' }, # compatibility
'regexp-insensitive' => { name => 'use_regexpi' },
'display-transform-src:s' => { name => 'display_transform_src' },
'display-transform-dst:s' => { name => 'display_transform_dst' },
'skip-total-size-zero' => { name => 'skip_total_size_zero' }
@ -220,7 +221,7 @@ Allows to use disk path name with option --diskpath instead of disk path oid ind
Allows to use regexp to filter diskpath (with option --name).
=item B<--regexp-isensitive>
=item B<--regexp-insensitive>
Allows to use regexp non case-sensitive (with --regexp).

View File

@ -82,7 +82,8 @@ sub new {
'storage:s' => { name => 'storage' },
'name' => { name => 'use_name' },
'regexp' => { name => 'use_regexp' },
'regexp-isensitive' => { name => 'use_regexpi' },
'regexp-insensitive' => { name => 'use_regexpi' },
'regexp-isensitive' => { name => 'use_regexpi' }, # compatibility
'oid-filter:s' => { name => 'oid_filter', default => 'hrStorageDescr'},
'oid-display:s' => { name => 'oid_display', default => 'hrStorageDescr'},
'display-transform-src:s' => { name => 'display_transform_src' },
@ -301,7 +302,7 @@ Allows to use storage name with option --storage instead of storage oid index.
Allows to use regexp to filter storage (with option --name).
=item B<--regexp-isensitive>
=item B<--regexp-insensitive>
Allows to use regexp non case-sensitive (with --regexp).

View File

@ -252,7 +252,8 @@ sub new {
'name' => { name => 'use_name' },
'storage:s' => { name => 'storage' },
'regexp' => { name => 'use_regexp' },
'regexp-isensitive' => { name => 'use_regexpi' },
'regexp-isensitive' => { name => 'use_regexpi' }, # compatibility
'regexp-insensitive' => { name => 'use_regexpi' },
'path-best-match' => { name => 'use_path_best_match' },
'oid-filter:s' => { name => 'oid_filter', default => 'hrStorageDescr'},
'oid-display:s' => { name => 'oid_display', default => 'hrStorageDescr'},
@ -644,7 +645,7 @@ Allows to use storage name with option --storage instead of storage oid index.
Allows to use regexp to filter storage (with option --name).
=item B<--regexp-isensitive>
=item B<--regexp-insensitive>
Allows to use regexp non case-sensitive (with --regexp).

View File

@ -42,7 +42,8 @@ sub new {
'warning-regexp:s' => { name => 'warning_regexp' },
'critical-regexp:s' => { name => 'critical_regexp' },
'unknown-regexp:s' => { name => 'unknown_regexp' },
'regexp-isensitive' => { name => 'use_iregexp' },
'regexp-isensitive' => { name => 'use_iregexp' }, # compatibility
'regexp-insensitive' => { name => 'use_iregexp' },
'warning-absent:s@' => { name => 'warning_absent' },
'critical-absent:s@' => { name => 'critical_absent' },
@ -360,7 +361,7 @@ Return Warning if an oid value match the regexp.
Return Critical if an oid value match the regexp.
=item B<--regexp-isensitive>
=item B<--regexp-insensitive>
Allows to use regexp non case-sensitive.

View File

@ -91,10 +91,11 @@ sub new {
bless $self, $class;
$options{options}->add_options(arguments => {
'name' => { name => 'use_name' },
'filesystem:s' => { name => 'filesystem' },
'regexp' => { name => 'use_regexp' },
'regexp-isensitive' => { name => 'use_regexpi' }
'name' => { name => 'use_name' },
'filesystem:s' => { name => 'filesystem' },
'regexp' => { name => 'use_regexp' },
'regexp-isensitive' => { name => 'use_regexpi' }, # compatibility
'regexp-insensitive' => { name => 'use_regexpi' }
});
return $self;
@ -229,7 +230,7 @@ Allows to use filesystem name with option --filesystem instead of devoce oid ind
Allows to use regexp to filter filesystems (with option --name).
=item B<--regexp-isensitive>
=item B<--regexp-insensitive>
Allows to use regexp non case-sensitive to filter filesystems (with option --name).