2 notification method,

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: 2 notification method,

Post by mcapra »

liangwh wrote: If i use global event handler, and the handler is if email fails then sms, does that mean that contacts should not have any host/service notification enabled , because that already configured on the handler.
I guess it would depend on how you wrote the event handler, but it's worth mentioning that service/host event handlers don't have access to the contact information macros. See here for the available macros:
https://assets.nagios.com/downloads/nag ... olist.html

So you would need an additional step to figure out, based on the host/service corresponding to the event, what address gets what emails.

Which is why I suggested using a notification handler so you don't need to pry that information out of Nagios. The macros you might want to use ($CONTACTEMAIL$, $CONTACTPAGER$, $CONTACTADDRESSn$) should all be properly resolved by the Nagios Core notification logic without any further action.
Former Nagios employee
https://www.mcapra.com/
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: 2 notification method,

Post by dwhitfield »

You can have Nagios Core notify you of problems and recoveries pretty much anyway you want: pager, cellphone, email, instant message, audio alert, electric shocker, etc. How notifications are sent depend on the notification commands that are defined in your object definition files.

Note: If you install Nagios Core according to the quickstart guide, it should be configured to send email notifications. You can see the email notification commands that are used by viewing the contents of the following file: /usr/local/nagios/etc/objects/commands.cfg.

Specific notification methods (paging, etc.) are not directly incorporated into the Nagios Core code as it just doesn't make much sense. The "core" of Nagios Core is not designed to be an all-in-one application. If service checks were embedded in Nagios Core it would be very difficult for users to add new check methods, modify existing checks, etc. Notifications work in a similiar manner. There are a thousand different ways to do notifications and there are already a lot of packages out there that handle the dirty work, so why re-invent the wheel and limit yourself to a bike tire? Its much easier to let an external entity (i.e. a simple script or a full-blown messaging system) do the messy stuff. Some messaging packages that can handle notifications for pagers and cellphones are listed below in the resource section.
Basically, what the above is saying is that you set up notification commands essentially just like other commands. If you know how to set a new check, you can set a new notification command. Just like we don't write custom plugins, but rather focus our efforts on the nagios-plugins suite, we don't write custom notification commands. Of course, a community member can help you with that if they choose.
Locked