diff --git a/doc/7-icinga-template-library.md b/doc/7-icinga-template-library.md index b3227a865..69cec1e5f 100644 --- a/doc/7-icinga-template-library.md +++ b/doc/7-icinga-template-library.md @@ -2066,7 +2066,11 @@ mem_critical | **Required.** Specify the critical threshold as number interprete Check command object for the `check_running_kernel` plugin provided by the `nagios-plugins-contrib` package on Debian. -The `running_kernel` check command does not support any vars. +Custom attributes: + +Name | Description +---------------------------|------------- +running\_kernel\_use\_sudo | Whether to run the plugin with `sudo`. Defaults to false except on Ubuntu where it defaults to true. #### yum diff --git a/itl/plugins-contrib.d/operating-system.conf b/itl/plugins-contrib.d/operating-system.conf index ca7214578..c065c18c2 100644 --- a/itl/plugins-contrib.d/operating-system.conf +++ b/itl/plugins-contrib.d/operating-system.conf @@ -53,7 +53,25 @@ object CheckCommand "mem" { object CheckCommand "running_kernel" { import "plugin-check-command" - command = [ "sudo", PluginContribDir + "/check_running_kernel" ] + command = {{ + var use_sudo = macro("$running_kernel_use_sudo$") + + if (use_sudo == null && PlatformName == "Ubuntu") { + use_sudo = true + } + + var args + + if (use_sudo) { + args = [ "sudo" ] + } else { + args = [] + } + + args += [ PluginContribDir + "/check_running_kernel" ] + + return args + }} } object CheckCommand "yum" {