From: mocruz Date: Tue, 4 Apr 2017 15:26:24 +0000 (+0200) Subject: ITL: Add memory and cpu thresholds to snmp_process Manubulon CheckCommand X-Git-Tag: v2.7.0~122 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7f60566340705b2a2abf4a0854a91468466e9e78;p=icinga2 ITL: Add memory and cpu thresholds to snmp_process Manubulon CheckCommand fixes #5129 fixes #5130 Signed-off-by: Michael Friedrich --- diff --git a/doc/10-icinga-template-library.md b/doc/10-icinga-template-library.md index 91ee91441..0bf0fac29 100644 --- a/doc/10-icinga-template-library.md +++ b/doc/10-icinga-template-library.md @@ -1931,27 +1931,30 @@ Check command object for the [check_snmp_process.pl](http://nagios.manubulon.com Custom attributes passed as [command parameters](3-monitoring-basics.md#command-passing-parameters): -Name | Description -------------------------|-------------- -snmp_address | **Optional.** The host's address. Defaults to "$address$" if the host's `address` attribute is set, "$address6$" otherwise. -snmp_nocrypt | **Optional.** Define SNMP encryption. If set, **snmp_v3** needs to be set. Defaults to false. -snmp_community | **Optional.** The SNMP community. Defaults to "public". -snmp_port | **Optional.** The SNMP port connection. -snmp_v2 | **Optional.** SNMP version to 2c. Defaults to false. -snmp_v3 | **Optional.** SNMP version to 3. Defaults to false. -snmp_login | **Optional.** SNMP version 3 username. Defaults to "snmpuser". -snmp_password | **Required.** SNMP version 3 password. No value defined as default. -snmp_v3_use_privpass | **Optional.** Define to use SNMP version 3 priv password. Defaults to false. -snmp_v3_use_authprotocol| **Optional.** Define to use SNMP version 3 authentication protocol. Defaults to false. -snmp_authprotocol | **Optional.** SNMP version 3 authentication protocol. Defaults to "md5,des". -snmp_privpass | **Required.** SNMP version 3 priv password. No value defined as default.. -snmp_warn | **Optional.** The warning threshold. -snmp_crit | **Optional.** The critical threshold. -snmp_process_name | **Optional.** Name of the process (regexp). No trailing slash!. Defaults to ".*". -snmp_perf | **Optional.** Enable perfdata values. Defaults to true. -snmp_timeout | **Optional.** The command timeout in seconds. Defaults to 5 seconds. -snmp_process_use_params | **Optional.** Add process parameters to process name for regexp matching. Example: "named.*-t /var/named/chroot" will only select named process with this parameter. Defaults to false. - +Name | Description +---------------------------|-------------- +snmp_address | **Optional.** The host's address. Defaults to "$address$" if the host's `address` attribute is set, "$address6$" otherwise. +snmp_nocrypt | **Optional.** Define SNMP encryption. If set, **snmp_v3** needs to be set. Defaults to false. +snmp_community | **Optional.** The SNMP community. Defaults to "public". +snmp_port | **Optional.** The SNMP port connection. +snmp_v2 | **Optional.** SNMP version to 2c. Defaults to false. +snmp_v3 | **Optional.** SNMP version to 3. Defaults to false. +snmp_login | **Optional.** SNMP version 3 username. Defaults to "snmpuser". +snmp_password | **Required.** SNMP version 3 password. No value defined as default. +snmp_v3_use_privpass | **Optional.** Define to use SNMP version 3 priv password. Defaults to false. +snmp_v3_use_authprotocol | **Optional.** Define to use SNMP version 3 authentication protocol. Defaults to false. +snmp_authprotocol | **Optional.** SNMP version 3 authentication protocol. Defaults to "md5,des". +snmp_privpass | **Required.** SNMP version 3 priv password. No value defined as default.. +snmp_warn | **Optional.** The warning threshold. +snmp_crit | **Optional.** The critical threshold. +snmp_process_name | **Optional.** Name of the process (regexp). No trailing slash!. Defaults to ".*". +snmp_perf | **Optional.** Enable perfdata values. Defaults to true. +snmp_timeout | **Optional.** The command timeout in seconds. Defaults to 5 seconds. +snmp_process_use_params | **Optional.** Add process parameters to process name for regexp matching. Example: "named.*-t /var/named/chroot" will only select named process with this parameter. Defaults to false. +snmp_process_mem_usage | **Optional.** Define to check memory usage for the process. Defaults to false. +snmp_process_mem_threshold | **Optional.** Defines the warning and critical thresholds in Mb when snmp_process_mem_usage set to true. Example "512,1024". Defaults to "0,0". +snmp_process_cpu_usage | **Optional.** Define to check CPU usage for the process. Defaults to false. +snmp_process_cpu_threshold | **Optional.** Defines the warning and critical thresholds in % when snmp_process_cpu_usage set to true. If more than one CPU, value can be > 100% : 100%=1 CPU. Example "15,50". Defaults to "0,0". ## Contributed Plugin Check Commands diff --git a/itl/command-plugins-manubulon.conf b/itl/command-plugins-manubulon.conf index 9ab5f011b..40216656f 100644 --- a/itl/command-plugins-manubulon.conf +++ b/itl/command-plugins-manubulon.conf @@ -93,7 +93,7 @@ object CheckCommand "snmp-load" { } -/** +/** * Memory and swap usage on Linux given by Net-snmp * Memory usage on cisco routers or Pix * For other systems use check_snmp_storage.pl @@ -149,7 +149,7 @@ object CheckCommand "snmp-storage" { } -/** +/** * snmp network interfaces * Url reference: http://nagios.manubulon.com/snmp_int.html */ @@ -223,7 +223,7 @@ object CheckCommand "snmp-interface" { } -/** +/** * snmp process * Url reference: http://nagios.manubulon.com/snmp_process.html */ @@ -244,6 +244,16 @@ object CheckCommand "snmp-process" { "-A" = { set_if = "$snmp_process_use_params$" } + "-m" = { + description = "Checks memory usage. Values warning and critical in Mb eg. 512,1024" + set_if = "$snmp_process_mem_usage$" + value = "$snmp_process_mem_threshold$" + } + "-u" = { + description = "Checks CPU usage. Values warning and critical in % (value can be > 100% : 100%=1 CPU) eg. 15,50" + set_if = "$snmp_process_cpu_usage$" + value = "$snmp_process_cpu_threshold$" + } } vars.snmp_process_name = ".*" @@ -251,5 +261,8 @@ object CheckCommand "snmp-process" { vars.snmp_crit = 0 vars.snmp_perf = true vars.snmp_process_use_params = false + vars.snmp_process_mem_usage = false + vars.snmp_process_mem_threshold = "0,0" + vars.snmp_process_cpu_usage = false + vars.snmp_process_cpu_threshold = "0,0" } -