Example where I assign a service for several hosts but there is a server to which I do not have root access and the address of the plugins can not be the same as the others
In constants.conf set PluginDir to / usr / lib / nagios / plugins /
But in this case I need a different dir to monitor a single hosts to which I do not have access to root
Sorry my english is not very good
I hope I have explained
services.conf-
apply Service "checkswap" {
import "generic-service"
check_command = "checkbyssh"
vars.by_ssh_command = PluginDir + "/check_swap -w $swap_warn$ -c $swap_crit$"
vars.swap_warn = "90%"
vars.swap_crit = "85%"
assign where (host.address host.address6) && host.vars.os == "LinuxOS"
}
host.conf-
object Host "host.page.net" {
/* Import the default host template defined in `templates.conf`. */
import "generic-host"
address = "10.80.0.6"
address6 = ""
vars.by_ssh_address = "10.80.0.6"
vars.by_ssh_port = "22"
vars.by_ssh_logname = "usernoroot"
}
commands.conf-
object CheckCommand "checkbyssh" {
import "plugin-check-command"
import "ipv4-or-ipv6"
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$"
"-o" = "StrictHostKeyChecking=no"
}
vars.by_ssh_address = "$check_address$"
vars.by_ssh_quiet = false
}