chukchuk
(John Chukchuk)
August 18, 2019, 4:11pm
1
Hi,
How can i apply service checks for two satellite?
under zone.d folder i have satellite-bw and satellite-eu
in the satellite-mu folder i have service.conf with the service checks below.
checks is running for only one satellite-bw.
apply Service "ping4" {
check_command = "ping4"
command_endpoint = host.vars.client_endpoint
vars.ping_cpl = 50
vars.ping_crta = 600
vars.ping_wpl = 30
vars.ping_wrta = 400
assign where host.zone == "satellite-bw" && host.vars.client_endpoint
assign where host.vars.client_endpoint
}
apply Service "hostalive" {
check_command = "hostalive"
command_endpoint = host.vars.client_endpoint
assign where host.zone == "satellite-bw" && host.vars.client_endpoint
assign where host.vars.client_endpoint
}
apply Service "users" {
import "generic-service"
check_command = "users"
vars.users_wgreater = "2"
vars.users_cgreater = "3"
command_endpoint = host.vars.client_endpoint
assign where host.zone == "satellite-bw" && host.vars.client_endpoint
assign where host.vars.client_endpoint
}
Thanks in advance
aflatto
(Assaf Flatto)
August 18, 2019, 7:20pm
2
Add the line to the check definition
chukchuk
(John Chukchuk)
August 19, 2019, 6:06am
3
this what i did i got
critical/config: Error: An object with type ‘Service’ and name ‘app.example.com !ssh’ already exists (in /etc/icinga2/zones.d/satellite-eu/service_agent.conf:
dnsmichi
(Michael Friedrich)
August 19, 2019, 6:55am
4
The content of that file is?
chukchuk
(John Chukchuk)
August 19, 2019, 7:11am
5
This is the content:
apply Service "ping4" {
check_command = "ping4"
command_endpoint = host.vars.client_endpoint
vars.ping_cpl = 50
vars.ping_crta = 600
vars.ping_wpl = 30
vars.ping_wrta = 400
assign where host.zone == "satellite-eu" && host.vars.client_endpoint
assign where host.vars.client_endpoint
}
apply Service "hostalive" {
check_command = "hostalive"
command_endpoint = host.vars.client_endpoint
assign where host.zone == "satellite-eu" && host.vars.client_endpoint
assign where host.vars.client_endpoint
}
apply Service "users" {
import "generic-service"
check_command = "users"
vars.users_wgreater = "2"
vars.users_cgreater = "3"
command_endpoint = host.vars.client_endpoint
assign where host.zone == "satellite-eu" && host.vars.client_endpoint
assign where host.vars.client_endpoint
}
apply Service "procs" {
import "generic-service"
check_command = "procs"
command_endpoint = host.vars.client_endpoint
#command_endpoint = "vpseu01.lumic.co.bw"
assign where host.zone == "satellite-eu" && host.vars.client_endpoint
assign where host.vars.client_endpoint
}
apply Service "ssh" {
import "generic-service"
check_command = "ssh"
command_endpoint = "home.micinthe.com"
//command_endpoint = host.vars.client_endpoint
assign where host.vars.client_endpoint
assign where (host.address || host.address6) && host.vars.os == "Linux"
}
apply Service "disk" {
check_command = "disk"
command_endpoint = host.vars.client_endpoint
assign where host.vars.client_endpoint
vars.disk_wfree = "10%"
vars.disk_cfree = "5%"
assign where host.zone == "satellite-eu" && host.vars.client_endpoint
}
dnsmichi
(Michael Friedrich)
August 19, 2019, 7:41am
6
Ok, so you have it already and the real question is that you want to combine two service apply rules from each zone into one. Right?
chukchuk
(John Chukchuk)
August 19, 2019, 8:12am
7
Yes, This is exactly what i’m trying to do, but i can’t seems to find the solutions.
dnsmichi
(Michael Friedrich)
August 19, 2019, 1:33pm
8
Move the apply rule into a global zone which is configured on both satellites, like global-templates
.
apply Service "ping4" {
check_command = "ping4"
command_endpoint = host.vars.client_endpoint
vars.ping_cpl = 50
vars.ping_crta = 600
vars.ping_wpl = 30
vars.ping_wrta = 400
assign where host.vars.client_endpoint
}
If you want to specifically add this to specific zones, you can extend the assign where rule to
assign where (host.zone == “satellite-eu” || host.zone == “satellite-bw”) && host.vars.client_endpoint
Cheers,
Michael
1 Like