1

Is there any way by which I can send nagios alerts to Amazon SNS ?

I have tried with following steps, but its giving me this error in the Nagios log file:

Jul 12 11:38:23 ip-10-134-13-204 nagios3: Warning: Attempting to execute the command "export $NOTIFICATIONTYPE $HOSTNAME $HOSTSTATE $HOSTADDRESS $HOSTOUTPUT $LONGDATETIME | sh -x /etc/nagios3/notify_by_sns" resulted in a return code of 127.  Make sure the script or binary you are trying to execute actually exists...

Command script:

cat /etc/nagios3/notify_by_sns

#!/bin/bash
#########################################################


export AWS_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXX
export AWS_SECRET_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXX
export AWS_SNS_HOME=/usr/local/sns

sns-publish arn:aws:sns:us-west-1:xxxxxxxxxxxx:NAGIOS --subject "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" --message "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n"

EDIT
Thanks for reply Adam.

I am able to excute sns-publish from command line and script is also wroking fine. I am facing problem is nagios

EROOR MSG IS :-

Warning: Attempting to execute the command "/usr/lib/nagios/plugins/notify_by_sns $NOTIFICATIONTYPE $HOSTNAME $HOSTSTATE $HOSTADDRESS $HOSTOUTPUT $LONGDATETIME" resulted in a return code of 127. Make sure the script or binary you are trying to execute actually exists...

Chris S
  • 77,337
  • 11
  • 120
  • 212
  • Have you tried fully qualifying the path to sns-publish in the script? It's likely that nagios will require that for security reasons. – ianjs Jul 14 '13 at 02:13
  • What happens when you run `/etc/nagios3/notify_by_sns` manually from the CLI, with some appropriate arguments? – MadHatter Jul 16 '13 at 14:44

0 Answers0