Xymon Mailing List Archive search

configurable sender email address for alerts?

7 messages in this thread

list Mark Felder · Thu, 16 Jan 2014 11:56:55 -0600 ·
I have a FreeBSD bug report open from a user who claims that if they run
"sudo service xymon-server start" it starts xymon correctly but the
alert emails come from the wrong email address. Where is Xymon getting
the username from to use when sending emails? Is it configurable in
xymonserver.cfg? Could it be made configurable? The patch the user
suggested to the freebsd rc script seems unnecessary.


Thanks
list John Thurston · Thu, 16 Jan 2014 09:50:46 -0900 ·
quoted from Mark Felder
On 1/16/2014 8:56 AM, Mark Felder wrote:
I have a FreeBSD bug report open from a user who claims that if they run
"sudo service xymon-server start" it starts xymon correctly but the
alert emails come from the wrong email address. Where is Xymon getting
the username from to use when sending emails? Is it configurable in
xymonserver.cfg? Could it be made configurable? The patch the user
suggested to the freebsd rc script seems unnecessary.
I tried setting the value of MAILC in xymonserver.cfg:
  MAILC="mailx -r user-72e0e34f549e@xymon.invalid "

My test with  xymond_alert  report that the -r parameter will be used 
with mailx, but when Xymon actually sends the messages it is not.

-- 
    Do things because you should, not just because you can.

John Thurston    XXX-XXX-XXXX
user-ce4d79d99bab@xymon.invalid
Enterprise Technology Services
Department of Administration
State of Alaska
list Jeremy Laidman · Fri, 17 Jan 2014 13:20:06 +1100 ·
Some versions of mailx do not support "-r".  However, some versions of
mailx allow you to specify arguments to be sent to sendmail like so:

echo test message | mailx -v -s subject user-499f1c0dd1f6@xymon.invalid -
user-7103dcc67637@xymon.invalid

So in this example, mailx will finish parsing switches when it gets to
addresses, and any switch-like arguments after the addresses will get sent
to sendmail.

Unfortunately, you can't use this with MAILC, as Xymon appends the email
addresses to the end.  Instead, you could create your own script to use in
MAILC.  Something like:

#!/bin/sh
if [ "$FROMADDR" ]; then mailx "$@" -f"$FROMADDR"; else mailx "$@"; fi

Then set

MAILC="FROMADDR='user-5badfa275f87@xymon.invalid' mymailx"

Or perhaps install a new MUA, such as "nail" - one that supports "-r".

J
quoted from John Thurston


On 17 January 2014 05:50, John Thurston <user-ce4d79d99bab@xymon.invalid> wrote:
On 1/16/2014 8:56 AM, Mark Felder wrote:
I have a FreeBSD bug report open from a user who claims that if they run
"sudo service xymon-server start" it starts xymon correctly but the
alert emails come from the wrong email address. Where is Xymon getting
the username from to use when sending emails? Is it configurable in
xymonserver.cfg? Could it be made configurable? The patch the user
suggested to the freebsd rc script seems unnecessary.
I tried setting the value of MAILC in xymonserver.cfg:
 MAILC="mailx -r user-72e0e34f549e@xymon.invalid "

My test with  xymond_alert  report that the -r parameter will be used with
mailx, but when Xymon actually sends the messages it is not.

--
   Do things because you should, not just because you can.

John Thurston    XXX-XXX-XXXX
user-ce4d79d99bab@xymon.invalid
Enterprise Technology Services
Department of Administration
State of Alaska

list Henrik Størner · Fri, 17 Jan 2014 11:59:21 +0100 ·
quoted from Mark Felder
Den 16.01.2014 18:56, Mark Felder skrev:
I have a FreeBSD bug report open from a user who claims that if they run
"sudo service xymon-server start" it starts xymon correctly but the
alert emails come from the wrong email address. Where is Xymon getting
the username from to use when sending emails? Is it configurable in
xymonserver.cfg? Could it be made configurable? The patch the user
suggested to the freebsd rc script seems unnecessary.
Xymon just runs the "mail" or "mailx" commandline tool. How that determines what to put as the sender, I don't know.

