Check services via ssh¶
Command definition:¶
Create a command in commands.conf for the specific check. vars.by_ssh_command is the check, and vars.by_ssh_identity is the ssh key for the user to login.
This example uses the nagios-plugins-disk package on CentOS, but should work with any actual check.
object CheckCommand "check_disk_by_ssh" {
import "by_ssh"
vars.by_ssh_command = "/usr/lib64/nagios/plugins/check_disk -w 20% -c 10%"
vars.by_ssh_identity = "/var/spool/icinga2/.ssh/icingacheck"
}
Services definition:¶
This uses the check_disk_by_ssh command above (in check_command). vars.by_ssh_logname is the login to use. hostr.vars.sshcheck_root has to be set in the hosts.conf file for the specific host this should be run against.
apply Service "disk_sshcheck_root" {
import "generic-service"
check_command = "check_disk_by_ssh"
vars.by_ssh_logname = "icingacheck"
assign where host.vars.sshcheck_root == "True"
}