Page 1 of 1

Sms notification?

Posted: Mon Jun 12, 2017 2:07 am
by Nano
Hello everyone,

How can I connect Nagios XI 5.4.4 with usb modem ZTE MF 180 for sending sms notification?
Is there a tutorial?

Thanks

Re: Sms notification?

Posted: Mon Jun 12, 2017 9:22 am
by tmcdonald
We don't have any documentation for that model specifically. If you can reach out the the vendor they might have an API we can help you use.

Re: Sms notification?

Posted: Tue Jun 13, 2017 2:04 am
by Nano
This is documentation for modem mf 180.link. http://download.ztedevice.com/UploadFil ... 104653.pdf
On the other computers I also installed Now SMS Gateway, and via this address i send sms
link.http://192.168.0.23:8800/?User=test&Pas ... &Text=test

How can I connect Now SMS Gateway with Nagios XI?

Re: Sms notification?

Posted: Tue Jun 13, 2017 12:42 pm
by dwhitfield
We have https://exchange.nagios.org/directory/A ... le/details which may be of some use.

Unfortunately, we don't have many SMS modems to test against. If you'd like to send us one, here is our address:

Nagios Enterprises, LLC
1295 Bandana BLVD N, Suite 165
Saint Paul, MN 55108

Re: Sms notification?

Posted: Tue Jun 13, 2017 2:29 pm
by mcapra
In my mind, you could write a custom Notification Handler for this.

If you can send a message from the CLI of the Nagios XI machine like so:

Code: Select all

curl -XGET 'http://192.168.0.23:8800/?User=test&Password=test&PhoneNumber=0038268xxxxxx&Text=test'
Then that command wouldn't be that hard to turn into a notification handler. More on notification handlers (or "event handlers") here:
https://assets.nagios.com/downloads/nag ... dlers.html

So with that by itself you can send a message. Great, but how do I customize the message based on the service/host check? Macros:

See the "Service Notifications" and "Host Notifications" columns for what macros you have available to you. If you were defining a Nagios command to represent a notification handler, it could look something like this:
https://pastebin.com/y33WXdin

Code: Select all

define command{
    command_name    notify-service-by-sms-modem
    command_line    curl -XGET 'http://192.168.0.23:8800/?User=test&Password=test&PhoneNumber=$CONTACTPAGER$&Text=$SERVICEOUTPUT$'
    }
 
....
 
define contact{
        contact_name                    nagiosadmin
        alias                           Nagios Admin
        email                           [email protected]
        pager                           +11234567890
        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-sms-modem
        host_notification_commands      notify-host-by-email    ; send host notifications via email
        }
Where the $CONTACTPAGER$ macro gets fed into your HTTP request and is a reference to the contact object's pager setting. That's how you determine "should this person get a SMS about this service"; By defining them as a contact object (this is done automatically for Nagios XI system users).

So now you have determined what number should receive the SMS messages, how do you determine the contents of that message? The $SERVICEOUTPUT$ macro will, at the time a notification is dispatched by Nagios XI, contain the first line of the plugin's status output. For check_ping, it might be something like "PING FAILED ALL THE PACKETS DROPED". Or if you're checking disk space, it might be "OH DANG THERE'S NO SPACE LEFT ON C:". Point being, it totally depends on the plugin being leveraged.

But I am grossly oversimplifying things in the above example. The problem you are facing is totally solvable, but the solution is non-trivial.

Re: Sms notification?

Posted: Tue Jun 13, 2017 2:41 pm
by dwhitfield
@Nano, did you have any more questions?

@mcapra, thanks for the assist!