Hi -
Our helpdesk uses host groups to properly assess the system's SLA and corrective action as part of their escalation procedure. Is there a way to display all of the host groups that a particular host is a part of ?
Adding host groups to the email subject / body
-
tonyleatwork
- Posts: 91
- Joined: Mon Jul 07, 2014 8:55 am
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Adding host groups to the email subject / body
You should be able to use the macro $HOSTGROUPNAMES$ for this:
Code: Select all
http://nagios.sourceforge.net/docs/3_0/macrolist.html#hostgroupnamesAs of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
-
tonyleatwork
- Posts: 91
- Joined: Mon Jul 07, 2014 8:55 am
Re: Adding host groups to the email subject / body
Thanks. I just made changes to my email template and clicked "set as default"
I noticed the variables used there are with % while this macro uses $ sign.
I specified both:
$HOSTGROUPNAMES$ and %HOSTGROUPNAMES% just in case.
I noticed the variables used there are with % while this macro uses $ sign.
I specified both:
$HOSTGROUPNAMES$ and %HOSTGROUPNAMES% just in case.
-
tonyleatwork
- Posts: 91
- Joined: Mon Jul 07, 2014 8:55 am
Re: Adding host groups to the email subject / body
Didn't work
Can these macros work inside notifications?
Here is what I got as a notification (look at the bottom)
Can these macros work inside notifications?
Here is what I got as a notification (look at the bottom)
Code: Select all
***** Nagios XI Alert *****
Nagios has detected this service has recovered.
Notification Type: RECOVERY
Service: /boot Disk Usage
Host: nwd2op5.corp.analog.com
Address: nwd2op5.corp.analog.com
State: OK
Info:
DISK OK - free space: /boot 425 MB (92% inode=99%):
Date/Time: 2015-02-04 00:20:01
Respond: http://nwd2ng01.corp.analog.com/nagiosxi/rr.php?uid=49-8527-0d7d78f060b30bbb5ed6e3fdb8465c24
Nagios URL: http://nwd2ng01.corp.analog.com/nagiosxi/
Host is part of the hostgroups:
$HOSTGROUPNAMES$ %HOSTGROUPNAMES%
-
tonyleatwork
- Posts: 91
- Joined: Mon Jul 07, 2014 8:55 am
Re: Adding host groups to the email subject / body
Ok - I googled Nagios XI notifications and I guess you wanted me to add that macro to the email event handler. I just tried that and I'm waiting for the system to kick me an email from an alert (I have really high load but thats a separate issue). Will report back with the results.
-
tonyleatwork
- Posts: 91
- Joined: Mon Jul 07, 2014 8:55 am
Re: Adding host groups to the email subject / body
It worked! In the future, if you can dumb it down for me I'd greatly appreciate it 
- Step 1 - Find the macro you want from this list
Step 2 - Assign the macro to the command (Nagios CCM > Command > xi_host_notification_handler and xi_service_notification_handler)
Step 2b - Assign a macro to a variable by giving the variable the name you want and the macro as the source - i.e. --hostgroupnames=$HOSTGROUPNAMES$ - detailed here: http://assets.nagios.com/downloads/nagi ... iables.pdf
Step 3 - Modify your notifications in Admin > Notification Management to include your new variable (in my case %hostgroupnames% - CASE SENSITIVE!!)
Re: Adding host groups to the email subject / body
We'll go ahead and close the thread. Thanks.