Monitoring Studio: Getting Automatically Notified by Email for an Error in a Log File

How to set up an email notification when a particular string is found in the output file of any application.

Related Topics

Objective

Under certain circumstances you may need get informed or to notify a party via email of an error in a log file. This article provides a step-by-step procedure on how to set up an email notification when a particular string is found in the output file of any application.

Solution

First, make sure that Monitoring Studio KM for PATROL is properly installed and running in your PATROL environment. Then, follow the instructions below:

This setup comprises three steps.

  1. Configuring the Monitoring Studio KM to perform File Monitoring and Analysis operation
  2. Configuring a String Search on the file
  3. Configuring an e-mail alert notification

File Monitoring and Analysis

  1. In the console, right click Monitoring Studio › KM Commands › New › File Monitoring and Analysis
  2. Select the option LOG file and click Next.
  3. Specify the file name and the parameters to be monitored and click Next.
  4. Provide a name to identify the object.
  5. Select the thresholds you wish to set. It is advisable to use the default thresholds.
  6. Click Finish to complete the monitoring setup.

Performing String Search

The string search has to be performed on the identifier on which you have configured File monitoring and analysis.

  1. Right click the object› KM Commands › New › String Search
  2. Provide the search criteria, that is the string to be matched and where to search. In this example, we chose to search for “ERROR” present “anywhere in the line”.
  3. Click Next.
  4. You can configure Monitoring Studio to automatically acknowledge alerts. The alerts can be acknowledged either by matching a string or by specifying a timeout. If you set an automatic acknowledgement, select the action to be performed when the specified condition is reached.
  5. Specify a display name and click Finish to create an object in the console to represent the String Search.

Email notification

  1. Right click the newly added String Search Object › KM Commands › Set Alert Actions.
  2. Select a parameter from the list for which you need to send an alert and click Next. In this example “LastMatchingLines” is being selected.
  3. Select the Send an E-mail option to trigger an e-mail notification and click Next.
  4. Provide the e-mail addresses, SMTP server name, subject and body and click Next.
  5. If you wish to include the values of parameters retrieved by the Monitoring Studio KM, you can include macros in the body section.These macros are replaced by the stored values while sending the email. In this example, the body of the email contains all the lines which match the search criteria. For a list of available macros, click here.
  6. Click Finish to complete setup.

Note: This article is based on the “LastMatchingLines” parameter and will trigger an email alert when it finds the matching string in the file provided as input (file on which “File Monitoring and Analysis” and “String Search” has been implemented).