Configure

In the dbWatch Monitor, go to the “Configure”->”Extensions” menu.
Choose on the item “E-mail extension”

To configure the extension, select it and click “Configure”.


You should now see the initial configuration screen (below)

The first section lets you define connection details to the SMTP server.

The “From address” field lets you define which address should appear as the sender in the e-mails you receive from the dbWatch Server.

The second section consists of a set of “Rules”. Initially only one rule (called A) is defined. It is configured to send all messages, from all databases, at all times. If you change the address in the “Receivers” field to a valid e-mail address, you have a simple functional e-mail extension.

After specifying the configuration for your alerts, Click Save.

Choose Email extension and on top click enable.

Adding/Configuring Rules

Lets try creating a Rule that is a little more complicated. A usual case is that we only want to be notified about problems for a subset of the monitored databases (the ones we are responsible for). We click on “Add rule” and call it “My Important messages” (below).

There are a number of fields that can be configured.

Schedules Lets you define at what times you want to receive notifications. An example when this will be usefull is if you want the notifications to go to one address during work hours, and another address during nights/weekends. The format is (minute of the hour) (hour of the day) (day of the week) (week of the year). In the example “* * * *” means all the time. If you want to have a rule active from 08.00 to 16.00 everyday of the week, you should set the schedule to (* 8-16 * *) and if you want it only during work hours set the schedule to (07.00-17.00) and on work days (day 1-5) set it to (* 7-17 1-5 *).
Statuses Lets you define what types of statuses you want to be notified about. In our example we want to be notified when there is an alarm, or a lost connection.

There are 4 filters. These let you define what databases and checks you want to receive notifications from.

Group filter This lets you define that you only want to receive notifications from databases [not] belonging to a particular set of groups.
DBMS type filter This lets you define that you only want to receive notifications from a particular type of databases, or from all types except a particular type.
Package filter This lets you define that you only want to receive notifications from dbWatch Checks [not] belonging to a particular set of packages.
Check filter This lets you define that you only want to receive notifications from particular dbWatch Checks, or from all Checks except a particular Check.

Once you have configured all the rules you want, remember to click “Save”. Then, back in the “Server extensions” screen, select the “E-mail extension” and click “Enable”.

Setting mail formats

To override the default mail format, you can place a set of format files in the “[dbWatch Server]/server/ extensions/edited_configurations/” catalog.

For mails related to alerts the files are:

  • alert_format_subject.txt
  • alert_format_body.txt

For mails related to lost connection the files are:

  • lost_connection_format_subject.txt
  • lost_connection_format_body.txt

For mails related to reconnection the files are:

  • reconnect_format_subject.txt
  • reconnect_format_body.txt

The files called *_subject.txt are used to generate the mail subject
field, and the files called *_body.txt are used to generate the mail body.

There are a set of values that are initiated when the email is generated. These are:

  • ALERT – The name of the alert that generated the event.
  • STATUS – The status for the alert.
  • INSTANCE – The name of the database instance for the alert.
  • ALERT_DETAILS – A description of the alert state.
  • GROUP – The group for the instance.

So a typical format for an alert would be:

alert_format_subject.txt

%STATUS% for %ALERT% on %INSTANCE%

alert_format_body.txt

%STATUS% for %ALERT% on %INSTANCE% for %GROUP%

%ALERT_DETAILS%

This mail was generated automatically by the dbWatch Server.

This will then produce an email similar to the following;

Subject:

WARNING for Database disk space usage on SomeDatabaseInstance

Body:

WARNING for Database disk space usage on SomeDatabaseInstance for Acme Inc

Drive C: 396.7 GB free space. 39 database(s) effected

This mail was generated automatically by the dbWatch Server

Format pr. rule

In addition to the general rule format files, it is possible to specify different formats per rule.

You do this by creating additional files with the rule name in square brackets at the end of the file name.

So if you have a rule called “A”, you can create files called “alert_format_subject[A].txt and “alert_format_body[A].txt”. Then theese files will be used when creating E-mails for this rule.

Remove the “OK” messages

It is possible to stop the Mail extension from sending out the “OK” messages. However there is currently no GUI for this, so you have to edit the configuration file manually.

The configuration file can be found in the “[dbWatch Server]/server/extensions/edited_configurations” catalog and is called “E-Mail extension.xml”.

Open the file in a text editor. There should be a “filter” tag for each of the filters that are defined. Here you can add a tag called “report-improvement” with the value false. This will cause the extension to skip the OK messages for this filter.

You have to restart the dbWatch Server in order for the changes to take effect.

Debugging

If you are experiencing issues when using the extension, it is possible to enable more logging by setting a tag in the configuration file manually.

The configuration file can be found in the “[dbWatch Server]/server/extensions/edited_configurations” catalog and is called “E-Mail extension.xml”.

Open the file in a text editor, there should be a tag called “debug-level” with the value 0. You can change this to 1 (some logging) or 2 (a lot of logging). Doing this makes it easier to track down configuration errors as the server.log file will tell you what is going on when it is attempting to send messages. You have to restart the dbWatch Server in order for the changes to take effect.

← Extensions / Configuration for different Mail service →

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment