Page 1 of 1

User Contact Vs. Contact

Posted: Mon Jun 28, 2021 5:39 am
by michael-darro
Hey Support,

Almost have everything configured the way I want it.

Just looking for some guidance regarding email and SMS notifications. One thing that I noticed with our old Nagios environment was that when a new employee came along it always took about 2 or 3 days to work out which groups in Nagios a user needed to be a member of. With the new version what I'm looking to do is send alerts to Exchange Distribution lists allowing for a simple configuration in Nagios.

I've configured a new contact that's not attached to a user. I'm able to get the alerts but they look ugly compared to the ones that are attached to users. For example the sending email when attached to a user is [email protected] but when it's being sent as nagios@%hostname%.localdomain.

The following documentation helped me configure the user https://assets.nagios.com/downloads/nag ... ios-XI.pdf starting from Contact Notification Configuration.

I have looked at the bottom of the document which it point you to another doco regarding changing the Mange Email Setting. This has been configured but is only working with notifications attached to users.

P.S. Sorry that I've added a few posts on here.

Regards,
Michael

Re: User Contact Vs. Contact

Posted: Mon Jun 28, 2021 2:21 pm
by ssax
Admin > Notification Management and the default XI user email templates require an XI user otherwise they won't work.

Core Contacts (what we call contacts that do not have an associated user in Admin > Manage Users) will use the notify-host-by-email and notify-service-by-email commands which have the email template defined directly on the commands. See the notify-host-by-email and notify-service-by-email commands in Configure > Core Config Manager > Commands, that is where you would need to adjust the them for the Core Contacts.

Please see here as well:

https://assets.nagios.com/downloads/nag ... ntacts.pdf

Re: User Contact Vs. Contact

Posted: Mon Jun 28, 2021 6:42 pm
by michael-darro
Hi,

The document that you provided was all the stuff that has already been done but actually hasn't answered the question that I had.

How to I change the outgoing email from nagios@%localhostname%.localdomain to [email protected]?

Thanks
Michael

Re: User Contact Vs. Contact

Posted: Tue Jun 29, 2021 1:12 pm
by ssax
Apologies.

You can set the Send From in Admin > Email Settings for XI users.

For Core Contacts, you can these commands in Configure > Core Config Manager > Commands:
- notify-host-by-email
- notify-service-by-email

From these (the defaults):

Code: Select all

    command_name    notify-host-by-email
    command_line    /usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$

    command_name    notify-service-by-email
    command_line    /usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
To these (adding -r '[email protected]' to the mail command):

Code: Select all

    command_name    notify-host-by-email
    command_line    /usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -r '[email protected]' -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$

    command_name    notify-service-by-email
    command_line    /usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -r '[email protected]' -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
Then apply configuration and validate.