Mail Notifier

Concept

As a good and responsible developer/administrator you’ll want to look at the ELMAH web interface daily, maybe even more than that. You’ll want to know about errors as soon as they are received, so you can make the necessary changes. This causes you to have less aggravated clients.
Because it’s a hassle to open the page daily, we’ve introduced a daily error report that will be send to you through email at a time you can specify yourself.
On top of that, alert emails are also sent whenever a same error occurred 4 times in a timeframe for an anonymous user or 1 time in a timeframe for an authenticated user. The email will contain a link to the error on the ELMAH web interface.

Installation

The installation is fairly simple. Press ‘Next’ 4 times and then press ‘Close’.
elmah_mailnotifier_installation.png

Configuration

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="MailNotifierConfiguration" type="OrbitOne.Elmah.MailNotifier, OrbitOne.Elmah"/>
  </configSections>
 
  <MailNotifierConfiguration
    From="elmah@orbitone.com"
    DailyTo="wimdc@orbitone.com,melg@orbitone.com"
    AlertTo="wimdc@orbitone.com,melg@orbitone.com"
    ElmahWebSite="https://elmah.orbitone.com"
    AuthenticatedErrorCount="1"
    AnonymousErrorCount="4"
  />
 
  <connectionStrings>
    <add name="OrbitOneElmahConnectionString" 
   connectionString="Initial Catalog=OrbitOne_Elmah;Data Source=sql.orbitone.com;Integrated Security=SSPI;"/>
  </connectionStrings>
 
  <system.net>
    <mailSettings>
      <smtp>
        <network
            host="mail.orbitone.com"
            port="25"
            userName="username"
            password="password" />
      </smtp>
    </mailSettings>
  </system.net>
</configuration>
  • From: where do the emails sent by the Notifier come from.
  • DailyTo: the email addresses of the people that want the daily report. (comma separated)
  • AlertTo: the email addresses of the people that want the alert report. (comma separated)
  • ElmahWebSite: the location of the ELMAH website. This is needed to create the links in the email
  • AuthenticatedErrorCount: if an application has this nr of errors (generated by authenticated users) or more, an alert mail will be generated
  • AnonymousErrorCount: if an application has this nr of errors (generated by anonymous users) or more, an alert mail will be generated
  • ConnectionString -> Source: the database server containing the exceptions
  • MailSettings -> smtp -> network -> host: the email server
  • Username: the username needed by the mail server to be able to send messages (not required)
  • Password: the password needed by the mail server to be able to send messages (not required)


Command Line arguments

Possible command line arguments are:
  • –t=Daily
  • –t=Alert –p=30
The –p in the second examples stands for every 30 minutes. This is the default value, so it does not need to be specified explicitly unless you need a different value.
If no arguments are given the default will be a –t=Daily

Monitoring

For monitoring purposes a non event logger has been added. This means that if the Mail Notifier ran without errors and everything went as it should go, an event log entry will be created with EventID = 1.
If an error did occur the event log will show that error and all its information.

Last edited Nov 3, 2009 at 10:43 AM by wdeconinck, version 2

Comments

No comments yet.