Hello,
Nem gondoltam volna, hogy ez a probléma kifog rajtam de még nem találtam meg a megoldást.
Azt szeretném, hogy egy darab service-nek más legyen a notification_options beállítása.
Alap esetben a contact-nak nincs megadva ilyen opció tehát nem küld service-kről értesítést, de egyről szeretnék.
A configok:
define contact{
contact_name cname
alias cname
service_notification_period 24x7
host_notification_period 24x7
host_notification_options d,r
service_notification_commands service-notify-by-sendsms
host_notification_commands host-notify-by-sendsms
}
define contactgroup {
contactgroup_name gname
alias gname
members cname
}
define service{
name service-check_xxx
use service-generic
check_command check_xxx
register 0
notification_period 24x7
notification_options w,u,c,r
notifications_enabled 1
contact_groups gname
}
define service {
use service-check_xxx
host_name servername
}
Az objects.cache -ben a következő látható:
define service {
host_name servername
service_description descriptions
check_period 24x7
check_command check_xxx
contact_groups gname
notification_period 24x7
initial_state o
check_interval 5.000000
retry_interval 1.000000
max_check_attempts 4
is_volatile 0
parallelize_check 1
active_checks_enabled 1
passive_checks_enabled 1
obsess_over_service 1
event_handler_enabled 1
low_flap_threshold 0.000000
high_flap_threshold 0.000000
flap_detection_enabled 1
flap_detection_options o,w,u,c
freshness_threshold 0
check_freshness 0
notification_options u,w,c,r
notifications_enabled 1
notification_interval 0.000000
first_notification_delay 0.000000
stalking_options n
process_perf_data 1
failure_prediction_enabled 1
retain_status_information 1
retain_nonstatus_information 1
}
Tehát a konfigot jol betölti és ehez a service-haz tudja hogy mindenről kell értesítés, de ennek ellenére nem küld.
Persze ha a contact-nál beállítom akkor minden egyes service-ről kapok rendesen.
Ötletek?
Köszi
Hozzászólások
Egyszerű. A Service templateben definiált contact_groups kap meg minden üzenetet. Ha egy Servicenél eltérő contact_groupot akarsz megadni akkor a contact_groups sor beirásával máris arra fogja elküldeni az értesitést.
pl.
Service templateben a contact_groupsom pl networkadmins,serveradmins
Nem akarom hogy a serveradmins csoport is kapjon értesitést a ping kiesésről, ezért igy néz ki a service checkem.
define service{
host_name PC1
use default-service
service_description PING
check_command check_ping
normal_check_interval 5
contact_groups networkadmins
register 1
}
-------------------------
Dropbox refer: https://db.tt/V3RtXWLl
neut @ présház
Köszi választ, ha nincs más megoldás ez jo lehet, de ezzel lényegében egy sor eltéréssel duplikálom a kell a contact-omat. Reméltem, hogy ez elkerülhető és képes a nagios valahogy a notification_options felüldefiniálására...
szerintem az lehet a gond,hogy egy service-hez két sablont is betöltesz és a másodikat olvassa be később, amiben nincs contact megadva.
define service {
use service-check_xxx
host_name servername
}
ezt egészítsd ki így
define service {
use service-check_xxx
host_name servername
contacts kontaktok neve
}
vagy használj inkább csak egy service defet, pl:
define service{
host_name hostname
use service-generic
check_command check_xxx
register 0
notification_period 24x7
notification_options w,u,c,r
notifications_enabled 1
contact_groups gname
}
A két service abban különbözik hogy az egyik template ezt a "register 0" mutatja,tehát ugyan azt a templatet több helyen is felhasználom, de probáltam amit írtál, hogy nem használok templatet és úgy sem működött.
aha, látom, kicsit figyelmetlen voltam.
Egyébként mire gondoltál pontosan, mikor azt írtad "Persze ha a contact-nál beállítom akkor minden egyes service-ről kapok rendesen."? melyik contact-nál? mert ez nem teljesen tiszta.
Ha ide beteszem a service_notification_options -t akkor minen host-ról,service-ről kapok service értesítést ami ezt a contactot használja.
define contact{
contact_name cname
alias cname
service_notification_period 24x7
host_notification_period 24x7
host_notification_options d,r
service_notification_options w,u,c,r
service_notification_commands service-notify-by-sendsms
host_notification_commands host-notify-by-sendsms
}