それぞれ通知先を分けたいなーという時にどうすればいいかちょっと調べたのでメモ
キモは service_notification_options でした
■変更するファイル
・/etc/nagios/objects/contact.cfg
・/etc/nagios/objects/commands.cfg
■/etc/nagios/objects/contact.cfg
・contactgroup 定義の members に recovery とかの名前で追加(既に fatal / warn / irc は存在する体で...w)
define contactgroup {
contactgroup_name admins
members fatal, warn, recovery, irc,
}
・contact 定義 recovery を作る
define contact {
contact_name recovery
use generic-contact
service_notification_options r #r がRECOVERY
service_notification_commands email-service-recovery
host_notification_commands email-host-recovery
email hoge@gmail.com
}
・元からある contact 定義 fatal から service_notification_options の r を抜く
define contact {
contact_name fatal
use generic-contact
service_notification_options u,c #uはUNREACHABLE,cはCRITICAL
service_notification_commands email-service-fatal
host_notification_commands email-host-fatal
email hoge@gmail.com
}
■/etc/nagios/objects/commands.cfg
・email-service-recovery の command を好きなフォーマットで定義
・email-host-recovery の command を好きなフォーマット定義
これでOK
