DB2 Error Log

Monitoring the db2diag.log file is key to understanding when problems are occuring. Both warning and error message are written to this file, and a DPA custom alert can watch this file by using the SYSPROC.PD_GET_LOG_MSGS system function. The 2 main columns used in this alert are the MSG  (the error message) and MSGSEVERITY (W for Warning or E for Error) columns.

This custom alert turns any Warning messages into an alert value of 1 and Error message use a value of 2. This allows us to setup alert thresholds like this to distinguish the difference in these message severities:

Note: this alert uses the #FREQUENCY# placeholder so DPA will pass in the execution interval. This alert then uses that value in the WHERE clause of the query to only retrieve message that are newer than the last time the alert executed. If the execution interval is set to 10 minute, the value of 10 is passed in.