Handler to make HTTP Calls for SMS notifications

Hi,

On my Nagios installation, I have a SMS notify service defined as below:

define command {
                command_name notify-service-by-sms
                command_line /usr/bin/ruby /usr/lib/nagios/plugins/send_sms.rb "HOSTNAME, Service SERVICEDESC" "CONTACTPAGER"
}

The send_sms.rb basically does a curl to the SMS provider’s endpoint:

"http://mysmsprovider.com/EnterpriseUi/pushasynchAction/MTM0.html?username=XXX&password=XXXX&from=Nagios&to=#{number}&text=THE_MESSAGE_TO_BE_SENT”

Whats the best way to move this as a handler in Sensu? Do I write a new handler plugin
or is there any existing handler I can piggy back on to make a curl call?

I did come across the sensu-handler-sms plugin but it seems to be related
to a email to SMS gateway providers which is not my use case.

Thank you for your time.

Regards.
@shankerbalan

Hmm. I guess there is no generic “http” handler.
You could either make one or modify the send_sms.rb script to conform to be more like a traditional sensu handler.

Here is an example of a handler that “just makes an http request” to start from:

https://github.com/sensu-plugins/sensu-plugins-pushover/blob/master/bin/handler-pushover.rb

···

On Fri, Sep 9, 2016 at 6:57 AM, Shanker Balan mail@shankerbalan.net wrote:

Hi,

On my Nagios installation, I have a SMS notify service defined as below:

define command {

            command_name                          notify-service-by-sms

            command_line                          /usr/bin/ruby /usr/lib/nagios/plugins/send_sms.rb "$HOSTNAME$, Service $SERVICEDESC$" "$CONTACTPAGER$"

}

The send_sms.rb basically does a curl to the SMS provider’s endpoint:

"http://mysmsprovider.com/EnterpriseUi/pushasynchAction/MTM0.html?username=XXX&password=XXXX&from=Nagios&to=#{number}&text=THE_MESSAGE_TO_BE_SENT

Whats the best way to move this as a handler in Sensu? Do I write a new handler plugin

or is there any existing handler I can piggy back on to make a curl call?

I did come across the sensu-handler-sms plugin but it seems to be related

to a email to SMS gateway providers which is not my use case.

Thank you for your time.

Regards.

@shankerbalan

Hi Kyle,

···

On 09-Sep-2016, at 20:09, Kyle Anderson <kyle@xkyle.com> wrote:

Hmm. I guess there is no generic "http" handler.
You could either make one or modify the send_sms.rb script to conform to be more like a traditional sensu handler.

Here is an example of a handler that "just makes an http request" to start from:
https://github.com/sensu-plugins/sensu-plugins-pushover/blob/master/bin/handler-pushover.rb

Thanks for the links. I’ll modify the pushover handler to work with my provider.

Regards.
@shankerbalan