Page 1 of 1
EG with e-mail support for error messages....
Posted: Tue Oct 23, 2007 7:29 am
by krambriw
Hallo,
I was searching the term "mail" but couldnt find what I was looking for....
What about to add e-mail support to EG?
If there are error conditions detected by EG and shown in the log I would like to send (selected) alerts to my email (handy).
It would be ok with a script but an email plug-in would be great
Best regards, Walter
Re: EG with e-mail support for error messages....
Posted: Sat Nov 03, 2007 6:32 am
by krambriw
Bump
Re: EG with e-mail support for error messages....
Posted: Sat Nov 03, 2007 3:05 pm
by Bartman
You should be able to send mail with a hand full lines of python code. I have a python script sending mail outside EG. I can test if it runs within EG.
But there is no special event for errors. There is no common behaviour on errors in the plugins.
I have thought about asking for a special eventtype for error too...
Re: EG with e-mail support for error messages....
Posted: Sat Nov 03, 2007 3:50 pm
by krambriw
Hallo Bartman,
Yes, this would be interesting to build something on.
In my case, and I believe others too, I run EG 24/7/365 and it would not be nice if it stops (I even have another software monitoring that EG is running...) and therefore it would be very important to know if for instance my script stops executing.
With your script for email it might be possible to do something like this;
Lets say you have a main script that is running (on timer or scheduler). The script also updates a counter or toggles a flag every time it executes. This flag is defined as an eg.global variabel.
Your mail script runs also on timer/scheduler and if it recognizes that the counter/flag has been the same for a couple of runs, it could send a mail.
Of course this only monitors your main script but its better then nothing...
Best regards
Re: EG with e-mail support for error messages....
Posted: Mon Jan 07, 2008 7:48 am
by krambriw
Dear Bartman,
Have you made any tries regarding sending mail from EG?
Do you have a sample script you could publish?
BestR Walter
Re: EG with e-mail support for error messages....
Posted: Mon Jan 07, 2008 8:45 am
by Bartman
I totally forgot about it.
Code: Select all
import smtplib
def mail(to, text, subject):
headers = "From: \"your name\" <[email protected]>To: %s\r\nSubject: %s\r\n\r\n" % (to, subject)
message = headers + text
mailServer = smtplib.SMTP("smtp.address.com")
mailServer.login("user", "password")
mailServer.sendmail("[email protected]", to, message)
mailServer.quit()
mail("recipient", "EG Test", "subject");
Make sure you replace all the placeholders
Re: EG with e-mail support for error messages....
Posted: Mon Jan 07, 2008 8:49 am
by krambriw
Thanks a lot Bartman,
BestR Walter