ITL: Add --exclude-process to check_procs

For check_procs, both the Monitoring Plugins' implementation[0] and the
Nagios Plugin[1] are supporting the "-X" or "--exclude-process" flag to
exclude one or many processes by name. However, this flag is missing
here in the Icinga Template Library.

The Nagios Plugin implementation also comes with "-j" and "-g" for
FreeBSD jails and Linux cgroups, respectively. But, to keep it
compatible, I would ignore these for the moment.

Closes #10226.

[0]: https://www.monitoring-plugins.org/doc/man/check_procs.html
[1]: https://nagios-plugins.org/doc/man/check_procs.html
This commit is contained in:
Alvar Penning 2024-11-13 09:36:06 +01:00
parent 7a20d987f6
commit e620f9515b
No known key found for this signature in database
2 changed files with 22 additions and 17 deletions

View File

@ -1226,7 +1226,7 @@ of processes. Search filters can be applied to limit the processes to check.
Custom variables passed as [command parameters](03-monitoring-basics.md#command-passing-parameters): Custom variables passed as [command parameters](03-monitoring-basics.md#command-passing-parameters):
Name | Description Name | Description
---------------------|-------------- ----------------------|--------------
procs_warning | **Optional.** The process count warning threshold. Defaults to 250. procs_warning | **Optional.** The process count warning threshold. Defaults to 250.
procs_critical | **Optional.** The process count critical threshold. Defaults to 400. procs_critical | **Optional.** The process count critical threshold. Defaults to 400.
procs_metric | **Optional.** Check thresholds against metric. procs_metric | **Optional.** Check thresholds against metric.
@ -1241,6 +1241,7 @@ procs_user | **Optional.** Only scan for processes with user name or I
procs_argument | **Optional.** Only scan for processes with args that contain STRING. procs_argument | **Optional.** Only scan for processes with args that contain STRING.
procs_argument_regex | **Optional.** Only scan for processes with args that contain the regex STRING. procs_argument_regex | **Optional.** Only scan for processes with args that contain the regex STRING.
procs_command | **Optional.** Only scan for exact matches of COMMAND (without path). procs_command | **Optional.** Only scan for exact matches of COMMAND (without path).
procs_exclude_process | **Optional.** Exclude processes which match this comma separated list.
procs_nokthreads | **Optional.** Only scan for non kernel threads. Defaults to false. procs_nokthreads | **Optional.** Only scan for non kernel threads. Defaults to false.

View File

@ -1842,6 +1842,10 @@ object CheckCommand "procs" {
value = "$procs_command$" value = "$procs_command$"
description = "Only scan for exact matches of COMMAND (without path)" description = "Only scan for exact matches of COMMAND (without path)"
} }
"-X" = {
value = "$procs_exclude_process$"
description = "Exclude processes which match this comma separated list"
}
"-k" = { "-k" = {
set_if = "$procs_nokthreads$" set_if = "$procs_nokthreads$"
description = "Only scan for non kernel threads" description = "Only scan for non kernel threads"