Page 1 of 1

Change the default email address

Posted: Fri Apr 15, 2016 12:53 am
by nagiosjam
Hi
I 'm new to the forum , the first greetings to all and feel my low level of English , I hope I understand

I 'm trying to change the default email address is [email protected] and want to change by [email protected] 've searched the forum and solutions that do not work me , please help .
Here you can see my command.cfg

# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios Host Notification*****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n\nPerformance Host Data: $HOSTPERFDATA$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$ -f [email protected]
}

# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios Service Notification*****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info: $SERVICEOUTPUT$\n\nPerformance Service Data: $SERVICEPERFDATA$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$ -f [email protected]
}


Thanks

Re: Change the default email address

Posted: Fri Apr 15, 2016 10:53 am
by ssax
Try changin the -f to -r:

Code: Select all

# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios Host Notification*****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n\nPerformance Host Data: $HOSTPERFDATA$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$ -r [email protected]
}

# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios Service Notification*****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info: $SERVICEOUTPUT$\n\nPerformance Service Data: $SERVICEPERFDATA$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$ -r [email protected]
}
Let us know if that works for you.

Re: Change the default email address

Posted: Fri Apr 15, 2016 10:56 am
by lmiltchev
Are you trying to change your contact's email from [email protected] to [email protected], or you want to change the "from" email address? Can you show us the contact definition, and an actual email that was received by this contact?

Re: Change the default email address

Posted: Fri Apr 15, 2016 10:56 am
by rkennedy
The command already has the email specified, as $CONTACTEMAIL$. What you need to do is change that variable.

Take a look at /usr/local/nagios/etc/contacts.cfg, and change the email listed for 'nagiosadmin'. Then, run service nagios restart to reload your configuration files.

Re: Change the default email address

Posted: Mon Apr 18, 2016 2:59 am
by nagiosjam
good morning.
I use sendmail and editing the sendmail configuration file is already solved by changing the domain. with nagios configuration files it has not been possible . thanks for the help

Re: Change the default email address

Posted: Mon Apr 18, 2016 12:34 pm
by rkennedy
Just to confirm - are we good to mark this thread as resolved?

Re: Change the default email address

Posted: Tue Apr 19, 2016 12:49 am
by nagiosjam
yes....thanks !!! :-)

Re: Change the default email address

Posted: Tue Apr 19, 2016 9:35 am
by bwallace
Glad we were able to help. We'll lock this thread now and feel free to open another should you require assistance with anything else.