Skip to content

Alarms ​

APIO core can send alarms reports with emails.

The alarm engine collects internal events (trigger requests) produced by the HTTP server, the gateways sessions and background monitors, and keeps an active alarm in the database for each issue. Each occurrence increments the alarm counter (value), and when the counter crosses a configured threshold the alarm level escalates (info → major → critical) and a notification is sent with the configured handler.

Configuration ​

The alarms are configured in the alarms section.

PropertyDescription
system_clearWhen enabled, the system clears the alarm automatically if the issue is resolved (see below).
thresholdsList of thresholds defining the alarm levels. Each threshold has a level (info, major, critical), a threshold (counter value from which the level applies) and an optional list of handlers.
default_handlerHandler used to emit notifications when an alarm level changes. The supported handler type is email, which requires a distribution (name of a distribution list) and a template (email template). The SMTP settings must be configured (see SMTP).

Thresholds are evaluated in ascending order against the alarm counter: the level applied is the one with the highest threshold lower than or equal to the current number of occurrences. An alarm definition is active only if at least one threshold with a level and a value is defined.

Alarm lifecycle ​

  • when a failing event occurs, an alarm is created (or updated) with:
    • value: number of occurrences
    • first_occurrence / last_occurrence: timestamps of the first and latest event
    • level: the level derived from the thresholds
    • message: description of the last event
    • active: true
  • each new occurrence increments the counter and refreshes the message and the last occurrence
  • when the counter reaches a new threshold, the level escalates and the default handler is invoked
  • alarms can be cleared manually via API (PUT /alarms/{id}) or automatically when the system clear is enabled

Support system clear ​

The support system clear alarm is a flag to indicate that the system can clear the alarm automatically if the issue is resolved.

When enabled for an alarm definition, each successful event (e.g. a response with a status code lower than 500 or a working replication check) deactivates the currently active alarm with the same key. When disabled, the alarm must be cleared manually.

Northbound errors ​

HTTP status returned greater or equal to 500 are counted as northbound errors.

The alarm is raised by the API server itself: every request handled by the HTTP server generates a trigger with the returned status code and the request details (METHOD /uri) as info. There is one single alarm for the whole northbound interface (the alarm key is http_success_rate).

Southbound HTTP errors ​

HTTP status received greater or equal to 500 are counted as southbound HTTP errors.

Every response received from a downstream system (gateway) generates a trigger with the returned status code. The alarms are counted per target: the alarm key is http_south_success_rate{target="..."} with the name of the gateway / client session, and the message reports the target and the last status code received.

Network issues ​

Network issues includes timeouts, DNS errors, connection errors, etc. And they are counted per gateway (client session).

Every southbound request generates a network trigger: on failure the error description is stored in the alarm message, on success (when the system clear is enabled) the active alarm is automatically cleared. If a status code was received before the failure, it is included in the message as additional info. The alarm key is network_issues{target="..."} with the name of the gateway.

Db replication issue ​

This alarm is triggered when db replication is not working.

A background monitor checks the PostgreSQL replication status (pg_stat_replication) every 60 seconds: if no replica is attached to the master, a db_replication_issue trigger is raised. When at least one replica is connected again, the trigger reports a success and the alarm is cleared (if the system clear is enabled).

INFO

For Lab deployments where the DB is not replicated, the default thresholds can be set to 0 to disable it.

Alarms API ​

The alarms are exposed with the following endpoints:

MethodEndpointDescription
GET/alarmsSearch the alarms history. Supports filter (key, level, active, first/last occurrence), sort and pagination (default limit 50, default sort by last occurrence descending).
GET/alarms/keysList the distinct alarm keys.
PUT/alarms/{id}Clear (deactivate) an alarm.

Retention ​

The alarms are removed from the database by the cleanup process using the default retention period (see Cleanup).