My guess is that mail uses "From: $USER" as the sender, but it also depends on the MTA setup (sendmail, postfix) of the host where you are running Xymon - e.g. the MTA typically adds the domainname to the sender-address.

Regards,
Henrik
list Mark Felder · Fri, 17 Jan 2014 06:40:37 -0600 ·
quoted from Henrik Størner

On Fri, Jan 17, 2014, at 4:59, user-ce4a2c883f75@xymon.invalid wrote:
Den 16.01.2014 18:56, Mark Felder skrev:
I have a FreeBSD bug report open from a user who claims that if they > run
"sudo service xymon-server start" it starts xymon correctly but the
alert emails come from the wrong email address. Where is Xymon > getting
the username from to use when sending emails? Is it configurable in
xymonserver.cfg? Could it be made configurable? The patch the user
suggested to the freebsd rc script seems unnecessary.
Xymon just runs the "mail" or "mailx" commandline tool. How that determines what to put as the sender, I don't know.

My guess is that mail uses "From: $USER" as the sender, but it also depends on the MTA setup (sendmail, postfix) of the host where you are running Xymon - e.g. the MTA typically adds the domainname to the sender-address.
This is what I suspected but I haven't had free time to experiment. I
honestly haven't been able to recreate the users's bug report either, so
I suspect this is a problem unique to his environment.
list Glauber Ribeiro · Fri, 17 Jan 2014 16:55:38 +0000 ·
It's very easy to override what mail program gets used, in the configuration. It's a variable. Set it to a script that does what you want.

We've used this approach for many years to fix the problem of binary content in the emails (which was addressed in a recent update).

g
quoted from Mark Felder

-----Original Message-----
From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of user-ce4a2c883f75@xymon.invalid
Sent: Friday, January 17, 2014 04:59
To: xymon at xymon.com
Subject: Re: [Xymon] configurable sender email address for alerts?

Den 16.01.2014 18:56, Mark Felder skrev:
I have a FreeBSD bug report open from a user who claims that if they run
"sudo service xymon-server start" it starts xymon correctly but the
alert emails come from the wrong email address. Where is Xymon getting
the username from to use when sending emails? Is it configurable in
xymonserver.cfg? Could it be made configurable? The patch the user
suggested to the freebsd rc script seems unnecessary.
Xymon just runs the "mail" or "mailx" commandline tool. How that determines what to put as the sender, I don't know.

My guess is that mail uses "From: $USER" as the sender, but it also depends on the MTA setup (sendmail, postfix) of the host where you are running Xymon - e.g. the MTA typically adds the domainname to the sender-address.

Regards,
Henrik
list John Thurston · Fri, 17 Jan 2014 08:20:06 -0900 ·
quoted from John Thurston
On 1/16/2014 9:50 AM, John Thurston wrote:
On 1/16/2014 8:56 AM, Mark Felder wrote:
I have a FreeBSD bug report open from a user who claims that if they run
"sudo service xymon-server start" it starts xymon correctly but the
alert emails come from the wrong email address. Where is Xymon getting
the username from to use when sending emails? Is it configurable in
xymonserver.cfg? Could it be made configurable? The patch the user
suggested to the freebsd rc script seems unnecessary.
I tried setting the value of MAILC in xymonserver.cfg:
  MAILC="mailx -r user-72e0e34f549e@xymon.invalid "

My test with  xymond_alert  report that the -r parameter will be used
with mailx, but when Xymon actually sends the messages it is not.
Duh. It works perfectly after I restart Xymon.
{sorry for the interruption}
quoted from Jeremy Laidman
-- 
    Do things because you should, not just because you can.

John Thurston    XXX-XXX-XXXX
user-ce4d79d99bab@xymon.invalid
Enterprise Technology Services
Department of Administration
State of Alaska