APE Watchtower – The Alarm System for Oracle APEX Applications

Monday, April 24, 2023

Introduction

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

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.

Scanners


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. 


Graphical user interface, applicationDescription automatically generated


The sensor/day matrix is a comprehensive overview by sensor and time to keep a great overview of what is going on in your house ... Sorry, I meant applications 😊

 

ChartDescription automatically generated

What to monitor?


Well, you can monitor anything that is running or accessible through your Oracle Database. 


By using the APEX activity logs, you can:

  • Monitor sudden performance drops in your APEX pages
  • Identify break-in attempts.
  • Identify bots crawling through your public pages
  • Spot new kinds of errors after delivering changes to production.


Use the database dictionary views to:

  • Identify any sudden increases or decreases in table sizes
  • Prevent tablespaces from running out of memory
  • Identify deadlocks
  • Check how your scheduler jobs are performing


Keep an eye on your external services by:

  • Pinging REST endpoints to see if they are all up and running and your authentication credentials are in good shape
  • Validate logs of your integrations for errors or abnormalities.
  • Measure the average time it takes to request and receive data from an external source


Don’t limit yourself to technical parameters - use Watchtower also for your processes:

  • Is a process hanging and waiting for final actions (i.e., pending approval)
  • Are your algorithms generating the expected results
  • Are your general ledger accounts balanced


As you can see, Watchtower is applicable in countless scenarios; you have to find the right inspiration. And to help you with that, APE ships a couple of sensors to get you started. After installing APE, check the dashboard and your APEX Inbox for the results:


Conclusion


The whole idea around APE Watchtower is to do the monitoring for you. You don’t have to scroll through different logs and charts trying to find some abnormalities in your solutions because Watchtower will bring them to your attention. Of course, you must set up all the sensors and finetune when and how they alert you, just like trying to position your motion detectors at home to cover the right angles so your dog does not trigger them.


After that, your alert system is armed, and you can focus on your everyday tasks.


Picture of Aleš Kravos

Aleš Kravos

COO @ The Right Thing Solutions

APEX Project Eye Lead Developer

Comments

No comments yet, be the first one to let us know what you think of this article!