Specify actual values in SMS Alerts

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
kaushalshriyan
Posts: 124
Joined: Fri May 22, 2015 7:12 am

Specify actual values in SMS Alerts

Post 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
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: Specify actual values in SMS Alerts

Post 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.
Previous Nagios employee
kaushalshriyan
Posts: 124
Joined: Fri May 22, 2015 7:12 am

Re: Specify actual values in SMS Alerts

Post by kaushalshriyan »

Hi Avandemore,

It worked like a charm !!!

Thank you so much

Regards,

Kaushal
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Specify actual values in SMS Alerts

Post by dwhitfield »

Great! Is it okay if we lock this thread? Thanks for choosing the Nagios forums!
Locked