Sms notification?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
Nano
Posts: 2
Joined: Fri Jun 09, 2017 10:07 am

Sms notification?

Post 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
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Sms notification?

Post 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.
Former Nagios employee
Nano
Posts: 2
Joined: Fri Jun 09, 2017 10:07 am

Re: Sms notification?

Post 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?
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Sms notification?

Post 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
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Sms notification?

Post 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.
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: Sms notification?

Post by dwhitfield »

@Nano, did you have any more questions?

@mcapra, thanks for the assist!
Locked