mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-28 08:04:36 +02:00
enh(linux/local): add exclude options (#3249)
This commit is contained in:
parent
cf8adf7e24
commit
397d8cc608
@ -56,6 +56,12 @@ sub custom_utils_calc {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub prefix_device_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
return "Device '" . $options{instance_value}->{display} . "' ";
|
||||||
|
}
|
||||||
|
|
||||||
sub set_counters {
|
sub set_counters {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
@ -128,12 +134,6 @@ sub set_counters {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
sub prefix_device_output {
|
|
||||||
my ($self, %options) = @_;
|
|
||||||
|
|
||||||
return "Device '" . $options{instance_value}->{display} . "' ";
|
|
||||||
}
|
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
|
||||||
@ -141,6 +141,7 @@ sub new {
|
|||||||
|
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
'filter-partition-name:s' => { name => 'filter_partition_name' },
|
'filter-partition-name:s' => { name => 'filter_partition_name' },
|
||||||
|
'exclude-partition-name:s' => { name => 'exclude_partition_name' },
|
||||||
'interrupt-frequency:s' => { name => 'interrupt_frequency', default => 1000 },
|
'interrupt-frequency:s' => { name => 'interrupt_frequency', default => 1000 },
|
||||||
'bytes-per-sector:s' => { name => 'bytes_per_sector', default => 512 },
|
'bytes-per-sector:s' => { name => 'bytes_per_sector', default => 512 },
|
||||||
'skip' => { name => 'skip' }
|
'skip' => { name => 'skip' }
|
||||||
@ -175,6 +176,8 @@ sub manage_selection {
|
|||||||
|
|
||||||
next if (defined($self->{option_results}->{filter_partition_name}) && $self->{option_results}->{filter_partition_name} ne '' &&
|
next if (defined($self->{option_results}->{filter_partition_name}) && $self->{option_results}->{filter_partition_name} ne '' &&
|
||||||
$partition_name !~ /$self->{option_results}->{filter_partition_name}/);
|
$partition_name !~ /$self->{option_results}->{filter_partition_name}/);
|
||||||
|
next if (defined($self->{option_results}->{exclude_partition_name}) && $self->{option_results}->{exclude_partition_name} ne '' &&
|
||||||
|
$partition_name =~ /$self->{option_results}->{exclude_partition_name}/);
|
||||||
|
|
||||||
if (defined($self->{option_results}->{skip}) && $read_sector == 0 && $write_sector == 0) {
|
if (defined($self->{option_results}->{skip}) && $read_sector == 0 && $write_sector == 0) {
|
||||||
$self->{output}->output_add(long_msg => "skipping device '" . $partition_name . "': no read/write IO.", debug => 1);
|
$self->{output}->output_add(long_msg => "skipping device '" . $partition_name . "': no read/write IO.", debug => 1);
|
||||||
@ -223,47 +226,6 @@ Command used: tail -n +1 /proc/stat /proc/diskstats 2>&1
|
|||||||
|
|
||||||
=over 8
|
=over 8
|
||||||
|
|
||||||
=item B<--remote>
|
|
||||||
|
|
||||||
Execute command remotely in 'ssh'.
|
|
||||||
|
|
||||||
=item B<--hostname>
|
|
||||||
|
|
||||||
Hostname to query (need --remote).
|
|
||||||
|
|
||||||
=item B<--ssh-option>
|
|
||||||
|
|
||||||
Specify multiple options like the user (example: --ssh-option='-l=centreon-engine' --ssh-option='-p=52').
|
|
||||||
|
|
||||||
=item B<--ssh-path>
|
|
||||||
|
|
||||||
Specify ssh command path (default: none)
|
|
||||||
|
|
||||||
=item B<--ssh-command>
|
|
||||||
|
|
||||||
Specify ssh command (default: 'ssh'). Useful to use 'plink'.
|
|
||||||
|
|
||||||
=item B<--timeout>
|
|
||||||
|
|
||||||
Timeout in seconds for the command (Default: 30).
|
|
||||||
|
|
||||||
=item B<--sudo>
|
|
||||||
|
|
||||||
Use 'sudo' to execute the command.
|
|
||||||
|
|
||||||
=item B<--command>
|
|
||||||
|
|
||||||
Command to get information (Default: 'tail').
|
|
||||||
Can be changed if you have output in a file.
|
|
||||||
|
|
||||||
=item B<--command-path>
|
|
||||||
|
|
||||||
Command path (Default: none).
|
|
||||||
|
|
||||||
=item B<--command-options>
|
|
||||||
|
|
||||||
Command options (Default: '-n +1 /proc/stat /proc/diskstats 2>&1').
|
|
||||||
|
|
||||||
=item B<--warning-*> B<--critical-*>
|
=item B<--warning-*> B<--critical-*>
|
||||||
|
|
||||||
Thresholds.
|
Thresholds.
|
||||||
@ -274,6 +236,10 @@ Can be: 'read-usage', 'write-usage', 'read-time', 'write-time',
|
|||||||
|
|
||||||
Filter partition name (regexp can be used).
|
Filter partition name (regexp can be used).
|
||||||
|
|
||||||
|
=item B<--exclude-partition-name>
|
||||||
|
|
||||||
|
Exclude partition name (regexp can be used).
|
||||||
|
|
||||||
=item B<--bytes-per-sector>
|
=item B<--bytes-per-sector>
|
||||||
|
|
||||||
Bytes per sector (Default: 512)
|
Bytes per sector (Default: 512)
|
||||||
|
@ -25,6 +25,12 @@ use base qw(centreon::plugins::templates::counter);
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
|
sub prefix_inodes_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
return "Inodes partition '" . $options{instance_value}->{display} . "' ";
|
||||||
|
}
|
||||||
|
|
||||||
sub set_counters {
|
sub set_counters {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
@ -45,21 +51,17 @@ sub set_counters {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
sub prefix_inodes_output {
|
|
||||||
my ($self, %options) = @_;
|
|
||||||
|
|
||||||
return "Inodes partition '" . $options{instance_value}->{display} . "' ";
|
|
||||||
}
|
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
'filter-type:s' => { name => 'filter_type', },
|
'filter-type:s' => { name => 'filter_type' },
|
||||||
'filter-fs:s' => { name => 'filter_fs', },
|
'filter-fs:s' => { name => 'filter_fs' },
|
||||||
'filter-mountpoint:s' => { name => 'filter_mountpoint' }
|
'exclude-fs:s' => { name => 'exclude_fs' },
|
||||||
|
'filter-mountpoint:s' => { name => 'filter_mountpoint' },
|
||||||
|
'exclude-mountpoint:s' => { name => 'exclude_mountpoint' }
|
||||||
});
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
@ -82,10 +84,14 @@ sub manage_selection {
|
|||||||
|
|
||||||
next if (defined($self->{option_results}->{filter_fs}) && $self->{option_results}->{filter_fs} ne '' &&
|
next if (defined($self->{option_results}->{filter_fs}) && $self->{option_results}->{filter_fs} ne '' &&
|
||||||
$fs !~ /$self->{option_results}->{filter_fs}/);
|
$fs !~ /$self->{option_results}->{filter_fs}/);
|
||||||
|
next if (defined($self->{option_results}->{exclude_fs}) && $self->{option_results}->{exclude_fs} ne '' &&
|
||||||
|
$fs =~ /$self->{option_results}->{exclude_fs}/);
|
||||||
next if (defined($self->{option_results}->{filter_type}) && $self->{option_results}->{filter_type} ne '' &&
|
next if (defined($self->{option_results}->{filter_type}) && $self->{option_results}->{filter_type} ne '' &&
|
||||||
$type !~ /$self->{option_results}->{filter_type}/);
|
$type !~ /$self->{option_results}->{filter_type}/);
|
||||||
next if (defined($self->{option_results}->{filter_mountpoint}) && $self->{option_results}->{filter_mountpoint} ne '' &&
|
next if (defined($self->{option_results}->{filter_mountpoint}) && $self->{option_results}->{filter_mountpoint} ne '' &&
|
||||||
$mount !~ /$self->{option_results}->{filter_mountpoint}/);
|
$mount !~ /$self->{option_results}->{filter_mountpoint}/);
|
||||||
|
next if (defined($self->{option_results}->{exclude_mountpoint}) && $self->{option_results}->{exclude_mountpoint} ne '' &&
|
||||||
|
$mount =~ /$self->{option_results}->{exclude_mountpoint}/);
|
||||||
|
|
||||||
$percent =~ s/%//g;
|
$percent =~ s/%//g;
|
||||||
next if ($percent eq '-');
|
next if ($percent eq '-');
|
||||||
@ -125,6 +131,10 @@ Threshold critical in percent.
|
|||||||
|
|
||||||
Filter filesystem mount point (regexp can be used).
|
Filter filesystem mount point (regexp can be used).
|
||||||
|
|
||||||
|
=item B<--exclude-mountpoint>
|
||||||
|
|
||||||
|
Exclude filesystem mount point (regexp can be used).
|
||||||
|
|
||||||
=item B<--filter-type>
|
=item B<--filter-type>
|
||||||
|
|
||||||
Filter filesystem type (regexp can be used).
|
Filter filesystem type (regexp can be used).
|
||||||
@ -133,6 +143,10 @@ Filter filesystem type (regexp can be used).
|
|||||||
|
|
||||||
Filter filesystem (regexp can be used).
|
Filter filesystem (regexp can be used).
|
||||||
|
|
||||||
|
=item B<--exclude-fs>
|
||||||
|
|
||||||
|
Exclude filesystem (regexp can be used).
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
@ -67,7 +67,9 @@ sub new {
|
|||||||
|
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
'filter-device:s' => { name => 'filter_device' },
|
'filter-device:s' => { name => 'filter_device' },
|
||||||
|
'exclude-device:s' => { name => 'exclude_device' },
|
||||||
'filter-mountpoint:s' => { name => 'filter_mountpoint' },
|
'filter-mountpoint:s' => { name => 'filter_mountpoint' },
|
||||||
|
'exclude-mountpoint:s' => { name => 'exclude_mountpoint' },
|
||||||
'filter-type:s' => { name => 'filter_type' }
|
'filter-type:s' => { name => 'filter_type' }
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -90,21 +92,16 @@ sub manage_selection {
|
|||||||
next if ($line !~ /^\s*(.*?)\s+on\s+(.*?)\s+type\s+(\S+)\s+\((.*)\)/);
|
next if ($line !~ /^\s*(.*?)\s+on\s+(.*?)\s+type\s+(\S+)\s+\((.*)\)/);
|
||||||
my ($device, $mountpoint, $type, $options) = ($1, $2, $3, $4);
|
my ($device, $mountpoint, $type, $options) = ($1, $2, $3, $4);
|
||||||
|
|
||||||
if (defined($self->{option_results}->{filter_type}) && $self->{option_results}->{filter_type} ne '' &&
|
next if (defined($self->{option_results}->{filter_type}) && $self->{option_results}->{filter_type} ne '' &&
|
||||||
$type !~ /$self->{option_results}->{filter_type}/) {
|
$type !~ /$self->{option_results}->{filter_type}/);
|
||||||
$self->{output}->output_add(long_msg => "skipping '" . $mountpoint . "': no matching filter.", debug => 1);
|
next if (defined($self->{option_results}->{filter_device}) && $self->{option_results}->{filter_device} ne '' &&
|
||||||
next;
|
$device !~ /$self->{option_results}->{filter_device}/);
|
||||||
}
|
next if (defined($self->{option_results}->{exclude_device}) && $self->{option_results}->{exclude_device} ne '' &&
|
||||||
if (defined($self->{option_results}->{filter_device}) && $self->{option_results}->{filter_device} ne '' &&
|
$device =~ /$self->{option_results}->{exclude_device}/);
|
||||||
$device !~ /$self->{option_results}->{filter_device}/) {
|
next if (defined($self->{option_results}->{filter_mountpoint}) && $self->{option_results}->{filter_mountpoint} ne '' &&
|
||||||
$self->{output}->output_add(long_msg => "skipping '" . $mountpoint . "': no matching filter.", debug => 1);
|
$mountpoint !~ /$self->{option_results}->{filter_mountpoint}/);
|
||||||
next;
|
next if (defined($self->{option_results}->{exclude_mountpoint}) && $self->{option_results}->{exclude_mountpoint} ne '' &&
|
||||||
}
|
$mountpoint =~ /$self->{option_results}->{exclude_mountpoint}/);
|
||||||
if (defined($self->{option_results}->{filter_mountpoint}) && $self->{option_results}->{filter_mountpoint} ne '' &&
|
|
||||||
$mountpoint !~ /$self->{option_results}->{filter_mountpoint}/) {
|
|
||||||
$self->{output}->output_add(long_msg => "skipping '" . $mountpoint . "': no matching filter.", debug => 1);
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
$self->{mountpoints}->{$mountpoint} = {
|
$self->{mountpoints}->{$mountpoint} = {
|
||||||
display => $mountpoint,
|
display => $mountpoint,
|
||||||
@ -135,10 +132,18 @@ Command used: mount 2>&1
|
|||||||
|
|
||||||
Filter mount point name (Can use regexp).
|
Filter mount point name (Can use regexp).
|
||||||
|
|
||||||
|
=item B<--exclude-mountpoint>
|
||||||
|
|
||||||
|
Exclude mount point name (Can use regexp).
|
||||||
|
|
||||||
=item B<--filter-device>
|
=item B<--filter-device>
|
||||||
|
|
||||||
Filter device name (Can use regexp).
|
Filter device name (Can use regexp).
|
||||||
|
|
||||||
|
=item B<--exclude-device>
|
||||||
|
|
||||||
|
Exclude device name (Can use regexp).
|
||||||
|
|
||||||
=item B<--filter-type>
|
=item B<--filter-type>
|
||||||
|
|
||||||
Filter mount point type (Can use regexp).
|
Filter mount point type (Can use regexp).
|
||||||
|
@ -130,6 +130,7 @@ sub new {
|
|||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
'filter-state:s' => { name => 'filter_state', },
|
'filter-state:s' => { name => 'filter_state', },
|
||||||
'filter-interface:s' => { name => 'filter_interface' },
|
'filter-interface:s' => { name => 'filter_interface' },
|
||||||
|
'exclude-interface:s' => { name => 'exclude_interface' },
|
||||||
'no-loopback' => { name => 'no_loopback' }
|
'no-loopback' => { name => 'no_loopback' }
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -188,6 +189,8 @@ sub do_selection {
|
|||||||
$states !~ /$self->{option_results}->{filter_state}/);
|
$states !~ /$self->{option_results}->{filter_state}/);
|
||||||
next if (defined($self->{option_results}->{filter_interface}) && $self->{option_results}->{filter_interface} ne '' &&
|
next if (defined($self->{option_results}->{filter_interface}) && $self->{option_results}->{filter_interface} ne '' &&
|
||||||
$interface_name !~ /$self->{option_results}->{filter_interface}/);
|
$interface_name !~ /$self->{option_results}->{filter_interface}/);
|
||||||
|
next if (defined($self->{option_results}->{exclude_interface}) && $self->{option_results}->{exclude_interface} ne '' &&
|
||||||
|
$interface_name =~ /$self->{option_results}->{exclude_interface}/);
|
||||||
|
|
||||||
$self->{interface}->{$interface_name} = {
|
$self->{interface}->{$interface_name} = {
|
||||||
display => $interface_name,
|
display => $interface_name,
|
||||||
@ -232,47 +235,6 @@ Command used: /sbin/ip -s addr 2>&1
|
|||||||
|
|
||||||
=over 8
|
=over 8
|
||||||
|
|
||||||
=item B<--remote>
|
|
||||||
|
|
||||||
Execute command remotely in 'ssh'.
|
|
||||||
|
|
||||||
=item B<--hostname>
|
|
||||||
|
|
||||||
Hostname to query (need --remote).
|
|
||||||
|
|
||||||
=item B<--ssh-option>
|
|
||||||
|
|
||||||
Specify multiple options like the user (example: --ssh-option='-l=centreon-engine' --ssh-option='-p=52').
|
|
||||||
|
|
||||||
=item B<--ssh-path>
|
|
||||||
|
|
||||||
Specify ssh command path (default: none)
|
|
||||||
|
|
||||||
=item B<--ssh-command>
|
|
||||||
|
|
||||||
Specify ssh command (default: 'ssh'). Useful to use 'plink'.
|
|
||||||
|
|
||||||
=item B<--timeout>
|
|
||||||
|
|
||||||
Timeout in seconds for the command (Default: 30).
|
|
||||||
|
|
||||||
=item B<--sudo>
|
|
||||||
|
|
||||||
Use 'sudo' to execute the command.
|
|
||||||
|
|
||||||
=item B<--command>
|
|
||||||
|
|
||||||
Command to get information (Default: 'ip').
|
|
||||||
Can be changed if you have output in a file.
|
|
||||||
|
|
||||||
=item B<--command-path>
|
|
||||||
|
|
||||||
Command path (Default: '/sbin').
|
|
||||||
|
|
||||||
=item B<--command-options>
|
|
||||||
|
|
||||||
Command options (Default: '-s addr 2>&1').
|
|
||||||
|
|
||||||
=item B<--warning-*>
|
=item B<--warning-*>
|
||||||
|
|
||||||
Threshold warning in percent of total packets. Can be:
|
Threshold warning in percent of total packets. Can be:
|
||||||
@ -287,6 +249,10 @@ in-error, out-error, in-discard, out-discard
|
|||||||
|
|
||||||
Filter interface name (regexp can be used).
|
Filter interface name (regexp can be used).
|
||||||
|
|
||||||
|
=item B<--exclude-interface>
|
||||||
|
|
||||||
|
Exclude interface name (regexp can be used).
|
||||||
|
|
||||||
=item B<--filter-state>
|
=item B<--filter-state>
|
||||||
|
|
||||||
Filter filesystem type (regexp can be used).
|
Filter filesystem type (regexp can be used).
|
||||||
|
@ -168,7 +168,9 @@ sub new {
|
|||||||
|
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
'filter-command:s' => { name => 'filter_command' },
|
'filter-command:s' => { name => 'filter_command' },
|
||||||
|
'exclude-command:s' => { name => 'exclude_command' },
|
||||||
'filter-arg:s' => { name => 'filter_arg' },
|
'filter-arg:s' => { name => 'filter_arg' },
|
||||||
|
'exclude-arg:s' => { name => 'exclude_arg' },
|
||||||
'filter-state:s' => { name => 'filter_state' },
|
'filter-state:s' => { name => 'filter_state' },
|
||||||
'filter-ppid:s' => { name => 'filter_ppid' },
|
'filter-ppid:s' => { name => 'filter_ppid' },
|
||||||
'add-cpu' => { name => 'add_cpu' },
|
'add-cpu' => { name => 'add_cpu' },
|
||||||
@ -218,8 +220,12 @@ sub parse_output {
|
|||||||
|
|
||||||
next if (defined($self->{option_results}->{filter_command}) && $self->{option_results}->{filter_command} ne '' &&
|
next if (defined($self->{option_results}->{filter_command}) && $self->{option_results}->{filter_command} ne '' &&
|
||||||
$cmd !~ /$self->{option_results}->{filter_command}/);
|
$cmd !~ /$self->{option_results}->{filter_command}/);
|
||||||
|
next if (defined($self->{option_results}->{exclude_command}) && $self->{option_results}->{exclude_command} ne '' &&
|
||||||
|
$cmd =~ /$self->{option_results}->{exclude_command}/);
|
||||||
next if (defined($self->{option_results}->{filter_arg}) && $self->{option_results}->{filter_arg} ne '' &&
|
next if (defined($self->{option_results}->{filter_arg}) && $self->{option_results}->{filter_arg} ne '' &&
|
||||||
$args !~ /$self->{option_results}->{filter_arg}/);
|
$args !~ /$self->{option_results}->{filter_arg}/);
|
||||||
|
next if (defined($self->{option_results}->{exclude_arg}) && $self->{option_results}->{exclude_arg} ne '' &&
|
||||||
|
$args =~ /$self->{option_results}->{exclude_arg}/);
|
||||||
next if (defined($self->{option_results}->{filter_state}) && $self->{option_results}->{filter_state} ne '' &&
|
next if (defined($self->{option_results}->{filter_state}) && $self->{option_results}->{filter_state} ne '' &&
|
||||||
$state_map->{$state} !~ /$self->{option_results}->{filter_state}/i);
|
$state_map->{$state} !~ /$self->{option_results}->{filter_state}/i);
|
||||||
next if (defined($self->{option_results}->{filter_ppid}) && $self->{option_results}->{filter_ppid} ne '' &&
|
next if (defined($self->{option_results}->{filter_ppid}) && $self->{option_results}->{filter_ppid} ne '' &&
|
||||||
@ -390,10 +396,18 @@ Monitor disk I/O.
|
|||||||
|
|
||||||
Filter process commands (regexp can be used).
|
Filter process commands (regexp can be used).
|
||||||
|
|
||||||
|
=item B<--exclude-command>
|
||||||
|
|
||||||
|
Exclude process commands (regexp can be used).
|
||||||
|
|
||||||
=item B<--filter-arg>
|
=item B<--filter-arg>
|
||||||
|
|
||||||
Filter process arguments (regexp can be used).
|
Filter process arguments (regexp can be used).
|
||||||
|
|
||||||
|
=item B<--exclude-arg>
|
||||||
|
|
||||||
|
Exclude process arguments (regexp can be used).
|
||||||
|
|
||||||
=item B<--filter-ppid>
|
=item B<--filter-ppid>
|
||||||
|
|
||||||
Filter process ppid (regexp can be used).
|
Filter process ppid (regexp can be used).
|
||||||
|
@ -106,6 +106,12 @@ sub custom_usage_calc {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub prefix_quota_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
return "Quota '" . $options{instance_value}->{display} . "' ";
|
||||||
|
}
|
||||||
|
|
||||||
sub set_counters {
|
sub set_counters {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
@ -133,12 +139,6 @@ sub set_counters {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
sub prefix_quota_output {
|
|
||||||
my ($self, %options) = @_;
|
|
||||||
|
|
||||||
return "Quota '" . $options{instance_value}->{display} . "' ";
|
|
||||||
}
|
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
@ -191,6 +191,8 @@ sub manage_selection {
|
|||||||
$self->{output}->output_add(long_msg => "skipping '" . $name . "': no matching filter.", debug => 1);
|
$self->{output}->output_add(long_msg => "skipping '" . $name . "': no matching filter.", debug => 1);
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
next if (defined($self->{option_results}->{exclude_fs}) && $self->{option_results}->{exclude_fs} ne '' &&
|
||||||
|
$fs =~ /$self->{option_results}->{exclude_fs}/);
|
||||||
|
|
||||||
$self->{quota}->{$name} = {
|
$self->{quota}->{$name} = {
|
||||||
display => $name,
|
display => $name,
|
||||||
@ -234,6 +236,10 @@ Filter username (regexp can be used).
|
|||||||
|
|
||||||
Filter filesystem (regexp can be used).
|
Filter filesystem (regexp can be used).
|
||||||
|
|
||||||
|
=item B<--exclude-fs>
|
||||||
|
|
||||||
|
Exclude filesystem (regexp can be used).
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
@ -96,6 +96,12 @@ sub custom_usage_calc {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub prefix_disks_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
return "Storage '" . $options{instance_value}->{display} . "' ";
|
||||||
|
}
|
||||||
|
|
||||||
sub set_counters {
|
sub set_counters {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
@ -115,21 +121,17 @@ sub set_counters {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
sub prefix_disks_output {
|
|
||||||
my ($self, %options) = @_;
|
|
||||||
|
|
||||||
return "Storage '" . $options{instance_value}->{display} . "' ";
|
|
||||||
}
|
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
'filter-type:s' => { name => 'filter_type', },
|
'filter-type:s' => { name => 'filter_type' },
|
||||||
'filter-fs:s' => { name => 'filter_fs', },
|
'filter-fs:s' => { name => 'filter_fs' },
|
||||||
|
'exclude-fs:s' => { name => 'exclude_fs' },
|
||||||
'filter-mountpoint:s' => { name => 'filter_mountpoint' },
|
'filter-mountpoint:s' => { name => 'filter_mountpoint' },
|
||||||
|
'exclude-mountpoint:s' => { name => 'exclude_mountpoint' },
|
||||||
'units:s' => { name => 'units', default => '%' },
|
'units:s' => { name => 'units', default => '%' },
|
||||||
'free' => { name => 'free' }
|
'free' => { name => 'free' }
|
||||||
});
|
});
|
||||||
@ -154,10 +156,14 @@ sub manage_selection {
|
|||||||
|
|
||||||
next if (defined($self->{option_results}->{filter_fs}) && $self->{option_results}->{filter_fs} ne '' &&
|
next if (defined($self->{option_results}->{filter_fs}) && $self->{option_results}->{filter_fs} ne '' &&
|
||||||
$fs !~ /$self->{option_results}->{filter_fs}/);
|
$fs !~ /$self->{option_results}->{filter_fs}/);
|
||||||
|
next if (defined($self->{option_results}->{exclude_fs}) && $self->{option_results}->{exclude_fs} ne '' &&
|
||||||
|
$fs =~ /$self->{option_results}->{exclude_fs}/);
|
||||||
next if (defined($self->{option_results}->{filter_type}) && $self->{option_results}->{filter_type} ne '' &&
|
next if (defined($self->{option_results}->{filter_type}) && $self->{option_results}->{filter_type} ne '' &&
|
||||||
$type !~ /$self->{option_results}->{filter_type}/);
|
$type !~ /$self->{option_results}->{filter_type}/);
|
||||||
next if (defined($self->{option_results}->{filter_mountpoint}) && $self->{option_results}->{filter_mountpoint} ne '' &&
|
next if (defined($self->{option_results}->{filter_mountpoint}) && $self->{option_results}->{filter_mountpoint} ne '' &&
|
||||||
$mount !~ /$self->{option_results}->{filter_mountpoint}/);
|
$mount !~ /$self->{option_results}->{filter_mountpoint}/);
|
||||||
|
next if (defined($self->{option_results}->{exclude_mountpoint}) && $self->{option_results}->{exclude_mountpoint} ne '' &&
|
||||||
|
$mount =~ /$self->{option_results}->{exclude_mountpoint}/);
|
||||||
|
|
||||||
$self->{disks}->{$mount} = {
|
$self->{disks}->{$mount} = {
|
||||||
display => $mount,
|
display => $mount,
|
||||||
@ -210,6 +216,10 @@ Thresholds are on free space left.
|
|||||||
|
|
||||||
Filter filesystem mount point (regexp can be used).
|
Filter filesystem mount point (regexp can be used).
|
||||||
|
|
||||||
|
=item B<--exclude-mountpoint>
|
||||||
|
|
||||||
|
Exclude filesystem mount point (regexp can be used).
|
||||||
|
|
||||||
=item B<--filter-type>
|
=item B<--filter-type>
|
||||||
|
|
||||||
Filter filesystem type (regexp can be used).
|
Filter filesystem type (regexp can be used).
|
||||||
@ -218,6 +228,10 @@ Filter filesystem type (regexp can be used).
|
|||||||
|
|
||||||
Filter filesystem (regexp can be used).
|
Filter filesystem (regexp can be used).
|
||||||
|
|
||||||
|
=item B<--exclude-fs>
|
||||||
|
|
||||||
|
Exclude filesystem (regexp can be used).
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
@ -39,6 +39,12 @@ sub custom_status_output {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub prefix_sc_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
return "Service '" . $options{instance_value}->{display} . "' ";
|
||||||
|
}
|
||||||
|
|
||||||
sub set_counters {
|
sub set_counters {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
@ -81,6 +87,7 @@ sub set_counters {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
$self->{maps_counters}->{sc} = [
|
$self->{maps_counters}->{sc} = [
|
||||||
{ label => 'status', type => 2, critical_default => '%{active} =~ /failed/i', set => {
|
{ label => 'status', type => 2, critical_default => '%{active} =~ /failed/i', set => {
|
||||||
key_values => [ { name => 'load' }, { name => 'active' }, { name => 'sub' }, { name => 'boot' }, { name => 'display' } ],
|
key_values => [ { name => 'load' }, { name => 'active' }, { name => 'sub' }, { name => 'boot' }, { name => 'display' } ],
|
||||||
@ -98,18 +105,13 @@ sub new {
|
|||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
'filter-name:s' => { name => 'filter_name' }
|
'filter-name:s' => { name => 'filter_name' },
|
||||||
|
'exclude-name:s' => { name => 'exclude_name' }
|
||||||
});
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub prefix_sc_output {
|
|
||||||
my ($self, %options) = @_;
|
|
||||||
|
|
||||||
return "Service '" . $options{instance_value}->{display} . "' ";
|
|
||||||
}
|
|
||||||
|
|
||||||
sub manage_selection {
|
sub manage_selection {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
@ -126,11 +128,10 @@ sub manage_selection {
|
|||||||
while ($stdout =~ /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/msig) {
|
while ($stdout =~ /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/msig) {
|
||||||
my ($name, $load, $active, $sub) = ($1, $2, $3, lc($4));
|
my ($name, $load, $active, $sub) = ($1, $2, $3, lc($4));
|
||||||
|
|
||||||
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
|
next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
|
||||||
$name !~ /$self->{option_results}->{filter_name}/) {
|
$name !~ /$self->{option_results}->{filter_name}/);
|
||||||
$self->{output}->output_add(long_msg => "skipping '" . $name . "': no matching filter.", debug => 1);
|
next if (defined($self->{option_results}->{exclude_name}) && $self->{option_results}->{exclude_name} ne '' &&
|
||||||
next;
|
$name =~ /$self->{option_results}->{exclude_name}/);
|
||||||
}
|
|
||||||
|
|
||||||
$self->{sc}->{$name} = { display => $name, load => $load, active => $active, sub => $sub, boot => '-' };
|
$self->{sc}->{$name} = { display => $name, load => $load, active => $active, sub => $sub, boot => '-' };
|
||||||
$self->{global}->{$sub} += 1 if (defined($self->{global}->{$sub}));
|
$self->{global}->{$sub} += 1 if (defined($self->{global}->{$sub}));
|
||||||
@ -172,6 +173,10 @@ Command used: 'systemctl -a --no-pager --no-legend' and 'systemctl list-unit-fil
|
|||||||
|
|
||||||
Filter service name (can be a regexp).
|
Filter service name (can be a regexp).
|
||||||
|
|
||||||
|
=item B<--exclude-name>
|
||||||
|
|
||||||
|
Exclude service name (can be a regexp).
|
||||||
|
|
||||||
=item B<--warning-*> B<--critical-*>
|
=item B<--warning-*> B<--critical-*>
|
||||||
|
|
||||||
Thresholds.
|
Thresholds.
|
||||||
|
@ -138,6 +138,7 @@ sub new {
|
|||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
'filter-state:s' => { name => 'filter_state', },
|
'filter-state:s' => { name => 'filter_state', },
|
||||||
'filter-interface:s' => { name => 'filter_interface' },
|
'filter-interface:s' => { name => 'filter_interface' },
|
||||||
|
'exclude-interface:s' => { name => 'exclude_interface' },
|
||||||
'units:s' => { name => 'units', default => 'b/s' },
|
'units:s' => { name => 'units', default => 'b/s' },
|
||||||
'speed:s' => { name => 'speed' },
|
'speed:s' => { name => 'speed' },
|
||||||
'no-loopback' => { name => 'no_loopback' }
|
'no-loopback' => { name => 'no_loopback' }
|
||||||
@ -201,6 +202,8 @@ sub do_selection {
|
|||||||
$states !~ /$self->{option_results}->{filter_state}/);
|
$states !~ /$self->{option_results}->{filter_state}/);
|
||||||
next if (defined($self->{option_results}->{filter_interface}) && $self->{option_results}->{filter_interface} ne '' &&
|
next if (defined($self->{option_results}->{filter_interface}) && $self->{option_results}->{filter_interface} ne '' &&
|
||||||
$interface_name !~ /$self->{option_results}->{filter_interface}/);
|
$interface_name !~ /$self->{option_results}->{filter_interface}/);
|
||||||
|
next if (defined($self->{option_results}->{exclude_interface}) && $self->{option_results}->{exclude_interface} ne '' &&
|
||||||
|
$interface_name =~ /$self->{option_results}->{exclude_interface}/);
|
||||||
|
|
||||||
$self->{interface}->{$interface_name} = {
|
$self->{interface}->{$interface_name} = {
|
||||||
display => $interface_name,
|
display => $interface_name,
|
||||||
@ -286,6 +289,10 @@ Percent can be used only if --speed is set.
|
|||||||
|
|
||||||
Filter interface name (regexp can be used).
|
Filter interface name (regexp can be used).
|
||||||
|
|
||||||
|
=item B<--exclude-interface>
|
||||||
|
|
||||||
|
Exclude interface name (regexp can be used).
|
||||||
|
|
||||||
=item B<--filter-state>
|
=item B<--filter-state>
|
||||||
|
|
||||||
Filter interfaces type (regexp can be used).
|
Filter interfaces type (regexp can be used).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user