Using System Macros in Alert Messages

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
fuchstiger
Posts: 22
Joined: Tue Apr 12, 2016 7:42 am

Using System Macros in Alert Messages

Post by fuchstiger »

Hello!
Is it possible to use the general system macros like $HOSTNAME$ in alert messages?
Or can I use only the general notification variables?
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Using System Macros in Alert Messages

Post by mcapra »

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.
Former Nagios employee
https://www.mcapra.com/
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Using System Macros in Alert Messages

Post by lmiltchev »

@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

Post by fuchstiger »

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

Re: Using System Macros in Alert Messages

Post by scottwilkerson »

Actually I believe this is the document you are looking for, when using XI

https://assets.nagios.com/downloads/nag ... iables.pdf
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
fuchstiger
Posts: 22
Joined: Tue Apr 12, 2016 7:42 am

Re: Using System Macros in Alert Messages

Post by fuchstiger »

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

Post by scottwilkerson »

fuchstiger 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.
Page 8 & 9 of that document shows how you can map additional macros
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
fuchstiger
Posts: 22
Joined: Tue Apr 12, 2016 7:42 am

Re: Using System Macros in Alert Messages

Post by fuchstiger »

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

Re: Using System Macros in Alert Messages

Post by scottwilkerson »

On page 8 & 9 it shows you how you can add any of the nagios macros and create the required %var% that is required.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked