Change the default email address

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
nagiosjam
Posts: 81
Joined: Thu Feb 04, 2016 2:47 am

Change the default email address

Post 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
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Change the default email address

Post 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.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Change the default email address

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Change the default email address

Post 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.
Former Nagios Employee
nagiosjam
Posts: 81
Joined: Thu Feb 04, 2016 2:47 am

Re: Change the default email address

Post 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
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Change the default email address

Post by rkennedy »

Just to confirm - are we good to mark this thread as resolved?
Former Nagios Employee
nagiosjam
Posts: 81
Joined: Thu Feb 04, 2016 2:47 am

Re: Change the default email address

Post by nagiosjam »

yes....thanks !!! :-)
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: Change the default email address

Post 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.
Be sure to check out the Knowledgebase for helpful articles and solutions!
Locked