From: Dirk Goetz Date: Mon, 2 Nov 2015 12:24:14 +0000 (+0100) Subject: Add a check command for check_file_age. X-Git-Tag: v2.5.0~142 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c999badd143d171649cbf3a2e4b1da76906d239f;p=icinga2 Add a check command for check_file_age. Add a deprecation note for check_ldaps to check_ldap. refs #6225 --- diff --git a/doc/7-icinga-template-library.md b/doc/7-icinga-template-library.md index e42f3bdc7..83ed8aa76 100644 --- a/doc/7-icinga-template-library.md +++ b/doc/7-icinga-template-library.md @@ -295,6 +295,22 @@ dummy_state | **Optional.** The state. Can be one of 0 (ok), 1 (warning), 2 dummy_text | **Optional.** Plugin output. Defaults to "Check was successful.". +### file_age + +Check command object for the `check_file_age` plugin. + +Custom attributes passed as [command parameters](3-monitoring-basics.md#command-passing-parameters): + +Name | Description +-----------------------|-------------------------------------------------------------------------------------------------------- +file_age_file | **Required.** File to monitor. +file_age_warning_time | **Optional.** File must be no more than this many seconds old as warning threshold. Defaults to "240s". +file_age_critical_time | **Optional.** File must be no more than this many seconds old as critical threshold. Defaults to "600s". +file_age_warning_size | **Optional.** File must be at least this many bytes long as warning threshold. No default given. +file_age_critical_size | **Optional.** File must be at least this many bytes long as critical threshold. Defaults to "0B". +file_age_ignoremissing | **Optional.** Return OK if the file does not exist. Defaults to false. + + ### fping4 Check command object for the `check_fping` plugin. @@ -541,7 +557,7 @@ imap_ipv6 | **Optional.** Use IPv6 connection. Defaults to false. ### ldap -Check command object for the `check_ldap` plugin. +Check command object for the `check_ldap` plugin. Use the plugin also for monitoring ldaps connections instead of the deprecated `check_ldaps`. Custom attributes passed as [command parameters](3-monitoring-basics.md#command-passing-parameters): diff --git a/itl/command-plugins.conf b/itl/command-plugins.conf index 47e8e67a3..526fb7bf0 100644 --- a/itl/command-plugins.conf +++ b/itl/command-plugins.conf @@ -2104,3 +2104,38 @@ object CheckCommand "negate" { vars.negate_timeout_result = "UNKNOWN" } + +object CheckCommand "file_age" { + import "plugin-check-command" + + command = [ PluginDir + "/check_file_age" ] + + arguments = { + "-w" = { + value = "$file_age_warning_time$" + description = "File must be no more than this many seconds old (default: 240s)" + } + "-c" = { + value = "$file_age_critical_time$" + description = "File must be no more than this many seconds old (default: 600s)" + } + "-W" = { + value = "$file_age_warning_size$" + description = "File must be at least this many bytes long" + } + "-C" = { + value = "$file_age_critical_size$" + description = "File must be at least this many bytes long (default: 0B)" + } + "-i" = { + set_if = "$file_age_ignoremissing$" + description = "return OK if the file does not exist" + } + "-f" = { + value = "$file_age_file$" + description = "File to monitor" + } + } + + vars.file_age_ignoremissing = false +}