icinga2 version: r2.10.5-1 Debian 9
So i provide you my (/master/hosts.conf with object Host), (conf.d/services_plugin_checks_mysql.conf with apply Service) and (conf.d/templates.conf with template Service)
I can override the template threshold warning and critical from template in apply Service, but i need to override the threshold @object Host.
Can anyone point my nose on it.
template.conf
template Service “mysql_health_sql” {
vars.hostname = “localhost”
vars.username = “maybenagios”
vars.password = “xxxx”
vars.mode = “sql”
vars.warning = “1”
vars.critical = “5”
vars.by_ssh_command = [ “/usr/lib/nagios/plugins/check_mysql_health” ]
vars.by_ssh_arguments = {
“–hostname” = “$hostname$”
“–username” = “$username$”
“–password” = “$password$”
“–mode” = “$mode$”
“–name” = “$name$”
“–name2” = “$name2$”
“–warning” = “$warning$”
“–critical” = “$critical$”
“–units” = “$units$”
}
}
services_plugin_checks_mysql.conf
apply Service “db_queries_update” {
import “generic-service”
import “mysql_health_sql”
check_command = “by_ssh”
vars.name = “Select variable_value from global_status where variable_name = ‘com_update’;”
vars.name2 = “Queries_Update”
vars.warning = “80000” // Want to override this threshold in object Host
vars.critical = “100000” // Want to override this threshold in object Host
vars.metric = “mysql”
assign where host.vars.check_mysql_health
}
/etc/icinga2/zones.d/master/hosts.conf
object Host “icinga2-master02” {
address = “192.168.2.64”
check_command = “hostalive”
Plugin Checks
vars.master = true
vars.check_ssh = true
vars.check_load = true
vars.check_procs = true
vars.check_swap = true
vars.check_users = true
vars.check_mysql_health = true
vars.apt = true
vars.warning = "10000"
vars.critical = "50000"
# Passive Service Checks
# Passive Process Checks
# Disk Checks
vars.disks["disk /"] = {
disk_partition = "/"
disk_warning = "20%"
disk_critical = "10%"
}
# DB Checks
vars.database[“database icinga”] = {
db_name = “icinga”
}
vars.database[“database icingaweb2”] = {
db_name = “icingaweb2”
}
vars.database[“database mysql”] = {
db_name = “mysql”
}
vars.metric = “hostalive”
vars.notification[“mail”] = {
groups = [ “icingaadmins” ]
}
}
I dont get it