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.