configurable sender email address for alerts?
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
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 noreply at foo.com "
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 907-465-8591 John.Thurston at alaska.gov Enterprise Technology Services Department of Administration State of Alaska
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 email.address at example.com - fnoreply at example.com
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='noreply at example.com' mymailx"
Or perhaps install a new MUA, such as "nail" - one that supports "-r".
J
On 17 January 2014 05:50, John Thurston <john.thurston at alaska.gov> 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 noreply at foo.com "
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 907-465-8591 John.Thurston at alaska.gov Enterprise Technology Services Department of Administration State of Alaska
Xymon mailing list Xymon at xymon.com http://lists.xymon.com/mailman/listinfo/xymon
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 noreply at foo.com "
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}
Do things because you should, not just because you can.
John Thurston 907-465-8591 John.Thurston at alaska.gov Enterprise Technology Services Department of Administration State of Alaska
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
On Fri, Jan 17, 2014, at 4:59, henrik at hswn.dk 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.
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
-----Original Message----- From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of henrik at hswn.dk 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
Xymon mailing list Xymon at xymon.com http://lists.xymon.com/mailman/listinfo/xymon
participants (5)
-
feld@feld.me
-
glauber.ribeiro@experian.com
-
henrik@hswn.dk
-
jlaidman@rebel-it.com.au
-
john.thurston@alaska.gov