Easier way to make nagios send mail as different user?

Tom Throckmorton throck at gmail.com
Thu May 29 06:52:55 CEST 2008


On 5/28/08 7:50 AM, Drew Weaver wrote:
> The two ways I've come up with to make nagios send notifications as a different user are:

Drew, are you trying to customize the outgoing mail so that it _appears_ 
the mail is coming from a different user, or so that the mail is 
actually being emitted by a user other than the one running your nagios 
daemon?  I'm guessing it's the former...

> Write a wrapper which allows mail to be sent with normal headers

No need to write anything - just use a different/better MUA.  For 
example, I use mutt (in mailx mode) in a notification command, something 
like:

> /usr/bin/printf "$MACROS_YOU_WANT_IN_THE_MESSAGE_BODY" |/usr/bin/mutt -x -s "$MACROS_YOU_WANT_IN_THE_SUBJECT" $CONTACTEMAIL

...and then in a .muttrc for the nagios user, add a 'set from=' to match 
the pretty name of the user from whom I want the mail to appear to have 
originated.  The bonus with this arrangement is that it gives me the 
opportunity to tweak additional settings on mail notifications, for 
example to set custom headers, inside .muttrc:

> set hdrs
> my_hdr X-Nagios: alert
> my_hdr X-Priority: 1

...etc.  Depending on what you're actually shooting for, you may also 
need to make some adjustments to the local MTA configuration, but if 
your goal is to change the superficial appearance of the mail, the above 
might be sufficient.

> run nagios as a different user

...how would that solve your problem?

> are there any different options?

Yes :)

Cheers,

-tt

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list