LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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
  Search this Thread
Old 11-03-2011, 09:45 AM   #1
Majed17
Member
 
Registered: Jul 2011
Posts: 102

Rep: Reputation: Disabled
how to change the from line in nagios


hello, i have many nagios servers which send emails to same mailbox and they all come in this form:
Code:
Monitoring System [nagios@nagioshostname]
what i want to do is replace
"Monitoring System" with " company 1"
as an example.
does anyone know how to do this?
thanks for any help
 
Old 11-03-2011, 09:52 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,481

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
The "From" name is generally taken from the username of the account running the Nagios process, unless you have given it raised mailing privilages and are setting it in the send mail commands.
 
Old 11-03-2011, 09:56 AM   #3
Majed17
Member
 
Registered: Jul 2011
Posts: 102

Original Poster
Rep: Reputation: Disabled
well i didn't configure anything related to that all i know is that nagios is in the trusted users in sendmail
 
Old 11-03-2011, 09:59 AM   #4
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,481

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
In that case, check the "Full Name" of the nagios account in /etc/passwd
 
Old 11-03-2011, 07:42 PM   #5
4Paul4
Member
 
Registered: Jul 2011
Posts: 51

Rep: Reputation: Disabled
Have a look in the commands.cfg file.

Specifically, look for this:

Code:
# 'notify-host-by-email' command definition
define command{
        command_name    notify-host-by-email
        command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
        }

# '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$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
        }
These command lines are what nagios executes when it needs to notify you via email. Perhaps you can add a parameter to the /usr/bin/mail command to specify a 'From' user.

I have not tried this though.
 
Old 11-04-2011, 01:05 AM   #6
Majed17
Member
 
Registered: Jul 2011
Posts: 102

Original Poster
Rep: Reputation: Disabled
thanks a lot it turned out to be in /etc/passwd
i changed it to :
Code:
nagios:x:102:1002:Bellakt Monitoring:/var/nagios/home:/bin/bash
and now i get messages from Bellakt Monitoring [nagios@domain.com]
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change Threshold time in nagios services prak86 Linux - Newbie 5 05-03-2011 02:43 AM
GroundWork Monitor Open Source - import to nagios by command line aocferreira Linux - Networking 0 04-27-2011 09:35 AM
how to change nagios default logo rajiv.patil82 Linux - Software 2 03-09-2011 06:07 AM
Perl Script works from command line, but not when evoked by Nagios gfem Linux - General 10 06-05-2008 03:59 PM
php - Read file line by line and change a specific line. anrea Programming 2 01-28-2007 01:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:55 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration