For this purpose I added a customized field _SLACKID to each contact. Because the notification contact is "slack", I can't use the $_CONTACTSLACKID$ in the notification command (which caused a warning and didn't work either).
Code: Select all
define contact{
contact_name slack ; Short name of user
use generic-contact ; Inherit default values from datahub-contact
alias Slack Alert User ; Full name of user
service_notification_commands notify-service-by-slack ; send service notifications to slack
host_notification_commands notify-host-by-slack ; send host notifications to slack
_SLACKID N/A ; Slack User ID
}
define contact{
use generic-contact ; Inherit default values from generic-contact template (defined above)
contact_name user1 ; Short name of user
alias First Lastname ; full name
email [email protected]
_SLACKID UC1AB2C3D ; Slack User ID
}
Unfortunately this doesn't work (at least I couldn't get it working...)
$_CONTACTSLACKID:$NOTIFICATIONAUTHOR$$ doesn't work
I also tried $_CONTACTSLACKID:$NOTIFICATIONAUTHOR$, but with same result.
nagos.debug:
Code: Select all
[1536061902.178589] [2048.2] [pid=24116] Processing part: '_CONTACTSLACKID:'
[1536061902.178598] [2048.2] [pid=24116] Processed '_CONTACTSLACKID:', Free: 0
[1536061902.178606] [2048.0] [pid=24116] WARNING: An error occurred processing macro '_CONTACTSLACKID:'!
[1536061902.178620] [2048.2] [pid=24116] Non-macro. Running output (248): '/opt/Custom-Nagios-Plugins/notify_slack.sh -t "ACKNOWLEDGEMENT" -a "Roger Niesten" -C "test message (contactname: slack_test, contactalias: Slack Alert User for testing, author: Roger Niesten, email: $CONTACTEMAIL:$NOTIFICATIONAUTHOR$, slack-ID3: '
[1536061902.178630] [2048.2] [pid=24116] Processing part: 'NOTIFICATIONAUTHOR'
[1536061902.178639] [2048.2] [pid=24116] Not currently in macro. Running output (284): '/opt/Custom-Nagios-Plugins/notify_slack.sh -t "ACKNOWLEDGEMENT" -a "Roger Niesten" -C "test message (contactname: slack_test, contactalias: Slack Alert User for testing, author: Roger Niesten, slack-ID3: $_CONTACTSLACKID:$NOTIFICATIONAUTHOR'
Is something wrong in the syntax?
Suggestions to other options to reach my goal are also welcome
Thanks in advance.
Regards,
Roger