Hello!
Is it possible to use the general system macros like $HOSTNAME$ in alert messages?
Or can I use only the general notification variables?
Using System Macros in Alert Messages
Re: Using System Macros in Alert Messages
Here's a big old list of all the Nagios macros and the contexts in which you can use a given macro:
https://assets.nagios.com/downloads/nag ... olist.html
You might find the "Service Notifications" and "Host Notifications" columns particularly useful in this case. $HOSTNAME$ appears to be usable in pretty much every context.
https://assets.nagios.com/downloads/nag ... olist.html
You might find the "Service Notifications" and "Host Notifications" columns particularly useful in this case. $HOSTNAME$ appears to be usable in pretty much every context.
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: Using System Macros in Alert Messages
@fuchstiger, mcapra is correct. Let us know if you have any more questions.
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
fuchstiger
- Posts: 22
- Joined: Tue Apr 12, 2016 7:42 am
Re: Using System Macros in Alert Messages
Yep, I know this list. We have used it for years with Nagios Core.
But now I configure these mails in Nagios XI and the macros are empty.
I have made a template in notification management for a service alert. In the end of this message I used the following:
Notification Type: $NOTIFICATIONTYPE$
Service: $SERVICEDESC$
Host: $HOSTALIAS$
Address: $HOSTADDRESS$
State: $SERVICESTATE$
Date/Time: $LONGDATETIME$
Additional Info: $SERVICEOUTPUT$
But all of these macros are empty if I get an email with this template.
But now I configure these mails in Nagios XI and the macros are empty.
I have made a template in notification management for a service alert. In the end of this message I used the following:
Notification Type: $NOTIFICATIONTYPE$
Service: $SERVICEDESC$
Host: $HOSTALIAS$
Address: $HOSTADDRESS$
State: $SERVICESTATE$
Date/Time: $LONGDATETIME$
Additional Info: $SERVICEOUTPUT$
But all of these macros are empty if I get an email with this template.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Using System Macros in Alert Messages
Actually I believe this is the document you are looking for, when using XI
https://assets.nagios.com/downloads/nag ... iables.pdf
https://assets.nagios.com/downloads/nag ... iables.pdf
-
fuchstiger
- Posts: 22
- Joined: Tue Apr 12, 2016 7:42 am
Re: Using System Macros in Alert Messages
So if I understand this document there is no possibility to use the system macros variables in the notification management. Right? Only variables in lowercase with the percent sign.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Using System Macros in Alert Messages
Page 8 & 9 of that document shows how you can map additional macrosfuchstiger wrote:So if I understand this document there is no possibility to use the system macros variables in the notification management. Right? Only variables in lowercase with the percent sign.
-
fuchstiger
- Posts: 22
- Joined: Tue Apr 12, 2016 7:42 am
Re: Using System Macros in Alert Messages
Sorry but this is not a solution for me. I want to use the global system macros like "$HOSTADDRESS$" or "$SERVICEOUTPUT$".
If I have to add these variables for many hosts I can use the regular ones for the notifications instead.
If I have to add these variables for many hosts I can use the regular ones for the notifications instead.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Using System Macros in Alert Messages
On page 8 & 9 it shows you how you can add any of the nagios macros and create the required %var% that is required.