nagios / email kuldes

Fórumok

Sziasztok,

nagios email kuldessel van egy kis bajom. Mar nyolcat latok minden konfigbol, mert a doksik es a sajat tapasztalat szerint jonak kene lennie a konfignak (nagios el is indul), de megse ugy mukodik ahogy szeretnem.

Adott ket contact_groups amiben a kedves kollegak vannak definialva. Egyik team az x applikacio supportja (hivjuk most x_app-nak) a masik team a nagios default admins. A cel pofon egyszeru, az egyik team kapja az egyik applikacio alertje-it a masik (admins) team a pedig az osszes tobbit.

A config a kovetkezo:

1, contacts.cfg --> osszes user definialva, plusz osse contactgroup is a sajat nevevel es a tagokkal. Egyik team a nagios default admins (3 tag) masik pedig x_app team (szinten 3 tag)

2, appok_sajat_config.cfg -->

define service{
name app neve
use local-service
service_description Email Notification
contact_groups admins #default
flap_detection_enabled 0
register 0
}

define service{
name app neve
use local-service
service_description Email Notification
contact_groups x_app #masik team
flap_detection_enabled 0
register 0
}

3, templates.cfg

default beallitasok:

define contact{
name generic-contact ; The name of this contact template
service_notification_period 24x7 ; service notifications can be sent
host_notification_period 24x7 ; host notifications can be sent
service_notification_options w,u,c,r,f,s ; send notifications for all servic
host_notification_options d,u,r,f,s ; send notifications for all host
service_notification_commands notify-service-by-email ; send service notifications via email
host_notification_commands notify-host-by-email ; send host notifications via email
register 0 ; DONT REGISTER THIS DEFINITION - ITS
}

A problemam az hogy MINDIG MINDENKI kapja az emaileket az OSSZES apptol! :))

Tehat hiaba allitom be az x_app configjaba hogy csak az x_app team a contac_groups es Ok kapjak az email alerteket, az x is es az admin team is megkapja.

At neztem csomo nagios_contact-rol szolo leirasokat, es elvileg jol van bekonfigolva rendesen el is indul, kuldi is a mail-eket serenyen, csak tul sok mindenki kap emailt :)

VAlami otlet, tapasztalat?

koszi elore is.

Hozzászólások

Két eset lehetséges:
1. a host -ok benne vannak mind a két

contact_groups

-ban, vagy
2. a service -ek benne vannak mind a két

contact_groups

-ban

----
올드보이
http://molnaristvan.eu/

nem talalok sehol erre utalast. Egyedul amit el tudok kepzelni, az az hogy a generic-host file-ban, ahonnan a host-ok veszik a templatet, a default contact_group az admins:

define host{
name generic-host ; The name of this host template
check_command check-host-alive ; DEFAULT COMMAND TO CHECK ALL HOSTS
check_period 24x7 ; BY DEFAULT ALL HOST CHECKS ARE ACTIVE ROUND
check_interval 1 ; ACTIVELY CHECK THE HOST EVERY 1 MINUTES
retry_interval 1 ; SCHEDULE HOST CHECK RETRIES AT 1 MINUTE
max_check_attempts 3 ; CHECK EACH lINUX HOST 10 TIMES (MAX)
notifications_enabled 0 ; Host notifications are enabled
notification_interval 1440 ; Resend notifications every 1 hours
notification_options d,r ; Only send notifications for specific host
contact_groups admins ; Notifications get sent to the admins by
event_handler_enabled 1 ; Host event handler is enabled
flap_detection_enabled 0 ; Flap detection is enabled
failure_prediction_enabled 1 ; Failure prediction is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program
retain_nonstatus_information 1 ; Retain non-status information across
notification_period 24x7 ; Send host notifications at any time
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A
}

viszont ha ide berakom az x_app contact group-ot, akkor az x_app tagok is megkapnak megintcsak MINDENT! Eddig legalabb csak az admin kapta meg az x_app-osokat (ezt kene megszuntetni), de igy pedig mindenki mindent :)

nem tudtam es nem ertem :S

