APE Watchtower – The Alarm System for Oracle APEX Applications

Monday, April 24, 2023


Let me introduce you to APE Watchtower—the alarm system for your APEX Applications which will help you sleep better without worries. 

It’s like a smart home installation but for your IT solutions. Like installing motion detectors in your rooms, you set up APE Sensors that monitor your applications, database, external services, or even business processes. And if they detect something shady, Watchtower raises the alarms.


Sensors are configured in two steps. 

1. The sensor logic

The sensor logic is defined in the form of a SQL query which should return the current state of what you would like to monitor. The statement should have a “Key” column returning a unique identifier for each returned row and a “Value” column, returning a numerical recording.

Let’s take a very basic example – Monitoring the number of errors for each of your applications in the last 24 hours. This is what the SQL statement would look like:

The statement will return one row for each application that had any activity in the last 24 hours with the number of raised exceptions. We use the application ID for the key value, the number of errors as the recorded value, and the application name for attribute_01, which we can later use as a substitution string.

2. Escalation rules

The Sensors escalation rules define how the recorded value is interpreted and how Watchtower should react. This is done by defining recorded value ranges for the available severity levels:

By using the # syntax, you can use column substitution strings to dynamically build the messages that are communicated to you.

For each severity level, escalation channels are configured to control when and how abnormal behaviors are communicated. Watchtower comes with the prebuilt APE Inbox and APEX Email escalation channels. Still, you can easily configure your own by calling database procedures that send an SMS or raise your home security alarm by calling the right API. I might have exaggerated with the last one, but it’s technically possible 😊

The snooze option helps you control how often the escalation is triggered to prevent your mailbox from being spammed.


The sensor’s logic and escalation rules are not executed by themselves. They have to be attached to a scanner.  A scanner is a monitoring schedule using scheduler jobs similar to APEX Automations. It comes down to how up-to-date you want your recording to be. If you want alerts to go off as soon as possible, attach them to a very frequently running scanner.

For each scan, you can explore which sensors recorded readings, what was recorded, and if any escalation channels were triggered:

Watchtower dashboard

As all well-known smart home systems come with a central dashboard, it’s the same with Watchtower. 

The dashboard allows you two configure any number of traffic lights which represent the latest recorded value per sensor:

Trend charts display recorded values over a configurable timeline for a sensor. They are useful if sensors measure the time elapsed as an APEX request or Scheduler Job run.