LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
LinkBack Search this Thread
Old 08-13-2007, 06:43 AM   #1
aeby
Member
 
Registered: Mar 2007
Posts: 109

Rep: Reputation: 15
nagios + changing the senders email address


Hi,

is there a way to change the senders email address using nagios, beacuse i have setup nagios on mutiple machines and i am not able to identify which machine send me the email coz it is all from nagios@domainname.com.

I need to cahnge it to hostname@domainname.com.
So that i can find out which machine send it.

i have setup the hostname and domianname properly.

Regards,
 
Old 08-13-2007, 08:45 AM   #2
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,393
Blog Entries: 1

Rep: Reputation: 63
Instead, change the subject and/or body of message to show the machine name.
In 'service-notify-by-email' command definition (in my config it is in /etc/nagios/commands.cfg), the command is defined as:
Code:
command_line    /bin/echo -e "$NOTIFICATIONTYPE$  - Service notification for $SERVICEDESC$ from host $HOSTNAME$ - $HOSTALIAS$\n$SERVICEDESC$: $SERVICEOUTPUT$\n" | /bin/mail -s '$NOTIFICATIONTYPE$/$SERVICESTATE$ - $HOSTNAME$/$SERVICEDESC$' $CONTACTEMAIL$
And I receive e-mails with a subject like this: "PROBLEM/WARNING - minibit/DISK_HOME" , where "minibit " is the hostname of the machine where the service "DISK_HOME" has an alarm.
You can, of course, rewrite the subject and/or body as you wish.

regards,
 
Old 08-13-2007, 01:35 PM   #3
JimBass
Senior Member
 
Registered: Oct 2003
Location: New York City
Distribution: Debian Sid 2.6.32
Posts: 2,100

Rep: Reputation: 48
Personally I setup subdomains for my multiple nagios boxes, then config the exim mailer they use (all Debian systems in my case, but the OS isn't at all an issue) to mail out as subdomain.domain.com, subdomain2.domain.com, subdomain3.domain.com. Works very well for me, but Marozsas suggestion works just as well. Its more a questions of what is easiest for you to do.

Peace,
JimBass
 
Old 08-14-2007, 03:22 AM   #4
aeby
Member
 
Registered: Mar 2007
Posts: 109

Original Poster
Rep: Reputation: 15
Hi marozsas,

Nagios email by default sends the hostname in the subject line, but i am fine with that , what i need to do is to change nagios@domain.com to machinename@domain.com. So that it reflects the machine's name in the senders feild of the email address.

Thanks for the help, how do i get that done.

Regards
 
Old 08-14-2007, 04:13 AM   #5
aeby
Member
 
Registered: Mar 2007
Posts: 109

Original Poster
Rep: Reputation: 15
Hi Jim,
I dont know how to configure that, nagios by default uses the mail command to send files, is there an option with the mail command to change the senders address, like we can do so with mutt.

Regards,
 
Old 08-14-2007, 06:27 AM   #6
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,393
Blog Entries: 1

Rep: Reputation: 63
Quote:
Originally Posted by aeby View Post
.. is there an option with the mail command to change the senders address...
Yes, you right, aeby. If I remember it was the option -f (from). But this was true for old versions. Looks like the new versions does not have this option anymore. At least, mine does not have (Fedora 7, mailx-8.1.1-46.fc7). I think this option was removed to fight spammers, to avoid forgery addresses.

So, your problem is not a nagios issue, but an e-mail issue.
As aeby mentioned, may be you find a mail command out there with this feature and them, its just a case of change the service-notify-by-email definition to use it.

Follow aeby sugestion and try with mutt.

Last edited by marozsas; 08-14-2007 at 06:33 AM.
 
Old 08-14-2007, 08:24 AM   #7
yanik
Member
 
Registered: Oct 2003
Location: Montreal Beach
Distribution: Debian Unstable
Posts: 368

Rep: Reputation: 30
As marozsas mention, you have to edit the 'service-notify-by-email' command definition.

By default it uses /bin/mail, which doesn't have the -f option. But plain old sendmail still have it and it works quite well. You'll have to setup sudo or something tho, because sendmail is usually in /usr/sbin.
 
Old 05-20-2009, 07:57 AM   #8
lhansen
LQ Newbie
 
Registered: May 2009
Posts: 1

Rep: Reputation: 0
I have used option '-a "From: my-specific-addresses@company.com"' successfully.
 
Old 02-12-2010, 12:02 PM   #9
vikjon0
LQ Newbie
 
Registered: Aug 2009
Posts: 3

Rep: Reputation: 1
Quote:
Originally Posted by lhansen View Post
I have used option '-a "From: my-specific-addresses@company.com"' successfully.

Yes! Works perfect. Thank you.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
mutt + changing senders email address aeby Linux - Server 7 11-21-2012 11:20 AM
sendmail outbound relaying based on senders address dbnor Linux - Networking 2 01-27-2007 09:44 AM
No email alert from Nagios packets Linux - Software 0 10-18-2005 11:56 AM
Nagios not sending alerts through email lemay_jeff Linux - Networking 2 04-11-2005 10:28 AM
Sendmail --> Blocking email from senders ForumKid Linux - General 2 10-25-2002 02:46 PM


All times are GMT -5. The time now is 08:40 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration