Portál AbcLinuxu, 1. listopadu 2025 19:05
Řešení dotazu:
serviceescalation jde napsat host_name !jmeno_serveru, ale ne service_description !nazev_sluzby). Tím se ale dostanu do obdobného stavu, který jsem psal jako příklad na konci dotazu. Budu muset pro ten stroj vyjmenovat všechny služby a u nich uvést kontakty. Když se pak v budoucnu rozhodnu změnit parametry sledování a notifikací pro nějakou službu, budu to muset udělat v globální definici a znovu pro ten konkrétní stroj a tomu bych se rád vyhnul.
Jenže tím, že existuje globální eskalace pro všechny služby v dané skupině, tak se přebije nastavení notifikací u té služby.Tato sluzba, ale v zadne skupine neni. Vypadala by takto:
define service{
service_description extra_sluzba
host_name extra_host
contacts extra_kontakt
max_check_attempts 5
check_interval 5
retry_interval 3
check_period 24x7
notification_interval 30
notification_period 24x7
notification_options w,c,r
}
define host{
use generic-host
hostgroups all, hosting
host_name aa.bb.cc
}
define service{
use generic-service
host_name aa.bb.cc
service_description bflmpsvz
check_command check_bflmpsvz
contact_groups extra_kontakty
}
Globální definice služeb vypadá třeba takto:
define service{
hostgroup_name hosting
use generic-service
service_description SSHD
check_command check_ssh
}
Hostgroup je definovaná pouze jako:
define hostgroup{
hostgroup_name hosting
alias Webhosting
}
A eskalace jsou následující:
define hostescalation{
hostgroup_name hosting
first_notification 1
last_notification 0
notification_interval 60
contact_groups hosting_notify
}
define serviceescalation{
service_description *
hostgroup_name hosting
first_notification 1
last_notification 0
notification_interval 60
contact_groups hosting_notify
}
Pokud konfiguraci zapíšu takhle, odešle se notifikace pouze na hosting_notify. Skupina konktatů extra_kontakty se ignoruje. Pokud přidám define serviceescalation{
host_name aa.bb.cc
service_description bflmpsvz
first_notification 1
last_notification 0
notification_interval 60
contact_groups extra_kontakty
}
tak se notifikace služby bflmpsvz odešle na hosting_notify a extra_kontakty.
define serviceescalation{
service_description *
hostgroup_name hosting
first_notification 1
last_notification 0
notification_interval 60
contact_groups hosting_notify
}
je potřeba rozepsat definici následovně:
define serviceescalation{
service_description *
hostgroup_name hosting
host_name !extra_host
first_notification 1
last_notification 0
notification_interval 60
contact_groups hosting_notify
}
define serviceescalation{
host_name extra_host
service_description extra_sluzba
first_notification 1
last_notification 0
notification_interval 60
contact_groups extra_kontakty
}
define serviceescalation{
host_name extra_host
service_description *,!extra_sluzba
first_notification 1
last_notification 0
notification_interval 60
contact_groups hosting_notify
}
Zkoušel jsem touhle cestou jít už dřív, ale přestože u host_name jde napsat !extra_host, u service_description se musí uvést i *: *,!extra_sluzba.
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.