jonak kell lenni, 20x atneztem! Es megse! Nem tudom elszeparalni a csapatokat, hiaba adom meg a masik team-et, OK nem kapnak semmit!

Melyik konfigot tudnad megnezni? Eleg sok van ami ossze fug.

Contacts.cfg, templates.cfg, x_app.cfg ?

koszi elore is, mnagy segitseg lenne ha ezt meg tudnank fejteni :)

na akkor pastázok én:

### contacts.cfg
define contact{
contact_name root
alias Root
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
email root@localhost
}

# CONTACT GROUPS
define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members root
}

### generic-host.cfg
define host{
name generic-host ; The name of this host template
notifications_enabled 1 ; Host notifications are enabled
event_handler_enabled 1 ; Host event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
failure_prediction_enabled 1 ; Failure prediction is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
check_command check-host-alive
max_check_attempts 5
notification_interval 0
notification_period 24x7
notification_options d,u,r

contact_groups admins

register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}

ez eddig tiszta sor, neked is ilyen van!
viszont szerintem neked nem ezt kellene csinálnid, hanem
a service, vagy host group -ok között megadni a contact_groups direktívát és/vagy létrehozni egy új srevice, vagy host groupot amiben be van állítva a contact_group. Ami ebbe, ezekbe a groupokba kerül az felveszi az email beállításokat

----
올드보이
http://molnaristvan.eu/

igen is ig gondolo, es szerintem jol is csinaltam.

Tehat egyszer van a contacts.cfg, ebben a file-ban CSAK ezek vannak benne (ertelem szeruen valod adatokkak):

define contact{
contact_name name1
use generic-contact
alias name1
email name1@email.com
}

define contact{
contact_name name2
use generic-contact
alias name2
email name2@email.com
}

define contact{
contact_name name3
use generic-contact
alias name3
email name3@email.com
}

define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members name1,name2
}

define contactgroup{
contactgroup_name x_app
alias x_app
members name1,name3
}

akkor van a templates.cfg file, ami default a contact resz :

define contact{
name generic-contact
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r,f,s
host_notification_options d,u,r,f,s
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
register 0 E!
}

aztan pedig az osszes hostgroupnak kulon file-ja, az osszes ratartozu cucc (servicek, host define, hostgroup define) egy bizonyos app szerint csoportositva
Tehat a kovetkezo logika szerint ez pl linux-dev-servers.cfg

define host{
use linux-server
host_name host1
alias Linux DEV HA
address 1.2.3.4
}

define host{
use linux-server
host_name host2
alias Linux DEV HA2
address 1.2.3.5
}

define hostgroup{
hostgroup_name linux-dev
alias Linux DEV
members host1,host2
}

define service{
use linux-dev-service
hostgroup_name linux-dev
service_description PING
check_command check_ping!100.0,20%!500.0,60%
max_check_attempts 2
}

###ES ITT ALLITOM, HOGY MELYIK GROUP LEGYEN ERTESITVE:

define service{
name linux-dev
use local-service
service_description Email Notification
contact_groups admins ## vagy x_app
flap_detection_enabled 0
register 0
}

tehat az osszes kulon app-nak (es a hozza tartozo 5-10 server) kulon config file-ja van es a fentiek alapjan epul fel.

es hiaba allitog file-onket a contact_group-ot, csak es kizarolag az admins (default) csoport kapja meg, nem a masik! Tehat nem is az van amit a cimben irtam, mert most mar jobban kiteszteltem es senki mas nem kap mail-t csak az admins :)

erre gondolsz ?

define host{
use linux-server
host_name host1
alias Linux DEV HA
address 1.2.3.4
}

ez a template.cfg-re mutatt, ahol is szinten default:

define host{
name linux-server
use generic-host
register 0
}

ami pedig a szinten-szinten default generic-host:

define host{
name generic-host
check_command check-host-alive
check_period 24x7
check_interval 1
retry_interval 1
max_check_attempts 3
notifications_enabled 0
notification_interval 1440
notification_options d,r
contact_groups admins
event_handler_enabled 1
flap_detection_enabled 0
failure_prediction_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
notification_period 24x7
register 0
}