Solved

Nagios - Change "Sent From" address

Posted on 2013-12-30
5
361 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
  • 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
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 get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.:

808 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