Page 1 of 2
Customizing global email and SMS messages
Posted: Fri Aug 07, 2015 7:15 am
by mhixson2
Hello,
I have a couple questions about customizing notifications. Overall, I'm trying to understand how this works and what components are in play so that I can edit and maintain global templates for email and SMS notifications.
1. I see that under a user's profile settings > Notification Options > Notification Messages, there are areas to edit the format of both email and SMS messages. Is there any way to adjust these globally and keep users from editing/overriding them?
2. In poking around the interface, I noticed the "notify-host-by-email" and "notify-service-by-email" commands. These do not seem to be in use in XI as the format of the messages actually received does not match these templates (but rather matches the templates noted in #1). Are these the old way of doing things? Is there any way to make these override the templates in #1? I've tried assigning them to my contact template under "Manage Host/Service Notification Commands" but that just caused notification to stop altogether.
3. Can you also explain where the "xi_host_notification_handler" and "xi_service_notification_handler" commands come into play?
Thanks!
Re: Customizing global email and SMS messages
Posted: Fri Aug 07, 2015 9:16 am
by lmiltchev
1. I see that under a user's profile settings > Notification Options > Notification Messages, there are areas to edit the format of both email and SMS messages. Is there any way to adjust these globally and keep users from editing/overriding them?
This goal can be achieved via the "Notification Settings Management" page in Nagios XI Enterprise Edition. Please, see the image below:
example01.PNG
https://www.nagios.com/products/nagios- ... omparison/
2. In poking around the interface, I noticed the "notify-host-by-email" and "notify-service-by-email" commands. These do not seem to be in use in XI as the format of the messages actually received does not match these templates (but rather matches the templates noted in #1). Are these the old way of doing things? Is there any way to make these override the templates in #1? I've tried assigning them to my contact template under "Manage Host/Service Notification Commands" but that just caused notification to stop altogether.
These are the "old" notification handlers that were traditionally used in Nagios Core. They would be used by "contacts only". Contacts only cannot change/modify their notification options as "xi users", who are also contacts. The "xi users" and "contacts" are similar but not the same. For more information on the topic, please review the document below:
https://assets.nagios.com/downloads/nag ... ntacts.pdf
3. Can you also explain where the "xi_host_notification_handler" and "xi_service_notification_handler" commands come into play?
These are the "default" notification handlers in Nagios XI. The document above explains how to use them.
Let me know if you have any more questions. Thanks!
Re: Customizing global email and SMS messages
Posted: Fri Aug 07, 2015 3:15 pm
by mhixson2
Awesome, thanks.
Where can I find a complete list of variables to use in the notification setup?
Re: Customizing global email and SMS messages
Posted: Sun Aug 09, 2015 10:21 am
by jdalrymple
Re: Customizing global email and SMS messages
Posted: Mon Aug 10, 2015 2:12 pm
by mhixson2
Great! Man, I swear I did look for this stuff first haha.
Can you tell me in what configuration file this value is held (screenshot below)? Hopefully it's easily editable as I need to be able to toggle that field as our on-call rotation switches. I haven't dug into editing configs and importing them or moving them to that static location for Nagios to use, so if that's the case this probably won't work for us right now. Time restraints.
Ultimately, I need to enable email notifications for all contacts, then easily control which contact receives SMS alerts. Only one person should be set up for SMS at a time. If you have any ideas, let me know. So far SMS and Email notifications seem tied together everywhere except on this page.
Thanks!
SMS.png
Re: Customizing global email and SMS messages
Posted: Mon Aug 10, 2015 3:09 pm
by ssax
Those those are stored in the postgresql database, we don't recommend that you interact with the DBs directly.
Code: Select all
[root@ssc66xi scripts]# echo "select * from xi_usermeta where keyname like '%mobile%';" | psql nagiosxi nagiosxi
usermeta_id | user_id | keyname | keyvalue | autoload
-------------+---------+----------------------+------------+----------
487 | 18 | notify_by_mobiletext | 1 | 0
488 | 18 | mobile_number | 6516516511 | 0
489 | 18 | mobile_provider | att | 0
Re: Customizing global email and SMS messages
Posted: Mon Aug 10, 2015 3:39 pm
by mhixson2
Alright, fair enough.
Any thoughts on how to accomplish this? It would be nice if email and SMS on/off could be inherited from a contact group via contact template, but that doesn't seem to exist in Nagios currently. I could then just throw users in and out of that group as necessary.
Re: Customizing global email and SMS messages
Posted: Mon Aug 10, 2015 4:17 pm
by ssax
Re: Customizing global email and SMS messages
Posted: Wed Aug 12, 2015 9:01 am
by mhixson2
Thanks. That was definitely helpful as setting up alternating weeks for example is not obvious. I ended up not using them as the article described because it would be a burden to maintain for the way our on call is structured. Here is what I did:
Ultimately, I set up users and contacts (contacts alone without a corresponding user would not work) for team email distribution groups which use a 24x7 time period for emails notifications. This solves for my needing everyone to receive email notifications all the time so we're all in the loop. Then I disabled email notifications in each user's account so they only have mobile enabled, to avoid duplicate emails since they're part of the distribution groups. I then created contact templates - one for 24x7 notifications and one for no notifications. I assigned the 'silent' template to all users except the one who is on call who was assigned the 24x7 template. That way everyone receives emails, no duplicates, and only the person I designate (via template) receives SMS alerts. Seems pretty hacky, but it's the best I've got at this point.
I originally tried assigning the contact templates I mentioned above to contact groups and then I moved contacts between them as necessary, but inheritance seems pretty limited for contacts. Right now, I can only get the time period to inherit from the assigned template, but that is good enough.
Thanks for the help. I think I'm good for now since I can script changing the assigned contact templates (eventually). Please let me know if I'm missing something that would save me some effort.
Re: Customizing global email and SMS messages
Posted: Wed Aug 12, 2015 11:18 am
by lmiltchev
Thanks for the help. I think I'm good for now since I can script changing the assigned contact templates (eventually). Please let me know if I'm missing something that would save me some effort.
It sounds good, mhixson2. I am glad you have found a "workaround". Let us know if it is all right to lock this topic.