0

Today I set up a new XYMon monitor VM. The old one used PostFix, but I set up SSMTP.

I can e-mail myself fine from the CLI like such.

echo "Hello, World" | mail -s "My email check" my@email.com

But I can't seem to get XYMon to notify me via E-Mail.

I have done a few tests, I'm suspecting this is related to SSMTP more the XYMon as its fairly simple to set up.

/usr/lib/xymon/server/bin/xymond_alert --test testsite.com http

Results in this line : (Among many others, but this is the important one)

 Mail alert with command '/var/mail/root "Xymon [12345] testsite.com:http CRITICAL (RED)" accountusername@businessdomain.com'

There are a few things wrong with this, first there is no /var/mail/root that I can find, also, accountusername@businessdomain.com is the username I authenticate with and configure SSMTP with, but not the e-mail I actually want this notification sent to.

My SSMTP Configs :

mailhub=smtp.comcast.net:587
UseSTARTTLS=YES
UseTLS=YES
FromLineOverride=YES
hostname=businessdomain.com
AuthUser=accountusername@businessdomain.com
AuthPass=PASSWORD

My Alerts in XYMon :

HOST=testsite.com
MAIL my@email.com REPEAT=1h COLOR=red DURATION>15 RECOVERED

UPDATE

# For the xymond_alert module
MAILC="mail"                            # Command used to send an e-mail with no subject
MAIL="$MAILC -s"                                # Command used to send an e-mail with a subject

root@monitor:/etc/xymon# echo $MAIL
/var/mail/root
  • Did you define the MAIL setting in xymonserver.cfg ? If not then it may default to the $MAIL environment variable, which could easily be /var/mail/root for the root user since that is the default mailbox for root's email. xymon.sourceforge.net/xymon/help/manpages/man5/… – Stephen Harris Jul 20 '16 at 20:52
  • Perhaps I need to export the variable? or change it system wide? – FreeSoftwareServers Jul 20 '16 at 21:15
  • Just try unset MAIL... – Stephen Harris Jul 20 '16 at 21:16
  • That worked! - Should I Change question to be specific to XYMon? Or leave as is? You can write an answer and I'd accept – FreeSoftwareServers Jul 21 '16 at 2:15
2

The problem you're having is in how XYmon determines what mailer to use. It can use the MAIL setting or it can use the $MAIL variable.

Now the default $MAIL setting for root is /var/mail/root and so it will try and execute that as if it was a command.

You can fix this by unsetting the environment variable

unset MAIL

This will ensure XYmon just uses its configuration and isn't overridden by the environment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.