I’m having an issue that I’m sure has a solution, but my mind won’t wrap itself around it for some reason.
I’m trying to designate the following notify-service-by-email command with a slight tweak to the command:
‘notify-service-by-email’ command definition
command_line /usr/bin/printf “%b” “***** Nagios \n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info: $SERVICEOUTPUT$\n\nVATS Wiki: $SERVICEACTIONURL$\n\nContacts: $CONTACTGROUPMEMBER$\n" | /usr/bin/mail -s "* $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **” $CONTACTEMAIL$
I bolded and underlined the specific macro that I’m using. In my mind, when a service is alerted a contact group, the members in the defined contact group are listed through the $CONTACTGROUPMEMBERS$ macro.
The actual alerts themselves are fine, as they’re getting to the right people. But what’s outputted by $CONTACTGROUPMEMBERS$ doesn’t match what I think it should. What seems to be happening is it finds the first contactgroup that one of the members is a part of and sets the contacgroupmembers designation as such. This seems to be backed up by the definition of the macro here:
Number two sounds like what it’s actually doing. SO… my question is, how do I output the contactgroup that’s associated for the service?
Here’s how I have contacts and groups set up:
generic contact is the default parameters.
alias servicecheck1 (joseph,nik,zhifei,alerts,roger,eric)
alias servicecheck2 (joseph,jeff,shawn,alerts)
What happens here is that servicecheck1’s email gets sent to the correct members, but the members in servicecheck2 are displayed through both the $CONTACTGROUPMEMBERS$ and $CONTACTGROUPALIAS$ macros.
I hope I’m not being too confusing… any help would be great!