Solved

Nagios - Change "Sent From" address

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
Resolve Outlook connectivity issues after moving mailbox to new Exchange 2016 server
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now