Solved

Nagios - Change "Sent From" address

Posted on 2013-12-30
5
362 Views
Last Modified: 2013-12-30
Hi there,

We have Nagios configured on a Ubuntu VM.  We recently changed Windows domains and now need to update this Nagios VM with the right information.  We have changed the hostname from "forbes.corporate.local" to "cne-mon01vm.int.cgg.com".  Nagios is still working properly, but whenever we get a notification email, it still says it is from "nagios@forbes.corporate.local".  I'd like to change it to say it is from "nagios@cne-mon01vm.int.cgg.com" instead but I can't figure out where to change that.  

Please help!

Thanks,
- Christian
0
Comment
Question by:Christian Palacios
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 14

Expert Comment

by:RickEpnet
ID: 39746577
It is in the script that sends the email. Are you using the default alerts or have you added a plugin to get HTML alerts?
0
 

Author Comment

by:Christian Palacios
ID: 39746584
I am using the default alerts that use the default commands.  For example this one:

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

Thanks,
- Christian
0
 
LVL 14

Accepted Solution

by:
RickEpnet earned 500 total points
ID: 39746598
In that case:
To change  the from address you append " -- -f nagios@domain.com", that is without the quotes of course.  So the new lines look like:

/usr/bin/printf "%b" "***** Nagios *****\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$ -- -f nagios@domain.com

and

/usr/bin/printf "%b" "***** Nagios *****\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$  -- -f nagios@domain.com
0
 

Author Comment

by:Christian Palacios
ID: 39746791
Thank you very much!  That worked!

- Christian
0
 

Author Closing Comment

by:Christian Palacios
ID: 39746792
Worked great!
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
linux SFTP 8 77
Migration Exchange server 2013 to 2016 2 94
Redhat upgrade 1 48
Importing into Yahoo mail 3 71
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question