From: Max Deparade Date: Thu, 22 Aug 2019 13:03:11 +0000 (+0200) Subject: Adding check_uptime to itl X-Git-Tag: v2.11.0~1^2~32^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0e00ffee39fd215570642c169ed51c2b78c80eea;p=icinga2 Adding check_uptime to itl --- diff --git a/doc/10-icinga-template-library.md b/doc/10-icinga-template-library.md index 06f99b790..bbd3e824b 100644 --- a/doc/10-icinga-template-library.md +++ b/doc/10-icinga-template-library.md @@ -1485,6 +1485,21 @@ users_wgreater | **Optional.** The user count warning threshold. Defaults to 20 users_cgreater | **Optional.** The user count critical threshold. Defaults to 50. +### uptime + +The [check_uptime](https://www.monitoring-plugins.org/doc/man/check_uptime.html) plugin +checks the uptime of the system using /proc/uptime. + +Custom variables passed as [command parameters](03-monitoring-basics.md#command-passing-parameters): + +Name | Description +----------------|-------------- +uptime_warning | **Required.** Min. number of uptime to generate warning (-w 30m). Defaults to 30m. +uptime_critical | **Required.** Min. number of uptime to generate critical alert (-c 15m). Defaults to 15m. +uptime_for | **Optional.** Show uptime in a pretty format (Running for x weeks, x days, ...). Defaults to false. +uptime_since | **Optional.** Show last boot in yyyy-mm-dd HH:MM:SS format (output from 'uptime -s'). Defaults to false. + + ## Windows Plugins for Icinga 2 diff --git a/itl/command-plugins.conf b/itl/command-plugins.conf index 144cb3684..c3f7ffe1f 100644 --- a/itl/command-plugins.conf +++ b/itl/command-plugins.conf @@ -3140,3 +3140,32 @@ object CheckCommand "rpc" { vars.rpc_address = "$check_address$" } + +object CheckCommand "uptime" { + command = [ PluginDir + "/check_uptime" ] + + arguments = { + "--warning" = { + value = "$uptime_warning$" + description = "Min. number of uptime to generate warning" + required = true + } + "--critical" = { + value = "$uptime_critical$" + description = "Min. number of uptime to generate critical alert ( w < c )" + required = true + } + "--for" = { + set_if = "$uptime_for$" + description = "Show uptime in a pretty format (Running for x weeks, x days, ...)" + } + "--since" = { + set_if = "$uptime_since$" + description = "Show last boot in yyyy-mm-dd HH:MM:SS format (output from 'uptime -s')" + } + } + + vars.uptime_warning = "30m" + vars.uptime_critical = "15m" +} +