centreon / centreon-engine

Extremely fast monitoring scheduler, forked from Nagios
GNU General Public License v2.0
42 stars 17 forks source link

$ADMINEMAIL$ not populated on notification command #484

Closed angeleseros closed 1 year ago

angeleseros commented 3 years ago

We recently upgraded our centreon to v20.10 and I have a notification command as follows:

define command { command_name host-notify-by-email-html-v2 command_line /bin/sh -c '/usr/lib/centreon/custom/bash/notification_via_sendmail_html Date="$DATE$" Time="$TIME$" NotificationType="$NOTIFICATIONTYPE$" Host="$HOSTNAME$" Alias="$HOSTALIAS$" Address="$HOSTADDRESS$" ID="$HOSTPROBLEMID$" PREVID="$LASTHOSTPROBLEMID$" State="$HOSTSTATE$" AdditionalInfo="$HOSTOUTPUT$
[$HOSTACKAUTHOR$]: $HOSTACKCOMMENT$" To="$CONTACTEMAIL$" From=" $ADMINEMAIL$" Subject=" Host $HOSTSTATE$ alert for $HOSTNAME$ " LOGFILE="/var/log/centreon-engine/host_notification_via_sendmail.log"' }

the /usr/lib/centreon/custom/bash/notification_via_sendmail_html is a custom script that formats the values to HTML.

the $ADMINEMAIL$ is no longer being passed down

is the $ADMINEMAIL$ been changed to other macro? Thanks

omercier commented 3 years ago

Hi @angeleseros, Please can you tell me from which version of Centreon you upgraded to 20.10? I will then try to investigate about it. Thanks!

angeleseros commented 3 years ago

From version 18.10

angeleseros commented 3 years ago

Additional Info:

Alert Macros $HOSTACKAUTHOR$, $HOSTACKCOMMENT$, $SERVICEACKAUTHOR$, and $SERVICEACKCOMMENT$ seems to be empty as well when doing acknowledgements.

angeleseros commented 3 years ago

I have tested on a newly installed centreon 20.10.7 with the following notification command:

/usr/bin/printf "%b" " centreon Notification \n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $DATE$ Additional Info : $SERVICEOUTPUT$\nACK Author: $SERVICEACKAUTHOR$\nACK Comment: $SERVICEACKCOMMENT$\nAdmin Email Address: $ADMINPAGER$ <$ADMINEMAIL$>" | @MAILER@ -s " $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ " $CONTACTEMAIL$

and did an acknowledgement of a dummy service on critical and received the following:

centreon Notification

Notification Type: ACKNOWLEDGEMENT

Service: generic-dummy-service-custom Host: generic-dummy-host Address: 1.1.1.1 State: CRITICAL

Date/Time: 2021-05-17 Additional Info : CRITICAL: Dummy Service ACK Author: ACK Comment: Admin Email Address: <>

omercier commented 2 years ago

Hi @angeleseros, Thanks for your feedback. The bug is identified and reproduced. We will fix it soon. Internal reference: MON-11761

omercier commented 2 years ago

Regarding these macros

$HOSTACKAUTHOR$, $HOSTACKCOMMENT$, $SERVICEACKAUTHOR$, and $SERVICEACKCOMMENT$

They are deprecated. Use the more generic $NOTIFICATIONAUTHOR$, $NOTIFICATIONAUTHORNAME$, $NOTIFICATIONAUTHORALIAS$ or $NOTIFICATIONCOMMENT$ macros instead. (cf. https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/3/en/macrolist.html#note8)

joschi99 commented 1 year ago

Hi @omercier, we have still the same issue with empty marco $ADMINEMAIL$ on version 22.04.

Any information regarding this?

omercier commented 1 year ago

Hi Jochen, Sorry, this regression has been left aside for a while. We have re-priorized the ticket in our backlog to fix it soon. PS: for further issues, please use https://github.com/centreon/centreon-collect/