Nagios XI macro vs variables questions

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
dfmco
Posts: 257
Joined: Wed Dec 04, 2013 11:05 am

Nagios XI macro vs variables questions

Post by dfmco »

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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios XI macro vs variables questions

Post by scottwilkerson »

You can only use the macros here in the columns Host/Service Notifications for custom notifications:
https://assets.nagios.com/downloads/nag ... olist.html
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
dflick
Posts: 72
Joined: Tue Nov 12, 2013 3:16 pm

Re: Nagios XI macro vs variables questions

Post by dflick »

I think that maybe we have a miscommunication. I am looking at the other way around. I wanted to know if VARIABLES like %alertsummary% would be available to a custom command.

Currently the Macros are working as intended but I would like to add variables to those commands (as well as macros that are already functioning).

Specifically, would this command work (see where I added "Alert Summary is %alertsummary%")?

/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$ Alert Summary is %alertsummary% Date/Time: $LONGDATETIME$ Duration: $HOSTDURATION$ Info: $HOSTOUTPUT$"
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios XI macro vs variables questions

Post by scottwilkerson »

%alertsummary% cannot be used as it is a special macro added just to the XI notification handler

None of the %xxxxx% can be used directly on a custom command, just the $xxxx$ in the link I previously referenced.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
dflick
Posts: 72
Joined: Tue Nov 12, 2013 3:16 pm

Re: Nagios XI macro vs variables questions

Post by dflick »

That answers my question exactly! Thanks!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios XI macro vs variables questions

Post by scottwilkerson »

dflick wrote:That answers my question exactly! Thanks!
Great. Locking thread.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked