Page 1 of 1

Specify actual values in SMS Alerts

Posted: Wed Nov 02, 2016 1:08 pm
by kaushalshriyan
Hi,

I am using Nagios 4.2.0 version in production. I get sms saying it is critical but does not tell how much disk space is consumed. is there a way to specify values in the sms text messages?
For example hard disk space is critical and it should specify value how much disk space is remaining. In the SMS alert it should specify value like :- Current Disk used is 98GB.

is it done using SERVICEOUTPUT or LONGSERVICEOUTPUT as per https://assets.nagios.com/downloads/nag ... olist.html. Any examples to understand the usage of SERVICEOUTPUT or LONGSERVICEOUTPUT or is there a better way to handle it.

My command line to send sms is as follows.

#command_name notify-service-by-sms
define command{
command_name notify-service-by-sms
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$ \nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | wget "http://smsgatewayprovider/HttpLink?uid= ... $&message='** $NOTIFICATIONTYPE$ Service Alert: $SERVICEDESC$ on $HOSTNAME$ State: $SERVICESTATE$ @ $LONGDATETIME$ **'&signature=PROD"
}


Any help will be highly appreciable.

Thanks in Advance

Regards,

Kaushal

Re: Specify actual values in SMS Alerts

Posted: Wed Nov 02, 2016 3:47 pm
by avandemore
You should referencing this document as it's meant for the version you're using: https://assets.nagios.com/downloads/nag ... olist.html

The command_line is wrong, it should be something like:
wget "http://smsgatewayprovider/HttpLink?uid= ... $&message='** $NOTIFICATIONTYPE$ Service Alert: $SERVICEDESC$ on $HOSTNAME$ State: $SERVICESTATE$ @ $LONGDATETIME$ $SERVICEOUTPUT$ **'&signature=PROD"

The formatting it largely dependent your 3rd party sms gw provider. Consult them for related issues.

Re: Specify actual values in SMS Alerts

Posted: Mon Nov 07, 2016 11:20 am
by kaushalshriyan
Hi Avandemore,

It worked like a charm !!!

Thank you so much

Regards,

Kaushal

Re: Specify actual values in SMS Alerts

Posted: Mon Nov 07, 2016 11:38 am
by dwhitfield
Great! Is it okay if we lock this thread? Thanks for choosing the Nagios forums!