diff --git a/doc/4-monitoring-remote-systems.md b/doc/4-monitoring-remote-systems.md index a1425ebe2..700ec1945 100644 --- a/doc/4-monitoring-remote-systems.md +++ b/doc/4-monitoring-remote-systems.md @@ -22,31 +22,30 @@ the `check_snmp` plugin binary, but there are plenty of [existing plugins](#inte for specific use cases already around, for example monitoring Cisco routers. The following example uses the [SNMP ITL](#itl-snmp) `CheckCommand` and just -overrides the `oid` custom attribute. A service is created for all hosts which -have the `community` custom attribute. +overrides the `snmp_oid` custom attribute. A service is created for all hosts which +have the `snmP-community` custom attribute. apply Service "uptime" { import "generic-service" check_command = "snmp" - vars.oid = "1.3.6.1.2.1.1.3.0" + vars.snmp_oid = "1.3.6.1.2.1.1.3.0" - assign where host.vars.community + assign where host.vars.snmp_community != "" } ### SSH Calling a plugin using the SSH protocol to execute a plugin on the remote server fetching -its return code and output. `check_by_ssh` is available in the [Monitoring Plugins package](#setting-up-check-plugins). +its return code and output. The `by_ssh` command object is part of the built-in templates and +requires the `check_by_ssh` check plugin which is available in the [Monitoring Plugins package](#setting-up-check-plugins). - object CheckCommand "check_by_ssh_swap" { - import "plugin-check-command" + object CheckCommand "by_ssh_swap" { + import "by_ssh" - command = [ PluginDir + "/check_by_ssh", - "-l", "remoteuser", - "-H", "$address$", - "-C", "\"/usr/local/icinga/libexec/check_swap -w $warn$ -c $crit$\"" - ] + vars.by_ssh_command = "/usr/lib/nagios/plugins/check_swap -w $by_ssh_swap_warn$ -c $by_ssh_swap_crit$" + vars.by_ssh_swap_warn = "50%" + vars.by_ssh_swap_crit = "75%" } object Service "swap" { @@ -54,11 +53,9 @@ its return code and output. `check_by_ssh` is available in the [Monitoring Plugi host_name = "remote-ssh-host" - check_command = "check_by_ssh_swap" - vars = { - "warn" = "50%" - "crit" = "75%" - } + check_command = "by_ssh_swap" + + vars.by_ssh_logname = "icinga" } ### NRPE diff --git a/doc/5-configuring-icinga-2.md b/doc/5-configuring-icinga-2.md index 0adb37b44..615fbef42 100644 --- a/doc/5-configuring-icinga-2.md +++ b/doc/5-configuring-icinga-2.md @@ -1949,6 +1949,24 @@ nscp_warn | **Optional.** The warning threshold. nscp_crit | **Optional.** The critical threshold. nscp_timeout | **Optional.** The query timeout in seconds. +#### by_ssh + +Check command object for the `check_by_ssh` plugin. + +Custom Attributes: + +Name | Description +----------------|-------------- +by_ssh_address | **Optional.** The host's address. Defaults to "$address$". +by_ssh_port | **Optional.** The SSH port. Defaults to 22. +by_ssh_command | **Optional.** The command that should be executed. +by_ssh_logname | **Optional.** The SSH username. +by_ssh_identity | **Optional.** The SSH identity. +by_ssh_quiet | **Optional.** Whether to suppress SSH warnings. Defaults to false. +by_ssh_warn | **Optional.** The warning threshold. +by_ssh_crit | **Optional.** The critical threshold. +by_ssh_timeout | **Optional.** The timeout in seconds. + #### apt Check command for the `check_apt` plugin. diff --git a/itl/command-plugins.conf b/itl/command-plugins.conf index f127e96c6..30109081d 100644 --- a/itl/command-plugins.conf +++ b/itl/command-plugins.conf @@ -231,7 +231,7 @@ object CheckCommand "swap" { command = PluginDir + "/check_swap" arguments = { - "-w" = "$swap_wfree$%", + "-w" = "$swap_wfree$%" "-c" = "$swap_cfree$%" } @@ -264,8 +264,8 @@ object CheckCommand "snmp" { command = PluginDir + "/check_snmp" arguments = { - "-H" = "$snmp_address$", - "-o" = "$snmp_oid$", + "-H" = "$snmp_address$" + "-o" = "$snmp_oid$" "-C" = "$snmp_community$" } @@ -312,16 +312,42 @@ object CheckCommand "nscp" { command = PluginDir + "/check_nt" arguments = { - "-H" = "$nscp_address$", - "-p" = "$nscp_port$", - "-s" = "$nscp_password$", - "-v" = { value = "$nscp_variable$", required = true }, - "-l" = "$nscp_params$", - "-w" = "$nscp_warn$", - "-c" = "$nscp_crit$", + "-H" = "$nscp_address$" + "-p" = "$nscp_port$" + "-s" = "$nscp_password$" + "-v" = { + value = "$nscp_variable$" + required = true + } + "-l" = "$nscp_params$" + "-w" = "$nscp_warn$" + "-c" = "$nscp_crit$" "-t" = "$nscp_timeout$" } vars.nscp_address = "$address$" vars.nscp_port = 12489 } + +object CheckCommand "by_ssh" { + import "plugin-check-command" + + command = PluginDir + "/check_by_ssh" + + arguments = { + "-H" = "$by_ssh_address$" + "-p" = "$by_ssh_port$" + "-C" = "$by_ssh_command$" + "-l" = "$by_ssh_logname$" + "-i" = "$by_ssh_identity$" + "-q" = { + set_if = "$by_ssh_quiet$" + } + "-w" = "$by_ssh_warn$" + "-c" = "$by_ssh_crit$" + "-t" = "$by_ssh_timeout$" + } + + vars.by_ssh_address = "$address$" + vars.by_ssh_quiet = false +}