EDIT: Nagios does not generate Alerts.
Posted: Tue Sep 03, 2013 6:33 am
Hello, we're moving from an old version of Nagios to NagiosXI and since we're located in Sweden we have some custom notification scripts which all seem to work except for this one which we use in our own GSM-modem in case our own email-to-sms-service would be out of order. (Centos 6.4 32-bit)
The issue here is that $CONTACTPAGER$ somehow seems to be interpreted as two strings, first being $CONTACTPAGER which is undefined and therefor null and then a normal $-sign.
This results with an SMS that tries to reach the destination "$", which of course fails.
Also tried using:
Printing the commands normally in the shell works (replacing the variables with data and replacing $CONTACTPAGER$ with the phone number). Pager is defined to the right user.
What am I missing?
Edit: Using with the phone number instead of $CONTACTPAGERS$ results in a success but the management_mobile profile does not execute the appropriate notification.
Contact:
Command:
Unless I specify "notify_by_mobile" in the event handler for the service it doesn't work.
Code: Select all
/usr/bin/printf "%b" "Nagios Says: $SERVICEDESC$ on $HOSTALIAS$ is: $SERVICESTATE$ $LONGDATETIME$ Info is: $SERVICEOUTPUT$" | /usr/local/bin/sendsms $CONTACTPAGER$This results with an SMS that tries to reach the destination "$", which of course fails.
Also tried using:
Code: Select all
/usr/local/bin/sendsms $CONTACTPAGER$ "$LONGDATETIME$ ** $NOTIFICATIONTYPE$ $HOSTALIAS$ Service Alert: $SERVICEDESC$ is $SERVICESTATE$ **"What am I missing?
Edit: Using
Code: Select all
/usr/local/bin/sendsms $CONTACTPAGER$ "$LONGDATETIME$ ** $NOTIFICATIONTYPE$ $HOSTALIAS$ Service Alert: $SERVICEDESC$ is $SERVICESTATE$ **"Contact:
Code: Select all
define contact {
contact_name testmobil
alias test
host_notifications_enabled 1
service_notifications_enabled 1
host_notification_period 24x7
service_notification_period 24x7
host_notification_options d,u,r,f,s,n,
service_notification_options w,u,c,r,f,s,n,
host_notification_commands notify_by_mobile
service_notification_commands notify_by_mobile
can_submit_commands 1
retain_status_information 1
retain_nonstatus_information 1
pager +4676#######
}
Code: Select all
define command {
command_name notify_by_mobile
command_line /usr/local/bin/sendsms +4676####### "$LONGDATETIME$ ** $NOTIFICATI\
ONTYPE$ $HOSTALIAS$ Service Alert: $SERVICEDESC$ is $SERVICESTATE$ **"
}