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.
#### <a id="plugin-contrib-command-yum"></a> yum
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" {