Nagios XI macro vs variables questions
Posted: Sat Aug 18, 2018 10:22 pm
I am using AWS to send alerts. I am passing standard macros in the alerts ($HOSTNAME$, $HOSTSTATE$). I would like to add the %alertsummary% but wanted to make sure that the notification variable would be appropriate in the command. Here is the command line. It is a custom command.
/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /home/nagios/.local/bin/aws sns publish --topic-arn REDACTED:CAECD_CRIT --subject "Onshore IT CAECD Host Alert $HOSTNAME$ is $HOSTSTATE$" --message "$NOTIFICATIONTYPE$ CAECD Host Alert: $HOSTNAME$ is $HOSTSTATE$ Date/Time: $LONGDATETIME$ Duration: $HOSTDURATION$ Info: $HOSTOUTPUT$"
Can I use %alertsummary% and any other notification variables in this command? Before I go too far down the rabbit hole, I wanted to make sure I was not doing something that would not work.
/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /home/nagios/.local/bin/aws sns publish --topic-arn REDACTED:CAECD_CRIT --subject "Onshore IT CAECD Host Alert $HOSTNAME$ is $HOSTSTATE$" --message "$NOTIFICATIONTYPE$ CAECD Host Alert: $HOSTNAME$ is $HOSTSTATE$ Date/Time: $LONGDATETIME$ Duration: $HOSTDURATION$ Info: $HOSTOUTPUT$"
Can I use %alertsummary% and any other notification variables in this command? Before I go too far down the rabbit hole, I wanted to make sure I was not doing something that would not work.