Page 1 of 1

Customising Alerts for SMS

Posted: Wed Nov 24, 2010 6:19 am
by Box293
I've been looking at how to customise the alerts that are sent out via SMS. We email our alerts to an SMS gateway that in turn sends these to our phones.

Currently one problem we have is the length of SMS messages is 160 characters and the important information being sent gets cut off.

I figure I need to create a custom command to be used by the contact template.

From what I understand the following process occurs:
  • Service generates alert
    Alert is sent to the contact attached to the service
    The contact uses the contact template xi_contact_generic
    xi_contact_generic uses the command xi_service_notification_handler
When I look at xi_service_notification_handler this command does not seem to match the format of the email being sent out.

The command notify-service-by-email seems to more match the email that is currently being sent.

Am I on the right track? I am a little confused at the moment. Could you please shed some light onto the situation.

Re: Customising Alerts for SMS

Posted: Wed Nov 24, 2010 10:28 am
by mguthrie
I don't personally know how to do what you're looking for, but maybe these can point you in the right direction.

Doc on Global event handlers and implementing your own:
http://assets.nagios.com/downloads/nagi ... ur-mobile/


The actual php code for grabbing the SMS notification message is in nagiosxi/html/includes/utils-notifications lines 63-93.

If that's not what you need let us know and we'll try and find you what you need.

Re: Customising Alerts for SMS

Posted: Wed Nov 24, 2010 11:49 am
by admin
You don't have to hack any PHP code to customize your notifications. Just select "Notification Messages" under your account page and customize the information that is contained in the notification message.

Re: Customising Alerts for SMS

Posted: Wed Nov 24, 2010 5:15 pm
by Box293
Awesome this is so simple. :D

Under Notififcation Methods is there a way we can define our own carriers?

Right now I have setup seperate user accounts just for SMS alerts so it will be easy to change the email notification message but I do like the option of Mobile Text and only having one Nagios user account.

Re: Customising Alerts for SMS

Posted: Fri Nov 26, 2010 12:23 pm
by mguthrie
My apologies for my first response being needlessly complicated, I misunderstood what you were asking.

We don't currently have the feature built in that allows custom carriers, however, you can send SMS message through email, which is actually how XI sends it anyway. You just have to identify the address for the carrier and pair the phone number with it. The format XI uses for it's carriers is at follows:
[email protected] (sprint)
[email protected] (t-mobile)

Would that get you what you need?

Re: Customising Alerts for SMS

Posted: Tue Nov 30, 2010 5:16 pm
by Box293
No problems, I often end up somewhere complicated :lol:

The exact method you've explained here is how it works for us. I've setup dedicated users for SMS alerts, set their email address to be the phonenumber@carrier and customised the notification method for each user.