Alerta PDF
Alerta PDF
Release 6.0
Nick Satterly
1 Demo Sites 3
1.1 Quickstart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Design Principles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 Server & API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.4 Alerta Web UI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.5 Alerta CLI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.6 Integrations & Plugins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.7 Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
1.8 Authorization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
1.9 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
1.10 Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
1.11 Customer Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
1.12 Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
1.13 Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
1.14 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
1.15 Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
1.16 API Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
1.17 API Query Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
1.18 Alert Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
1.19 Heartbeat Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
2 Contribute 103
3 Support 105
3.1 Frequently Asked Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
4 License 109
4.1 Releases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
4.2 About . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
i
ii
alerta Documentation, Release 6.0
The alerta monitoring system is a tool used to consolidate and de-duplicate alerts from multiple sources for quick
‘at-a-glance’ visualisation. With just one system you can monitor alerts from many other monitoring tools on a single
screen.
Alerta combines a JSON API server for receiving, processing and rendering alerts with a simple, yet effective Alerta
Web UI and command-line tool. There are numerous integrations with popular monitoring tools and it is easy to add
your own using the API directly, the Python SDK or the same command-line tool to send alerts. Access to the API
and command-line tool can be restricted using API keys and to the web console using Basic Auth or OAuth2 providers
Google, GitHub and GitLab.
Get started today!
Contents 1
alerta Documentation, Release 6.0
2 Contents
CHAPTER 1
Demo Sites
There are two public web consoles available for demonstration and testing:
• https://try.alerta.io (Google OAuth)
• https://alerta.herokuapp.com (BasicAuth)
The web consoles are powered by a single public API which can be used as a sandbox for integration testing:
• https://alerta-api.herokuapp.com
The “API Explorer” can be used to query for and send alerts to the public API server:
• https://explorer.alerta.io
The alerta command-line tool can also be used to generate alerts. The required API key is demo-key.
1.1 Quickstart
This is a quick-start guide that will get you running Alerta in under 5 minutes.
If apt-get can’t locate the “mongodb-org” metapackage package then follow these steps to add MongoDB package
repository to apt sources list.
For other operating systems, see the installation steps on the MongoDB web site.
3
alerta Documentation, Release 6.0
The alert should appear almost immediately in the console. If it doesn’t it’s either a CORS issues or a bug.
The following principles guided the design and development of the Alerta monitoring system.
A resource is any entity that it makes sense for you to receive alerts for. You shouldn’t be forced to accept a certain
“world view” when using a monitoring tool or to repurpose a “host” field for a service or application, or a even a URL.
Host-centric monitoring tools belong in the 90’s.
You are free to use as many or as few as you like eg. if you plan to only integrate with Nagios then only use critical,
warning and ok. If you are integrating with a fault management system for a telco you might want to use the six
ISO perceived severity levels or alternatively, if you are pushing application alerts you might want to consider using
the debug and trace severity levels.
In accordance with the robustness principle which is to “be liberal in what you accept from others”, alerta will accept
any alert as long as it meets the alert format specification. ie. no field values need to be defined in advance for it to be
accepted, however the benefits of following a standard convention for such attributes as environment, service,
event and resource (as internally defined by and useful to you) are many.
All alerts should have a corresponding cleared or normal state so that non-normal alerts can be automatically
cleared down by the system. Where an alert cannot send a corresponding clear an alert should specify a timeout (or
have a default assigned) after which it will be deleted.
Alerts should be resent at regular intervals if they are still active which means that if all data is lost after a certain
amount of time (eg. 2 hours?) you are back to where you were. This will be generally true though, for some alert
sources this isn’t possible eg. SNMP traps, log errors. Alerts in a normal state can be resent at a longer interval.
Dynamic ‘scale up’/’scale down’ environments are the defacto standard now; naming individual servers is lame. Use
service discovery and dynamically generated metadata to tag alerts and assign custom attributes on the fly.
The Alerta API receives alerts from multiple sources, correlates, de-duplicates or suppresses them, and makes the
alerts available via a RESTful JSON API.
Alerts can be intercepted as they are received to modify, enhance or reject them using pre-receive hooks. Alerts can
also be used to trigger actions in other systems after the alert has been processed using post-receive hooks or following
an operator action or alert status change for bi-directional integration.
There are several integrations with popular monitoring tools available and webhooks can be used to trivially integrate
with AWS Prometheus, Grafana, PagerDuty and many more.
Alerta comes out-of-the-box with key features designed to reduce the burden of alert management. When an event is
received it it is processed in the following way:
1. all plugin pre-receive hooks are run in listed order, an alert is immediately rejected if any plugins return a
RejectException or RateLimit exception
2. alert is checked against any active blackout periods, alert suppressed if any match
3. alert is checked if duplicate, if so duplicate count is increased and repeat set to True
4. alert is checked if correlated, if so change severity and/or status etc
5. if alert is neither a duplicate or correlated then create new alert
6. all plugin post-receive hooks are run in listed order
7. any tags or attributes changed in post-receive hooks are persisted
Each of the above actions are explained in more detail in the following sections.
1.3.2 Plugins
Plugins are small python scripts that can run either before or after an alert is saved to the database, or before an operator
action or status change update. This is achieved by registering pre-receive hooks for transformers, post-receive hooks
for external notification and status change hooks for bi-directional integration.
Transformers
Using pre-receive hooks, plugins provide the ability to transform raw alert data from sources before alerts are created.
For example, alerts can be normalised to ensure they all have specific attributes or tags or only have a specific value
from a range of allowed values. This is demonstrated in the reject plugin that enforces an alert policy.
Plugins can also be used to enhance alerts – like the Geo location plugin which adds location data to alerts based on the
remote IP address of the client, or the generic enhance plugin which adds a customer attribute based on information
contained in the alert.
External Notification
Using post-receive hooks, plugin integrations can be used to provide downstream systems with alerts in realtime for ex-
ternal notification. For example, pushing alerts onto an AWS SNS topic, AMQP queue, logging to a Logstash/Kibana
stack, or sending notifications to HipChat, Slack or Twilio and many more.
Operator Actions
Actions taken against alerts can be used as triggers for further integrations with external systems.
TBC
Bi-directional Integration
Using status change hooks, plugins can be used to complete a two way integration with an external system. That is, an
external system like Prometheus Alertmanager that generates alerts that are forwarded to Alerta can be updated when
the status of an alert changes in Alerta.
For example, if an operator “acknowledges” a Prometheus alert in the Alerta web UI then a status change hook could
silence the corresponding alert in Alertmanager. This requires that external systems provide enough information in
the alert created in Alerta for that alert to be uniquely identified at a later date.
More information about bi-directional integration and real-world examples for Telegram, Zabbix, Prometheus and
many others can be found on the Integrations & Plugins page.
An alert that is received during a blackout period is suppressed. That is, it is received by Alerta and a 202 Accepted
status code is returned however this means that even though the alert has been accepted, it won’t be processed.
Alerta defines many different alert attributes that can be used to group alerts and it is these attributes that can be used to
define blackout rules. For example, to suppress alerts from an entire environment, service or group, or a combination
of these. However, it is possible to define blackout rules based only on resource and event attributes for situations that
require that level of granularity.
Tags can also be used to define a blackout rule which should allow a lot of flexibility because tags can be added at
source, using the alerta CLI, or using a plugin. Note that one or more tags can be required to match an alert for the
suppression to apply.
In summary, blackout rules can be any of:
• an entire environment eg. environment=Production
• a particular resource eg. resource=host55
• an entire service eg. service=Web
• every occurrence of a specific event eg. event=DiskFull
• a group of events eg. group=Syslog
• a specific event for a resource eg. resource=host55 and event=DiskFull
• all events that have a specific set of tags eg. tags=[ blackout, london ]
Note that an environment is always required to be defined for a blackout rule.
1.3.4 De-Duplication
When an alert with the same environment-resource-event combination is received with the same severity,
the alert is de-duplicated.
This means that information from the de-duplicated alert is used to update key attributes of the existing alert (like
duplicateCount, repeat flag, value, text and lastReceiveTime) and the new alert is not shown.
Alerts are sorted in the Alerta web UI by lastReceiveTime by default so that the most recent alerts will be
displayed at the top regardless of whether they were new alerts or de-duplicated alerts.
Alerta implements what we call “simple correlation” – as opposed to complex correlation which is much more in-
volved. Simple correlation, in combination with de-duplication, provides straight-forward and effective ways to reduce
the burden of managing an alert console.
With Alerta, there are two ways alerts can be correlated, namely:
1. When an alert with the same environment-resource-event combination is received with a different
severity, then the alert is correlated.
2. When a alert with the same environment-resource combination is received with an event in the
correlate list of related events with any severity, then the alert is correlated.
In both cases, this means that information from the correlated alert is used to update key attributes of the existing alert
(like severity, event, value, text and lastReceiveTime) and the new alert is not shown.
Alerta is called state-based because it will automatically change the alert status based on the current and previous
severity of alerts and subsequent user actions.
The Alerta API will:
• only show the most recent state of any alert
• change the status of an alert to closed if a normal, ok or cleared is received
• change the status of a closed alert to open if the event reoccurs
• change the status of an acknowledged alert to open if the new severity is higher than the current severity
• update the severity and other key attributes of an alert when a more recent alert is received (see correlation
and deduplication)
• update the trendIndication attribute based on previousSeverity and current severity with either
moreSevere, lessSevere or noChange
• update the history log following a severity or status change (see alert history)
All of these automatic actions combine to ensure that important alerts are given the priority they deserve.
Note: To take full advantage of the state-based browser it is recommended to implement the timeout of expired
alerts using the House Keeping script.
Whenever an alert status or severity changes, that change is recorded in the alert history log. This is to allow operations
staff follow the lifecycle of a particular alert, if necessary.
The alert history is visible in the Alert Details page of any alert and also by using the alerta command-line tool
history sub-command.
For example, it will show whether an alert status change happened as a result of operator (external) action or an
automatic correlation (auto) action.
1.3.8 Heartbeats
An Alerta heartbeat is a periodic HTTP request sent to the Alerta API to indicate normal operation of the origin of the
heartbeat.
They can be used to ensure components of the Alerta monitoring system are operating normally or sent from any other
source. As well as an origin they include a timeout in seconds (after which they will be considered stale), and
optional tags.
They are visible in the Alerta console (About page) and via the alerta command-line tool using the heartbeat
sub-command to send them, and the heartbeats sub-command to view them.
Alerts can be generated from stale or slow heartbeats using alerta heartbeats --alert. For more informa-
tion about generating alerts from heartbeats see the heartbeats command reference.
The Alerta web UI console takes full advantage of the state-based Alerta API to ensure that the most important events
at any given time are brought to the attention of operators.
1.4.1 Configuration
To configure the Alerta web UI modify “in place” the default config.json file that is supplied with the web
application. It uses simple JSON syntax.
Deprecated since version 6.0: The Alerta web UI previously used an AngularJS configuration block for configuration
settings which has now been deprecated.
The three main areas for configuration are:
• defining the Alerta API endpoint
• enforcing a use authentication strategy
• selecting colors for severity, highlighting, text and sound
The default web UI config.json configuration file is included below. It assumes that the Alerta API is running on
the same host (but different port) that the web UI static html files are being served from (line 2):
1 {
2 "endpoint": "http://localhost:8080"
3 }
Starting from version 6.0, client configuration is supplied by the API server. This includes configuration for the web
UI and the command-line tool.
Configuration settings are made on the API server and when the web UI console is bootstrapping it reads the endpoint
setting and downloads the rest of the configuration.
The remote configuration from the API server is merged with the local configuration settings to provide the final
configuration used by clients.
Example
The following API server settings generate the JSON client configuration shown below that.
1 AUTH_PROVIDER = 'google'
2 AUTH_REQUIRED = True
3 CUSTOMER_VIEWS = True
4 GOOGLE_TRACKING_ID = 'UA-44644195-5'
5 OAUTH2_CLIENT_ID = '736147134702-glkb1pesv716j1utg4llg7c3rr7nnhli.apps.
˓→googleusercontent.com'
6 OAUTH2_CLIENT_SECRET = 'secret'
1 {
2 "audio": {},
3 "auth_required": true,
4 "client_id": "736147134702-glkb1pesv716j1utg4llg7c3rr7nnhli.apps.googleusercontent.
˓→com",
5 "colors": {},
6 "customer_views": true,
7 "dates": {
8 "longDate": "EEEE, MMMM d, yyyy h:mm:ss.sss a (Z)",
9 "mediumDate": "medium",
10 "shortTime": "shortTime"
11 },
12 "endpoint": "https://alerta-api.herokuapp.com",
13 "github_url": null,
14 "gitlab_url": "https://gitlab.com",
15 "keycloak_realm": null,
16 "keycloak_url": null,
17 "pingfederate_url": null,
18 "provider": "google",
19 "refresh_interval": 5000,
20 "severity": {
21 "cleared": 5,
22 "critical": 1,
23 "debug": 7,
24 "indeterminate": 5,
25 "informational": 6,
26 "major": 2,
27 "minor": 3,
28 "normal": 5,
29 "ok": 5,
30 "security": 0,
31 "trace": 8,
32 "unknown": 9,
33 "warning": 4
34 },
35 "signup_enabled": true,
36 "tracking_id": "UA-44644195-5"
37 }
Note: For completeness, the OAUTH2_CLIENT_ID and OAUTH2_CLIENT_SECRET configuration settings are
included in the example above however it should be noted that only the client id is sent to the client (line 4) as sending
the client secret is not necessary and would compromise security.
Client Settings
Full list of API server settings that can be used to configure clients.
AUTH_REQUIRED
CUSTOMER_VIEWS
AUTH_PROVIDER
SIGNUP_ENABLED
OAUTH2_CLIENT_ID
GITHUB_URL
GITLAB_URL
KEYCLOAK_URL
KEYCLOAK_REALM
PINGFEDERATE_URL
COLOR_MAP
SEVERITY_MAP
GOOGLE_TRACKING_ID
AUTO_REFRESH_INTERVAL
alerta is the unified command-line tool, terminal GUI and Python SDK for the alerta monitoring system.
It can be used to send and query alerts, tag alerts and change alert status, delete alerts, dump alert history or see the
raw alert data. It can also be used to send heartbeats to the alerta server, and generate alerts based on missing or slow
heartbeats.
1.5.1 Installation
1.5.2 Configuration
Options can be set in a configuration file, as environment variables or on the command line. Profiles can be used to
easily switch between different configuration settings.
Note: The profile option can only be set in the [DEFAULT] section.
Example
Configuration file ~/.alerta.conf:
[DEFAULT]
timezone = Australia/Sydney
output = json
[profile development]
endpoint = https://localhost:8443
key = demo-key
sslverify = off
timeout = 10.0
debug = yes
$ export ALERTA_CONF_FILE=~/.alerta.conf
$ export ALERTA_DEFAULT_PROFILE=production
$ alerta query
1.5.3 Precedence
Command-line configuration options have precedence over environment variables, which have precedence over the
configuration file. Within the configuration file, profile-specific sections have precedence over the [DEFAULT] sec-
tion.
1.5.4 Authentication
If the Alerta API enforces authentication, then the alerta command-line tool can be configured to present an API
key or login to the API before accessing secured endpoints.
API Keys
API keys can be generated in the web UI, or by an authenticated user using the alerta CLI, and should be added to
the configuration file as the “key” setting as shown in the following example:
[profile production]
endpoint = https://api.alerta.io
key = LMvzLsfJyGpSuLmaB9kp-8gCl4I3YZkV4i7IGb6S
OAuth Login
Alternatively, a user can “login” to the API and retrieve a Bearer token if the Alerta API is configured to use either
basic, github, gitlab or google as the authentication provider. No additional settings are required but before
running any commands the user must login first:
$ alerta login
1.5.5 Commands
The alerta tool is invoked by specifying a command using the following format:
• Alert Commands
– send - Send an alert
– query - Search for alerts
– ack - Acknowledge alerts
– close - Close alerts
– unack - Un-acknowledge alerts
– shelve - Shelve alerts
– unshelve - Un-shelve alerts
– tag - Tag alerts
– untag - Untag alerts
– update - Update alert attributes
– delete - Delete alerts
Alert Commands
The following group of commands are related to sending, querying and managing the status of alerts.
Send an alert.
Options:
-r, --resource RESOURCE Resource under alarm
-e, --event EVENT Event name
-E, --environment ENVIRONMENT Environment eg. Production, Development
-s, --severity SEVERITY Severity eg. critical, major, minor, warning
-C, --correlate EVENT List of related events eg. node_up, node_down
-S, --service SERVICE List of affected services eg. app name, Web,
Network, Storage, Database, Security
-g, --group GROUP Group event by type eg. OS, Performance
-v, --value VALUE Event value
-t, --text DESCRIPTION Description of alert
-T, --tag TAG List of tags eg. London, os:linux, AWS/EC2
-A, --attributes KEY=VALUE List of attributes eg. priority=high
-O, --origin ORIGIN Origin of alert in form app/host
--type EVENT_TYPE Event type eg. exceptionAlert,
performanceAlert, nagiosAlert
--timeout SECONDS Seconds before an open alert will be expired
--raw-data STRING Raw data of orignal alert eg. SNMP trap PDU.
'@' to read from file, '-' to read from stdin
--customer STRING Customer
-h, --help Show this message and exit.
The only mandatory options are resource and event. All the others will be set to sensible defaults.
Attention: If the reject plugin is enabled (which it is by default) then alerts must have an environment
attribute that is one of either Production or Development and it must define a service attribute. For more
information on configuring or disabling this plugin see Plugin Settings.
Attribute Default
environment empty string
severity normal
correlate empty list
status unknown
service empty list
group Misc
value n/a
text empty string
tags empty list
attributes empty dictionary
origin program/host
type exceptionAlert
timeout 86400 (1 day)
raw data empty string
Examples
To send a minor alert followed by a normal alert that correlates:
$ alerta send --resource web01 --event HttpError --correlate HttpOK --group Web --
˓→severity minor
$ alerta send --resource web01 --event HttpOK --correlate HttpError --group Web --
˓→severity normal
Shelve alerts ie. change alert status to shelved which removes the alerts from the active console and prevents
any further notifications.
Unshelve alerts ie. change alert status to open which returns the alerts to the active console and does not prevent
future notifications.
Delete alerts.
Blackout Commands
The following group of commands are related to creating and managing alert suppressions using blackouts.
Heartbeat Commands
The following group of commands are related to creating and managing heartbeats.
Options:
-O, --origin ORIGIN Origin of heartbeat.
-T, --tag TAG List of tags eg. London, os:linux, AWS/EC2
--timeout SECONDS Seconds before heartbeat is stale
--customer STRING Customer
-D, --delete ID Delete hearbeat using ID
-h, --help Show this message and exit.
Options:
--alert Alert on stale or slow heartbeats
-s, --severity SEVERITY Severity for stale heartbeat alerts
--timeout SECONDS Seconds before a stale heartbeat alert will be expired
--purge Delete all stale heartbeats
-h, --help Show this message and exit.
Alerts can be generated from stale or slow heartbeats using the --alert option. It is expected that this would be run
at regular intervals using a scheduling service such as cron.
Tags can be used to set the environment or group of a heartbeat alert using the format environment:[ENV]
and group:[GRP]. These tags will be visible in the heartbeat but removed as tags from the alert.
Example
To send a major alert with an environment of Infra in the Network group when a heartbeat is missed or slow for
an origin called system1:
The following group of commands are related to creating and managing API keys.
Important: To prevent privilege escalation it is not possible to create an API key with associated roles that are greater
than that with which that API key has.
User Commands
The following group of commands are related to creating and managing users.
Permissions Commands
The following group of commands are related to creating and managing roles, permissions and access control.
Customer Commands
The following group of commands are related to creating and managing customers.
Auth Commands
Admin Commands
colors : {}
customer_views : True
dates : {'longDate': 'EEEE, MMMM d, yyyy h:mm:ss.sss a (Z)', 'mediumDate
˓→': 'medium', 'shortTime': 'shortTime'}
endpoint : https://alerta-api.herokuapp.com
github_url : None
gitlab_url : https://gitlab.com
(continues on next page)
signup_enabled : True
tracking_id : UA-44644195-5
$ alerta uptime
01:06 up 0 days 16:15
$ alerta version
alerta 6.0.0
alerta client 6.0.0
requests 2.19.1
click 7.0
Help Commands
1.5.6 Bugs
There are several different ways to integrate other alert sources into Alerta.
Firstly, existing integrations with well known monitoring tools like Nagios, Zabbix and Sensu make use of the Alerta
API and demonstrate how to build integrations with other monitoring tools.
Secondly, there are built-in webhooks for AWS Cloudwatch, Pingdom, PagerDuty, Google Stackdriver, Prometheus
Alertmanager and more which provide ‘out-of-the-box’ integrations for some of the most popular monitoring systems
available.
Thirdly, alert severity indicators or widgets can be placed on any web page using oEmbed for easy integration with
existing dashboards.
Lastly, plugins can be used to quickly and easily forward alerts to or notify other systems like Slack or Hipchat.
Contents
• Integrations
– Core
– Contrib
– External
– Bi-directional
• Webhooks
– AWS CloudWatch
– Grafana
– Graylog
– New Relic
– PagerDuty
– Pingdom
– Prometheus Alertmanager
– Riemann
– SeverDensity
– Slack
– Google Stackdriver
– Telegram
– Custom Webhooks
• Widgets
• Plugins
– Core
– Contrib
1.6.1 Integrations
Core
There are a few core integrations which have been developed to showcase how easy it is to get alerts or events from
other tools into Alerta. They are:
• Nagios Event Broker - forward host/service check results with suppression during downtime
• InfluxData Kapacitor - forward alerts for metric anomalies and dynamic thresholds
• Zabbix Alert Script - forward problems, acknowledged and OK events
• Sensu Plugin - forward sensu events
• Riemann Plugin - generate alerts from thresholds defined against metric streams
• Kibana Logging - log alerts to Elasticsearch for historical visualisation of alert trends
Contrib
There are several more integrations available in the contrib repo which may be useful. They are:
• Amazon SQS - receive alerts from SQS that were sent using the SNS core plugin
• E-mail - send emails after a hold-time has expired (requires the AMQP message queue core plugin)
• Opsweekly - query Alerta to generate Opsweekly reports
• Pinger - generate ping alerts from list of network resources being pinged
• SNMP Trap - generate alerts from SNMPv1 and SNMPv2 sources
• Supervisor - trigger alerts and heartbeats based on process deamon events
• Syslog Forwarder - receive RFC 5424, RFC 3164 syslog and Cisco syslog messages
• URL monitor - trigger alerts from web service query responses
External
Some third-party monitoring tools have built-in support for Alerta. They are:
• elastalert - alerting on anomalies, spikes, or other patterns of interest from data in Elasticsearch
• netdata - a system for distributed real-time performance and health monitoring
• Tick Stack - designed to handle metrics and events using Telegraf, InfluxDB, Chronograf, and Kapacitor
Bi-directional
Bi-directional integration is where the system integrating with Alerta provides information that enables Alerta to link
back to the originating system, either via an external link or simply a hostname and reference ID.
There are several examples of this two-way integration and they mostly take advantage of the flexible nature of the the
tags and attributes alert attributes which can be used to keep track of the external reference.
Usage
In it’s simplest form, pass the URL of the external system that generated the alert in an attribute called externalUrl
(or similar):
Better still, surroud the URL with HTML markup to make the link clickable in the web UI:
Examples
The following is a list of integrations, webbhooks and plugins that highlight the use of bi-directional integration in
different ways.
• AWS Cloudwatch webhook - includes the SNS subscription confirmation link in the text of the alert
• Zabbix integration & plugin - TBC
• Grafana webhook - includes rule and image links in Grafana alert attributes if available
• NewRelic webhook - includes incident and runbook links in NewRelic alerts
• PagerDuty webhook - includes the incident URL in alert history text when status changes
• Prometheus webhook - includes external and generator URLs in the alert attributes
• Zabbix integration - includes moreInfo link back to Zabbix console event trigger page in alert attribute
1.6.2 Webhooks
Webhooks are a way of integrating with other systems by triggering HTTP callbacks to the Alerta server API when an
event occurs.
Built-in Webhooks
• AWS CloudWatch
• Grafana
• Graylog
• New Relic
• PagerDuty
• Pingdom
• Prometheus Alertmanager
• Riemann
• SeverDensity
• Slack
• Google Stackdriver
• Telegram
• Custom Webhooks
AWS CloudWatch
Alerta can be configured to receive AWS CloudWatch alarms by subscribing the Alerta API endpoint to an SNS topic.
For details on how to set this up see the Sending Amazon SNS Messages to HTTP/HTTPS Endpoints page and in the
Endpoint input box append /webhooks/cloudwatch to the Alerta API URL.
Example AWS CloudWatch Webhook URL
https://alerta.example.com/api/webhooks/cloudwatch
Grafana
Alerta can be configured to receive Grafana alerts by adding a webhook endpoint to the Notification Channels.
For details on how to set this up see Grafana webhook page and in the Endpoint URL input box append /webhooks/
grafana to the Alerta API URL.
Example Grafana Webhook URL
https://alerta.example.com/api/webhooks/grafana
The following parameters can be set in the url environment, event_type, group, origin, service, severity, timeout
Example Grafana Webhook URL with parameters
https://alerta.example.com/api/webhooks/grafana?api-key=xxx&environment=Production&service=
Graylog
TBC
New Relic
Alerta can be configured to receive New Relic incidents by adding a webhook endpoint to the Notification Channels.
For details on how to set this up see New Relic webhook page and in the Endpoint URL input box append /
webhooks/newrelic to the Alerta API URL.
Example New Relic Webhook URL
https://alerta.example.com/api/webhooks/newrelic
PagerDuty
Alerta can be configured to receive PagerDuty incident-based webhooks – any change to the status or
assigned_to_user of an incident will cause an outgoing message to be sent.
For details on how to set this up see the PagerDuty webhook page and where it requires the webhook URL append
/webhooks/pagerduty to the Alerta API URL.
Example PagerDuty Webhook URL
https://alerta.example.com/api/webhooks/pagerduty
Pingdom
Alerta can be configured to receive Pingdom URL check alerts by adding a webhook alerting endpoint that calls the
Alerta API.
For details on how to set this up see the Pingdom webhook page and in the webhook URL input box append /
webhooks/pingdom to the Alerta API URL.
Prometheus Alertmanager
Riemann
Alerta can be configured to receive Riemann events. The integration makes no assumptions about the format of the
Riemann events and consumes standard events. If events are decorated with additional metadata (eg. tags, environ-
ment, group, etc) then these will be used.
Example Riemann Webhook URL
https://alerta.example.com/api/webhooks/riemann
SeverDensity
Alerta can be configured to receive SeverDensity alerts by adding a webhook endpoint to the Notification Preferences.
For details on how to set this up see SeverDensity webhook page and in the Endpoint URL input box append /
webhooks/serverdensity to the Alerta API URL.
Example SeverDensity Webhook URL
https://alerta.example.com/api/webhooks/serverdensity
Slack
TBC
Google Stackdriver
Alerta can be configured to receive Google Stackdriver incidents by adding a webhook endpoint to the notifications
configuration.
For details on how to set this up see Stackdriver webhook page and in the ENDPOINT URL input box append /
webhooks/stackdriver to the Alerta API URL.
Example Stackdriver Webhook URL
https://alerta.example.com/api/webhooks/stackdriver
Telegram
Alerta can be configured to receive Telegram callback queries from the inline buttons in the Telegram Bot plugin.
For details on how to set this up see Telegram Bot page and for the TELEGRAM_WEBHOOK_URL setting append
/webhooks/telegram to the Alerta API URL.
Example Telegram Webhook URL
https://alerta.example.com/api/webhooks/telegram
Custom Webhooks
Custom webhooks are a simple but effective way of adding support for direct integration to any system via a webhook
without having to modify the core source code. They are written in python and are required to implement all methods
of a base class.
They are loaded into memory when the Alerta API starts up and dynamically add an API endpoint path to the list of
available webhooks.
To set this up follow the instructions for triggering a webhook in the system to be integrated with and for the webhook
URL append /webhooks/<webhook_name> to to the Alerta API URL but replace <webhook_name> with the
name of the of the system.
Next, write the webhook python code. For more information on how to write the python code see the webhook
examples in the contrib repo or follow the tutorial.
Example Custom Webhook URL for Sentry
https://alerta.example.com/api/webhooks/sentry
Code for the webhook can be found in the contrib repo Sentry webhook directory.
1.6.3 Widgets
Add an alert severity indicator (aka. widget) to any dashboard using the Oembed API endpoint. The severity indicator
is coloured with the maximum severity for that alert query filter and has a count for the total number of matching alerts
for each severity.
Multiple severity indicators can be placed on the same page each for a different environment, service or group. See
the example oembed web page.
1.6.4 Plugins
Plugin extensions are an easy way of adding new features to Alerta that meet a specific end-user requirement.
Core
Contrib
More than two dozen contributed plugins are made available for popular tools. Some of the most popular are:
• AMQP - publish alerts to an AMQP fanout topic after processing
• Cachet - create incidents for display on Cachet status page
• Enhance - add new information to an alert based on existing information
• GeoIP Location - use remote IP address to submitted alert to add location data
• HipChat - send alerts to HipChat room
• InfluxDB - send alerts to InfluxDB for graphing with Grafana
1.7 Authentication
By default, authentication is not enabled, however there are some features that are not available unless users login such
as watching alerts.
Alerta supports three authentication mechanisms for the web UI and alerta command-line tool.
• Basic Auth
• Basic Auth using LDAP
• GitHub OAuth2
• GitLab OAuth2
• Google OAuth2
• Keycloak OAuth2
• SAML 2.0
• API Keys
To enforce authentication set AUTH_REQUIRED to True and set the SECRET_KEY to some random string in the
alertad.conf server configuration settings file:
AUTH_REQUIRED = True
SECRET_KEY = 'UszE5hI_hx5pXKcsCP_2&1DIs&9_Ve*k'
Note: Ensure that the SECRET_KEY that is used to encode tokens and API keys is a unique, randomly generated
sequence of ASCII characters. The following command generates a suitable 32-character random string on Mac or
Linux:
The most straight-forward authentication strategy to implement of the three is HTTP Basic Authentication provided
by the Alerta API because there is no additional configuration required of the Alerta server to use it other than setting
AUTH_REQUIRED to True.
Note: HTTP Basic Auth does not provide any encryption of the username or password so it is strongly advised to
only use Basic Auth over HTTPS.
LDAP can be used as the Basic Auth provider to authenticate users if desired. It requires the installation of an
additional Python package called “python-ldap” and can be installed like so:
$ pip install python-ldap
Important: If the Alerta API is installed in a Python virtual environment ensure that the python-ldap package is
installed into the same environment otherwise it won’t be auto-detected.
The configuration settings for LDAP authentication include the LDAP server URL and a map of LDAP domains to
search filters which means that multiple LDAP domains can be supported:
LDAP_URL = 'ldap://localhost:389' # replace with your LDAP server
LDAP_DOMAINS = {
'my-domain.com': 'uid=%s,ou=users,dc=my-domain,dc=com'
}
A typical user called user1, for the example above, would login using an email address of user1@my-domain.
com even if that email address doesn’t actually exist.
All users are initially assigned the “user” role by default.
Note: User sign-up, email verfication and password reset through the Alerta web UI or CLI is not supported. Self-
service user management needs to be handled by the LDAP authentication provider.
OAuth authentication is provided by Google OpenID Connect, GitHub, GitLab OAuth 2.0 or Keycloak OAuth 2.0 and
configuration is more involved than the Basic Auth setup.
Note: If Alerta is deployed to a publicly accessible web server it is important to configure the OAuth2 settings
correctly to ensure that only authorised users can access and modify your alerts.
Ensure AUTH_REQUIRED and SECRET_KEY are set and that the AUTH_PROVIDER setting is
Then follow the steps below for the chosen OAuth provider to create an OAuth client ID and client secret. The client
ID and client secret will need to be added to the alertad.conf file for the Alerta server.
1.7. Authentication 31
alerta Documentation, Release 6.0
Google OAuth2
To use Google as the OAuth2 provider for Alerta, login to the Google Developer Console and create a new project for
alerta.
• Project Name: alerta
• Project ID: (automatically assigned)
Next go to APIs & Services and select Credentials from the sidebar menu. Click Create credentials and choose
“OAuth client ID” and “Web Application” for application type.
• Name: Alerta
• Authorized Javscript Origins: http://alerta.example.com
• Authorized Redirect URIs: http://alerta.example.com
Click Create and take note of the Client ID and Client Secret. Use this information to configure the settings for
alerta server.
Example
AUTH_PROVIDER = 'google'
OAUTH2_CLIENT_ID = '379647311730-sj130ru952o3o7ig8u0ts8np2ojivr8d.apps.
˓→googleusercontent.com'
OAUTH2_CLIENT_SECRET = '8HrqJhbrYn9oDtaJqExample'
Warning: It is no longer necessary to enable Google+ API to use Google OAuth. Google+ API will be shutdown
on March 7, 2019 and Alerta installations configured to use Google+ API will cease to function after that date.
Note: ALLOWED_EMAIL_DOMAINS can be an asterisk (*) to force login but not restrict who can login.
GitHub OAuth2
To use GitHub as the OAuth2 provider for Alerta, login to GitHub and go to Settings -> Applications -> Register New
Application.
• Application Name: Alerta
• Homepage URL: http://alerta.io
• Application description (optional): Guardian Alerta monitoring system
• Authorization callback URL: http://alerta.example.com
Note: The Authorization callback URL is the most important setting and it is nothing more than the URL domain (ie.
without any path) where the alerta Web UI is being hosted.
Click Register Application and take note of the Client ID and Client Secret. Then configuration settings for alerta
server are as follows:
AUTH_PROVIDER = 'github'
OAUTH2_CLIENT_ID = 'f7b0c15e2b722e0e38f4'
OAUTH2_CLIENT_SECRET = '7aa9094369b72937910badab0424dc7393x8mpl3'
To restrict access to users who are members of particular GitHub organisations use:
Note: ALLOWED_GITHUB_ORGS can be an asterisk (*) to force login but not restrict who can login.
Important: To revoke access of your instance of alerta to your GitHub user info at any time go to Settings ->
Applications -> Authorized applications, find alerta in the list of applications and click the Revoke button.
GitLab OAuth2
To use GitLab as the OAuth2 provider for Alerta, login to GitLab and go to Profile Settings -> Applications -> New
Application.
• Name: Alerta
• Callback URL: http://alerta.example.com
• Scopes: openid
1.7. Authentication 33
alerta Documentation, Release 6.0
Note: The Callback URL is the most important setting and it is nothing more than the URL domain (ie. without any
Click Submit and take note of the Application ID and Secret. Then configuration settings for alerta server are as
follows (replacing the values shown below with the values generated by GitLab):
AUTH_PROVIDER = 'gitlab'
GITLAB_URL = 'https://gitlab.com' # or your own GitLab server
OAUTH2_CLIENT_ID = 'd31e9caa131f72901b16d22289c824f423bd5cbf187a11245f402e8b2707d591'
OAUTH2_CLIENT_SECRET =
˓→'42f1de369ec706996cadda234986779eeb65c0201a6f286b9751b1f845d62c8a'
To restrict access to users who are members of particular GitLab groups use:
Note: ALLOWED_GITLAB_GROUPS can be an asterisk (*) to force login but not restrict who can login.
Important: To revoke access of your instance of alerta to your GitLab user info at any time go to Profile Settings ->
Applications -> Authorized appliations, find alerta in the list of applications and click the Revoke button.
Keycloak OAuth2
To use Keycloak as the OAuth2 provider for Alerta, login to Keycloak admin interface, select the realm and go to
Clients -> Create.
• Client ID: alerta-ui
• Client protocol: openid-connect
• Root URL: http://alerta.example.org
After the client is created, edit it and change the following properties:
• Access Type: confindential
Add the following mapper under the Mappers tab:
Now go to Installation and generate it by selecting ‘Keycloak OIDC JSON’. You should get something like this:
{
"realm": "master",
"auth-server-url": "https://keycloak.example.org/auth",
"ssl-required": "external",
"resource": "alerta-ui",
"credentials": {
"secret": "418bbf31-aef-33d1-a471-322a60276879"
},
(continues on next page)
1.7. Authentication 35
alerta Documentation, Release 6.0
Take note of the realm, resource and secret. Then configuration settings for alerta server are as follows (replacing
the values shown below with the values generated by Keycloak):
AUTH_PROVIDER = 'keycloak'
KEYCLOAK_URL = 'https://keycloak.example.org'
KEYCLOAK_REALM = 'master'
OAUTH2_CLIENT_ID = 'alerta-ui'
OAUTH2_CLIENT_SECRET = '418bbf31-aef-33d1-a471-322a60276879'
To restrict access to users who are associated with a particular Keycloak role use:
Note: ALLOWED_KEYCLOAK_ROLES can be an asterisk (*) to force login but not restrict who can login.
To use SAML as the authentication provider for Alerta, install PySAML2 on the Alerta server and follow the config-
uration steps below.
$ openssl req -utf8 -new -x509 -days 3652 -nodes -out "alerta.cert" -keyout "alerta.
˓→key"
Configure pysaml2:
Bare-minimum config example:
AUTH_PROVIDER = 'saml2'
SAML2_CONFIG = {
'metadata': {
'local': ['/path/to/federationmetadata.xml']
},
'key_file': '/path/to/alerta.key',
'cert_file': '/path/to/alerta.cert'
}
metadata IdP metadata (refer to saml2 documentation for possible ways of specifying it)
key_file, cert_file path to aforementioned keys
Refer to pysaml2 documentation and source code if you need additional options:
• https://pysaml2.readthedocs.io/en/latest/howto/config.html
• https://github.com/rohe/pysaml2/blob/master/src/saml2/config.py
Note: entityid and service provider endpoints are configured by default based on your BASE_URL value which is
mandatory if you use SAML (see General Settings)
ALLOWED_SAML2_GROUPS
To restrict access to users who are members of particular group use:
Note: Ensure that pysaml2 authn response identity object contains groups attribute. You can do this by writing
proper attribute map which will convert your IdP-specific attribute name to groups.
Example:
MAP = {
...
'fro': {
...
'http://schemas.xmlsoap.org/claims/group': 'groups',
...
},
'to': {
...
'groups': 'http://schemas.xmlsoap.org/claims/group',
...
}
}
CORS_ORIGINS = [
...
'https://sso.example.com',
...
]
1.7. Authentication 37
alerta Documentation, Release 6.0
1.7.4 Cross-Origin
If the Alerta API is not being served from the same domain as the Alerta Web UI then the CORS_ORIGINS setting
needs to be updated to prevent modern browsers from blocking the cross-origin requests.
CORS_ORIGINS = [
'http://try.alerta.io',
'http://explorer.alerta.io',
'chrome-extension://jplkjnjaegjgacpfafdopnpnhmobhlaf',
'http://localhost'
]
If authentication is enforced, then an API key is needed to access the alerta API programatically. An API key can also
be to used by the alerta CLI for when the CLI is used in scripts. See the example CLI config for how to set the API
key for the command-line tool.
Keys can be easily generated from the Alerta web UI and can have any scopes associated with them. They are valid
for 1 year by default but this period is configurable using API_KEY_EXPIRE_DAYS in the server configuration.
To use an API key in an API query you must put the key in either an HTTP header or a query parameter.
Important: Using an HTTP header is the preferred method so that API keys are not exposed even when using HTTPS
or inadvertently captured in log files.
Google, GitHub, GitLab and Keycloak OAuth are used for user authentication, not user authorisation. Authentication
proves that you are who you say you are. Authorization says that you are allowed to access what you have requested.
To control who has access to Alerta you can restrict access to users with a certain email domain name by setting
ALLOWED_EMAIL_DOMAINS when using Google OAuth2, or who belong to a particular GitHub organisation by
setting ALLOWED_GITHUB_ORGS when using GitHub OAuth, or who belong to a particular GitLab group by set-
ting ALLOWED_GITLAB_GROUPS when using GitLab OAuth2. belong to a particular Keycloak role by setting
ALLOWED_KEYCLOAK_ROLES when using Keycloak OAuth2
For those situations where it is not possible to group users in this way it is possible to selectively allow access on a
per-user basis. How this is done depends on whether you are using Google, GitHub, GitLab or Keycloak as OAuth2
provider for user login.
Only allowing certain groups to login is very course. Fine-grained access control can be acheived by using user roles
and permissions.
RBAC is an authorisation model where users acquire permissions through roles. Default roles are “admin” and “user”.
You create roles relevant to your business functions and assign permissions as appropriate. For example, custom roles
can be created for jobs like “engineer”, “devops”, “sysadmin”, “dba” or access types like “read-only” and “read-write”.
For more information, see Role-Based Access Control.
1.8 Authorization
Authorization is used to limit access to Alerta API resources. The authorization model is based on Role-Based Access
Control (RBAC) which assigns permissions to functional roles and then users are assigned to one or more of those
roles.
This “role-based access” allows for fine-grained control over exactly what resources are accessible to which users and
exactly what type of access is allowed – in a way that is scalable.
For example, to create a new alert the sender will need to be assigned to at least one role with write:alerts
permissions. If the sender is not a member of a role with those permisssions then the request will be rejected with a
403 Forbidden response code.
Alerta implements the “flat” RBAC model as defined by NIST (aka. “Core RBAC”) and as such does not support any
form of role hierarchy where roles can inherit other roles.
Flat RBAC has the following features:
• users acquire permissions through roles
• must support many-to-many user-role assignment
• must support many-to-many permission-role assignment
• must support user-role assignment review
• users can use permissions of multiple roles simultaneously
Note: All access is through roles. Permissions can not be assigned directly to users. The only exception to this is the
ADMIN_USERS setting which overrides all other roles a user might belong to.
1.8.2 Configuration
There are two ways to configure role-based access; default and custom configuration.
1.8. Authorization 39
alerta Documentation, Release 6.0
Default Authorization
If authentication is enabled then the default authorization is used which defines two roles:
• user role - everyone is a “user” unless listed in the ADMIN_USERS setting. (default scopes are read and
write)
• admin role - only admins can delete alerts and heartbeats, create users etc. (default scope is simply admin,
however that implicitly includes read and write)
Note: The user and admin roles are protected preventing them from being deleted and preventing new roles
from being created with the same names. The scopes associated with the default user role are managed using the
USER_DEFAULT_SCOPES setting in the API server settings. All other roles are managed via the web console or
alerta CLI.
Custom Authorization
Tip: It is encouraged to employ the principle of least privilege when creating roles. That is, do not give to a user any
more privilege than is necessary to perform their job function.
Scope Permissions
read Grants read-only access to all scopes.
write Grants read/write access to all scopes.
admin Grants admin, read, write and delete access to all scopes.
read:alerts Read-only access to alerts.
write:alerts Grants read/write access to alerts.
admin:alerts Grants read/write to alerts for any customer.
read:blackouts Grants read-only access to blackouts.
write:blackouts Grants read/write access to blackouts.
admin:blackouts Grants read/write access to blackouts for any customer.
read:heartbeats Read-only access to heartbeats.
write:heartbeats Grants read/write access to heartbeats.
admin:heartbeats Grants read/write access to heartbeats for any customer.
write:users Grant write access to users.
admin:users Fully manage users.
read:perms Grants read-only access to permissions and scopes.
admin:perms Grants read, write and delete access to permissions.
read:customers Grants read-only access to customers.
admin:customers Fully manage customers.
read:keys List and view API keys.
write:keys Create, list and view API keys.
admin:keys Fully manage API keys for any customer.
write:webhooks Grants write access to webhooks.
read:oembed Grants read-only to oembed endpoints.
read:management Grants read-only access to management endpoints.
admin:management Fully manage management endpoints.
read:userinfo Grants read-only access to userinfo.
Note: write implicitly includes read, and admin implicitly includes read and write.
1.8. Authorization 41
alerta Documentation, Release 6.0
Audit events can be logged locally to the standard application log (which could also help with general debugging) or
forwarded to a HTTP endpoint using a POST.
Example Loggly configuration
The following example configuration can be used to log all admin, write and auth requests to the Flask application
log file and forward the events to the Loggly “logging-as-a-service” endpoint, replacing TOKEN in the Loggly URL
with your customer token.
1.9 Configuration
The following settings are configured on the Alerta server. For alerta CLI configuration options see command-line
reference and for Web UI configuration options see web UI reference.
The configuration file uses standard python syntax for setting variables. The default settings (defined in settings.
py) should not be modified directly.
To change any of these settings create a configuration file that overrides these default settings. The default location
for the server configuration file is /etc/alertad.conf however the location itself can be overridden by using a
environment variable ALERTA_SVR_CONF_FILE.
For example, to set the blackout period default duration to 1 day (ie. 86400 seconds):
$ export ALERTA_SVR_CONF_FILE=~/.alertad.conf
$ echo "BLACKOUT_DURATION = 86400" >$ALERTA_SVR_CONF_FILE
1.9. Configuration 43
alerta Documentation, Release 6.0
General Settings
Example
DEBUG = True
SECRET_KEY = 'changeme'
BASE_URL = '/api'
USE_PROXYFIX = False
LOG_HANDLERS = ['console', 'file']
LOG_FILE = '/var/log/alertad.log'
LOG_MAX_BYTES = 5*1024*1024 # 5 MB
LOG_BACKUP_COUNT = 2
LOG_FORMAT = 'verbose'
API Settings
Example
ALARM_MODEL='ALERTA'
DEFAULT_FIELD = 'text'
DEFAULT_PAGE_SIZE = 1000
HISTORY_LIMIT = 100
HISTORY_ON_VALUE_CHANGE = False # do not log if only value changes
Database Settings
DATABASE_NAME = 'monitoring'
DATABASE_NAME = 'monitoring'
DATABASE_RAISE_ON_ERROR = False # creating tables & indexes manually
The bulk API requires a Celery backend and can be used to off-load long-running tasks. (experimental)
Example Redis Task Queue
BULK_QUERY_LIMIT = 10000
CELERY_BROKER_URL='redis://localhost:6379/0'
CELERY_RESULT_BACKEND='redis://localhost:6379/0'
BULK_QUERY_LIMIT limit the number of tasks in a single bulk query (default is 100000)
CELERY_BROKER_URL URL of Celery-supported broker (no default)
CELERY_RESULT_BACKEND URL of Celery-supported result backend (no default)
Authentication Settings
If enabled, authentication provides additional benefits beyond just security, such as auditing, and features like the
ability to assign and watch alerts.
Example
AUTH_REQUIRED = True
AUTH_PROVIDER = 'basic'
ADMIN_USERS = ['[email protected]', '[email protected]']
USER_DEFAULT_SCOPES = ['read', 'write:alerts']
CUSTOMER_VIEWS = True
SIGNUP_ENABLED = False
(continues on next page)
1.9. Configuration 45
alerta Documentation, Release 6.0
LDAP_URL = 'ldap://openldap'
LDAP_DOMAINS = {
'my-domain.com': 'cn=%s,dc=my-domain,dc=com'
}
AUTH_REQUIRED users must authenticate when using web UI or command-line tool (default False)
AUTH_PROVIDER valid authentication providers are basic, github, gitlab, google, keycloak,
pingfederate, saml2 (default is basic)
ADMIN_USERS email addresses or logins that have admin role
USER_DEFAULT_SCOPES default permissions assigned to logged in users (default is ['read', 'write'])
CUSTOMER_VIEWS alert views partitioned by customer (default is False)
BASIC_AUTH_REALM BasicAuth authentication realm (default is Alerta)
SIGNUP_ENABLED prevent sign-up of new users via the web UI (default is True)
OAUTH2_CLIENT_ID client ID required by OAuth2 providers (no default)
OAUTH2_CLIENT_SECRET client secret required by OAuth2 providers (no default)
ALLOWED_EMAIL_DOMAINS authorised email domains when using email as login (default is *)
GITHUB_URL API URL for privately run GitHub Enterprise server when using GitHub as OAuth2 provider (no
default)
ALLOWED_GITHUB_ORGS authorised GitHub organisations a user must belong to when using Github as OAuth2
provider (default is *)
GITLAB_URL API URL for public or privately run GitLab server when using GitLab as OAuth2 provider (default is
https://gitlab.com)
ALLOWED_GITLAB_GROUPS authorised GitLab groups a user must belong to when using GitLab as OAuth2
provider (default is *)
LDAP_URL URL of the LDAP server (no default)
LDAP_DOMAINS dictionary of LDAP domains and LDAP search filters (no default)
PINGFEDERATE_URL PingFederate OpenID access token URL (no default)
PINGFEDERATE_PUBKEY_LOCATION PingFederate public key location (no default)
PINGFEDERATE_TOKEN_ALGORITHM PingFederate JWT token algorithm (no default)
PINGFEDERATE_OPENID_PAYLOAD_USERNAME PingFederate JWT user attribute name (no default)
PINGFEDERATE_OPENID_PAYLOAD_EMAIL PingFederate JWT email attribute name (no default)
PINGFEDERATE_OPENID_PAYLOAD_GROUP PingFederate JWT group attribute name (no default)
KEYCLOAK_URL Keycloak website URL when using Keycloak as OAuth2 provider (no default)
KEYCLOAK_REALM Keycloak realm when using Keycloak as OAuth2 provider (no default)
ALLOWED_KEYCLOAK_ROLES list of authorised Keycloak roles a user must belong to when using Keycloak as
OAuth2 provider (default is *)
SAML2_CONFIG pysaml2 configuration dict. See SAML 2.0 (no default)
ALLOWED_SAML2_GROUPS list of authorised groups a user must belong to. See SAML 2.0 for details (default is *)
SAML2_USER_NAME_FORMAT Python format string which will be rendered to user’s name using SAML attributes.
See SAML 2.0 (default is '{givenName} {surname}')
TOKEN_EXPIRE_DAYS number of days a bearer token is valid (default is 14)
API_KEY_EXPIRE_DAYS number of days an API key is valid (default is 365)
Audit events can be logged locally to the standard application log (which could also help with general debugging) or
forwarded to a HTTP endpoint using a POST.
Example
AUDIT_TRAIL audit trail for admin, write or auth changes. (default is ['admin'])
AUDIT_LOG enable audit logging to configured application log file (default is False)
AUDIT_URL forward audit logs to HTTP POST URL (no default)
CORS Settings
Example
CORS_ORIGINS = [
'http://localhost',
'http://localhost:8000',
r'https?://\w*\.?local\.alerta\.io:?\d*/?.*' # => http(s)://*.local.alerta.io:
˓→<port>
CORS_ORIGINS URL origins that can access the API for Cross-Origin Resource Sharing (CORS)
Severity Settings
The severities and their order are customisable to fit with the environment in which Alerta is deployed.
Example
SEVERITY_MAP = {
'critical': 1,
'warning': 4,
'indeterminate': 5,
'ok': 5,
'unknown': 9
}
DEFAULT_NORMAL_SEVERITY = 'ok' # 'normal', 'ok', 'cleared'
DEFAULT_PREVIOUS_SEVERITY = 'indeterminate'
COLOR_MAP = {
'severity': {
(continues on next page)
1.9. Configuration 47
alerta Documentation, Release 6.0
Timeout Settings
Alert timeouts are important for housekeeping and heartbeat timeouts are important for generating alerts from stale
heartbeats.
Example
Email Settings
If email verification is enabled then emails are sent to users when they sign up via BasicAuth. They must click on the
provided link to verify their email address before they can login.
Example
EMAIL_VERIFICATION = True
SMTP_HOST = 'smtp.example.com'
MAIL_FROM = '[email protected]'
SSL_CERT_FILE a PEM formatted certificate chain file for the SSL connection (no default)
MAIL_FROM valid email address from which emails are sent (no default)
SMTP_USERNAME application-specific username, if different to MAIL_FROM user (no default)
SMTP_PASSWORD application-specific password for MAIL_FROM or SMTP_USERNAME (no default)
Web UI Settings
The following settings are specific to the web UI and are not used by the server.
Example
SITE_LOGO_URL = 'http://pigment.github.io/fake-logos/logos/vector/color/fast-banana.
˓→svg'
DATE_FORMAT_SHORT_TIME = 'HH:mm'
DATE_FORMAT_MEDIUM_DATE = 'EEE d MMM HH:mm'
DATE_FORMAT_LONG_DATE = 'd/M/yyyy h:mm:ss.sss a'
DEFAULT_AUDIO_FILE = '/audio/Bike Horn.mp3'
COLUMNS = ['severity', 'status', 'lastReceiveTime', 'duplicateCount',
'customer', 'environment', 'service', 'resource', 'event', 'value', 'text']
SORT_LIST_BY = 'lastReceiveTime'
ACTIONS = ['createIssue', 'updateIssue']
GOOGLE_TRACKING_ID = 'UA-44644195-5'
AUTO_REFRESH_INTERVAL = 30000 # 30s
SITE_LOGO_URL URL of company logo to replace “alerta” in navigation bar (no default)
DATE_FORMAT_SHORT_TIME format used for time in columns eg. 09:24 (default is HH:mm)
DATE_FORMAT_MEDIUM_DATE format used for dates in columns eg. Tue 9 Oct 09:24 (default is EEE d
MMM HH:mm)
DATE_FORMAT_LONG_DATE format used for date and time in detail views eg. 9/10/2018 9:24:03.036 AM
(default is d/M/yyyy h:mm:ss.sss a)
DEFAULT_AUDIO_FILE make sound when new alert arrives. must exist on client at relative path eg. /audio/
Bike Horn.mp3 (no default)
COLUMNS user defined columns and column order for alert list view (default is standard web console column order)
SORT_LIST_BY to sort by newest use lastReceiveTime or oldest use -createTime. minus means reverse
(default is lastReceiveTime)
ACTIONS adds buttons to web console for operators to trigger custom actions against alert (no default)
GOOGLE_TRACKING_ID used by the web UI to send tracking data to Google Analytics (no default)
AUTO_REFRESH_INTERVAL interval in milliseconds at which the web UI refreshes alert list (default is 5000)
Plugin Settings
Plugins are used to extend the behaviour of the Alerta server without having to modify the core application. The only
plugins that are installed and enabled by default are the reject and blackout plugins. Other plugins are available
in the contrib repo.
Example
1.9. Configuration 49
alerta Documentation, Release 6.0
ORIGIN_BLACKLIST = ['foo/bar$', '.*/qux'] # reject all foo alerts from bar, and
˓→everything from qux
ORIGIN_BLACKLIST list of alert origins blacklisted from submitting alerts. useful for rouge alert sources (no
default)
ALLOWED_ENVIRONMENTS list of allowed environments. useful for enforcing discrete set of environments (default
is ['Production', 'Development'])
Note: To disable the reject plugin simply remove it from the list of enabled plugins in the PLUGINS configuration
setting to override the default.
Some configuration settings are special because they can be overridden by environment variables. This is to make
deployment to different platforms and managed environments such as Heroku, Kubernetes and AWS easier, or to
make use of managed Postgres or MongoDB services.
Note: Environment variables are read after configuration files so they will always override any other setting.
General Settings
Database Settings
DATABASE_URL used by both Postgres and MongoDB for database connection strings
DATABASE_NAME database name can be used to override default database defined in DATABASE_URL
MongoDB Settings
1.9. Configuration 51
alerta Documentation, Release 6.0
Using the management switchboard on the API some dynamic settings can be switched on and off without restarting
the Alerta server daemon.
Currently, there is only one setting that can be toggled in this way and it is the Auto-refresh allow switch.
Auto-Refresh Allow
The Alerta Web UI will automatically referesh the list of alerts in the alert console every 5 seconds.
If for whatever reason, the Alerta API is experiencing heavy load the auto_refresh_allow switch can be turned
off and the Web UI will respect that and switch to manual refresh mode. The Alerta web UI will start auto-refereshing
again if the auto_refresh_allow switch is turned back on.
1.10 Deployment
There are many ways to deploy Alerta. It can be run as alertad during development or testing but when run in a
production environment, it should always be deployed as a WSGI application. See the list of real world examples
below for different ways to run Alerta as a WSGI application.
Note: When deploying with Apache mod_wsgi, be aware that by default Apache strips the Authentication header.
This will cause you to receive “Missing authorization API Key or Bearer Token” errors. This can be fixed by setting
WSGIPassAuthorization On in the configuration file for the site.
Running the Alerta API behind a web proxy can greatly simplify the Web UI setup which means you can completely
avoid the potential for any cross-origin issues.
Also, if you run the API on an HTTPS/SSL endpoint then it can reduce the possibility of mixed content errors when a
web application hosted on a HTTP endpoint tries to access resources on an HTTPS endpoint.
Example API configuration (extract)
This example nginx server is configured to serve the web UI from the root / path and reverse-proxy API requests to
/api to the WSGI application running on port 8080:
server {
location /api/ {
proxy_pass http://backend/;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location / {
root /app;
}
}
upstream backend {
server localhost:8080 fail_timeout=0;
}
The server configuration file alertad.conf for this setup would need to set BASE_URL:
BASE_URL = '/api'
Additionally add the USE_PROXYFIX setting to fix relative links in HTTP responses if the web proxy is used for SSL
termination:
USE_PROXYFIX = True # use if proxy is terminating HTTPS traffic
And the web UI configuration file config.json would need the endpoint setting to match that:
{"endpoint": "/api"}
The Alerta web UI is just a directory of static assets that can be served from any location. An easy and cheap way to
serve the web UI is from an Amazon S3 bucket as a static website.
Note: Serving the Alerta web UI from a static web hosting site will not work unless that domain is listed in the
CORS_ORIGINS Alerta API server configuration settings.
Alerta supports several authentication mechanisms for both the API and the web UI and some key features of the web
UI, like watching alerts, are only available if authentication is enabled.
The API can be secured using API Keys and the web UI can be secured using Basic Auth or an OAuth provider from
either GitHub, GitLab, Google, Keycloak or SAML2.
If you plan to make the web UI accessible from a public URL it is strongly advised to enforce authentication and use
HTTPS/SSL connections to the Alerta API to protect private alert data.
1.10. Deployment 53
alerta Documentation, Release 6.0
1.10.6 Scalability
Alerta can scale horizontally, in the same way any other web application scales horizontally – a load balancer handles
the HTTP requests and distributes those requests between all available application servers.
Note: If using multiple API servers ensure the same SECRET_KEY is used across all servers otherwise there will be
problems with web UI user logins.
To achieve high system availability the Alerta API should be deployed to scale out horizontally and the database should
be deployed as a replica set, if using mongoDB or as master-slave, if using Postgres.
Deprecated since version 5.0: The housekeepingAlerts.js script that was used for housekeeping is deprecated.
Use the following instead.
There are some jobs that should be run periodically to keep the Alerta console clutter free. To timeout expired alerts
and delete old closed alerts you need to trigger housekeeping.
This can be done with the alerta command-line tool:
$ alerta housekeeping
This was not supported by earlier versions of the command-line tool and cURL has to be used to access /
management/housekeeping.
The API key needs an admin scope if AUTH_REQUIRED is set to True.
It is suggested that you run housekeeping at regular intervals via cron. Every minute or two is a suitable interval.
By default, the housekeeping job will remove any alerts that have been expired or closed for 2 hours and any info
messages that are 12 hours old. In some cases, these retention periods may be too long or too short for your needs.
Bear in mind that Alerta is intended to reflect the here and now, so long deletion thresholds should be avoided. Where
you do need to depart from the defaults, you can specify like this:
Heartbeats can be sent from any source to ensure that a system is ‘alive’. To generate alerts for stale heartbeats the
alerta command-line tool can be used:
Again, this should be run at regular intervals via cron or some other scheduler.
There are two management endpoints that provide internal application metrics.
The management endpoint /management/status can be used to keep track of realtime statistics on the perfor-
mance of the Alerta API like alert counts and average processing time. For convenience, these statistics can be viewed
in the About page of the Alerta web UI or using the alerta command-line tool status command.
The same metrics are also exposed at /management/metrics in the exposition format required by Prometheus so
that it can be monitored by Prometheus and other monitoring tools that implement the OpenMetrics standard.
Google analytics can be used to track usage of the Alerta web UI console. Just create a new tracking code with the
Google analytics console and add it to the alertad.conf API configuration file:
GOOGLE_TRACKING_ID = 'UA-NNNNNN-N'
Below are several different examples of how to run Alerta in production from a Debian vagrant box, an AWS EC2
instance, Heroku PaaS to a Docker container.
• Vagrant - deploy Alerta stand-alone or with Nagios, Zabbix, Riemann, Sensu or Kibana
• Heroku - deploy the Alerta API and the web ui to Heroku PaaS
• AWS EC2 - deploy Alerta to EC2 using AWS Cloudformation
• Docker - deploy Alerta to a docker container
• Docker Alpine - full Alerta installation (including Mongo) based on Alpine Linux
• Packer - deploy Alerta to EC2 using Amazon AMIs
• Flask deploy - deploy Alerta as a generic Flask app
• Ansible - deploy Alerta using ansible on Centos 7
• Terraform - single instance of alerta for quick demo on AWS
• Puppet - Alerta recipe on top of cfweb module
Multitenancy is acheived using Customer views that are a way of ensuring logged in users only see alerts that relate to
their organisation.
This is for Alerta deployments that are used to manage multiple customer sites.
1.11.1 Roles
The role of an API key is assumed to be “user” if it is a customer generated key. The role of admin
You can have a customer/user API key and an admin API key, but not a customer/admin API key – this makes no
sense.
A new top-level alert attribute called customer is used to partition alerts for particular customers within the same
alert database.
When a user logs in to the Alert console, a customer lookup is done to determine what customer value should be
assigned to that user.
The customer value is then used as an implicit additional filter for all alert and heartbeat queries.
It is also assigned to any API keys generated by that user and the customer field is automatically used whenever
that API key is used to generate or query for alerts.
1.11.3 Configuration
AUTH_REQUIRED = True
CUSTOMER_VIEWS = True
2. Define administrators that will have a global view of all customers and will have no restrictions on generating
API keys or blackout periods, so in alertad.conf:
ADMIN_USERS = ['[email protected]']
3. Populate the Customer Lookup table in the web console to map Google email domains or Github/Gitlab orgs
and groups to customers
Users that have a customer view are limited to what they can do in the web console (and via the API). They cannot
create other users, configure blackout periods or modify the customer lookup table.
Administrators are not limited in what they can do in the web console (or via the API). Importantly, they can configure
the customer lookup table.
1.12 Conventions
Always favour convention over configuration. And any configuration should have sensible defaults.
Resources
The key alert attribute name of resource was specifically chosen so as not to be host centric. A resource can be
a hostname, but it might also be an EC2 instance ID, a Docker container ID or some other type of non-host unique
identifier.
The environment attribute is used to namespace the alert resource. This allows you to have two resources with the
same name (eg. web01) but that are differentiated by their environments (eg. Production and Development).
Choose a set of environments and enforce them. ie. PROD, DEV or Production, Development but not both.
The same for services eg. MobileAPI, Mobile-API and mobile api are all valid but needlessly different and
impossible to query for consistently or generate aggregate metrics for.
Note that the service attribute is a list because it is common for infrastructure (ie. some resource) to be used by more
than one service. That is, if a component failure occurs that problem could cause an outage in multiple services.
Event Names
It can be useful to define a convention when it comes to naming events. Possible options are:
• Camel case - DiskUtilHigh
• Hierarchy - NW:INTERFACE:DOWN
• SNMP - cpuAlarmHigh
Querying for all Disk utilisation alerts using the alerta CLI is then relatively straight-forward:
Event Groups
Another consideration is to ensure you make use of the event group which gives you the ability to group related alerts.
Some suggested event groups with possible events are listed below.
Querying for all performance-related alerts using the alerta CLI could then become:
1.12. Conventions 57
alerta Documentation, Release 6.0
Agree on a subset of severity levels and be consistent with what they mean. For example, if severity levels are used
consistently then integrating with a paging or email system becomes easier.
Once a set of naming conventions are agreed, they can be enforced by using a simple pre-receive plugin.
A full working example called reject can be found in the plugins directory of the project code repository and is installed
by default. The server configuration settings ORIGIN_BLACKLIST and ALLOWED_ENVIRONMENTS can be used
to tailor it for your circumstances or it can be disabled completely.
1.13 Development
Alerta is developed in Python so the Python SDK is a core component of the monitoring system.
Installation
Examples
Send an alert:
Send an alert again, this time including the required environment and service:
('fd3ecad4-6558-4ec7-96cc-aff6cdf1fabc', Alert(id='fd3ecad4-6558-4ec7-96cc-
˓→aff6cdf1fabc', environment='Development', resource='foo', event='bar', severity=
>>> client.get_alert('fd3ecad4-6558-4ec7-96cc-aff6cdf1fabc')
Alert(id='fd3ecad4-6558-4ec7-96cc-aff6cdf1fabc', environment='Development', resource=
˓→'foo', event='bar', severity='normal', status='closed', customer=None)
>>> client.get_alerts([('resource','foo'),('environment','Development')])
[Alert(id='fd3ecad4-6558-4ec7-96cc-aff6cdf1fabc', environment='Development', resource=
˓→'foo', event='bar', severity='normal', status='closed', customer=None)]
Send a heartbeat:
>>> client.heartbeat(origin='baz')
Heartbeat(id='98c220e6-5148-4b19-8ae8-e1c078b7d68c', origin='baz', create_
˓→time=datetime.datetime(2018, 9, 6, 8, 48, 48, 817000), timeout=86400, customer=None)
The Ruby SDK is a work-in-progress. For more details, visit the Alerta Ruby SDK page.
This SDK supplies bindings to the Alerta REST API so that it can be used from Haskell.
For more details, visit the Haskell Package page.
View the development of Alerta over the years as an animated tree Gource visualization.
The following tutorials are designed to get you started deploying and using Alerta in common scenarios.
1.14.1 Tutorials
Note: If you require help with any of the above tutorials post a question on Gitter.
How To Monitor Nagios Alerts with Alerta on Ubuntu 16.04 by Vadym Kalsin
How To Monitor Zabbix Alerts with Alerta on CentOS 7 by Vadym Kalsin
OpenSource Metric Based Monitoring by Christian Eichelmann
Installing Alerta on Debian | Ubuntu in Cyber Defence Monitoring Course Suite (CDMCS)
SRE Engineering Practice – Alarm Based on Time Series to Store Data on Docker Mail
Simple tutorial for wetting your appetite on using alerta.io by deeplook
1.15 Resources
How to avoid failing at failure detection by Alex Tavgen, Technical Architect at Playtech
Winning the metrics battle (finally) [Slides] at Velocity Europe 2012
1.15.2 Articles
Winning the metrics battle by Simon Hildrew and Nick Satterly, The Guardian
Never fail twice by Alex Tavgen
Make better use of Prometheus with Grafana, Telegraf, and Alerta [$] by Martin Loschwitz, Linux Magazin [DE]
Grafana, Telegraf, Alerta – Prometheus besser nutzen (in German) [$] by Martin Loschwitz, Linux Magazin [DE]
Riemann Learnings by Antonio Terreno, CTO The Labrador,
1.15.3 Papers
Frankenstack: Toward Real-time Red Team Feedback by Markus Kont, Mauno Pihelgas, Bernhards Blumbergs of
NATO Cooperative Cyber Defence Centre of Excellence and Kaie Maennel and Toomas Lepik of the Tallinn University
of Technology at 2017 IEEE Military Communications Conference
EVE and ADAM: Situation Awareness Tools for NATO CCDCOE Cyber Exercises by Francisco Jesús Rubio Melón
of Ingeniería de Sistemas para la Defensa de España, Teemu Uolevi Väisänen of VTT Technical Research Centre of
Finland and Mauno Pihelgas of NATO Cooperative Cyber Defence Centre of Excellence
1.15.4 References
Event Correlation Engine [Master’s Thesis] by Andreas Müller (2009) at Institut für Technische Informatik und Kom-
munikationsnetze
ANSI/ISA 18.2 Management of Alarm Systems for the Process Industries by American National Standards Institute
Resource Types
• Alerts
– Create an alert
– Retrieve an alert
– Set alert status
– Action alert
– Tag and untag alerts
– Update alert attributes
– Delete an alert
– Search alerts
– List all alert history
– Get severity and status counts for alerts
– Top 10 alerts by resource
• Environments
– List all environments
• Services
– List all services
• Tags
– List all tags
• Blackout Periods
– Create a blackout
– List all blackouts
– Delete a blackout
• Heartbeats
– Send a heartbeat
– Get a heartbeat
– List all heartbeats
– Delete a heartbeat
• API Keys
– Create an API key
– List all API keys
– Delete an API key
• Users
– Create a user
– Update a user
– Update me
– Update user attributes
– Update user me attributes
– List all users
– Delete a user
• Permissions
– Create permission
– List all permissions
– Delete a permission
• Customers
– Create a customer
– List all customers
– Delete a customer
Note: All datetime parameters must be in ISO 8601 format in UTC time (using time zone designator
“Z”) and expressed to millisecond precision as recommended by the W3C Date and Time Formats Note eg.
2017-06-19T11:16:19.744Z
1.16.1 Alerts
Create an alert
Creates a new alert, or updates an existing alert if the environment- resource-event combination already
exists.
POST /alert
Input
Note: Only resource and event are mandatory. The status can be dynamically assigned by the Alerta API
based on the severity.
Example Request
Example Response
201 CREATED
{
"alert": {
"attributes": {
"flapping": false,
"ip": "127.0.0.1",
"notify": true,
"region": "EU"
},
"correlate": [
"HttpServerError",
"HttpServerOK"
],
"createTime": "2018-01-27T21:00:12.999Z",
"customer": null,
"duplicateCount": 0,
"environment": "Production",
"event": "HttpServerError",
"group": "Web",
"history": [
{
"event": "HttpServerError",
"href": "http://localhost:8080/alert/17d8e7ea-b3ba-4bb1-9c5a-29e60865f258",
"id": "17d8e7ea-b3ba-4bb1-9c5a-29e60865f258",
"severity": "major",
"status": null,
"text": "Site is down.",
"type": "severity",
"updateTime": "2018-01-27T21:00:12.999Z",
"value": "Bad Gateway (501)"
}
],
"href": "http://localhost:8080/alert/17d8e7ea-b3ba-4bb1-9c5a-29e60865f258",
"id": "17d8e7ea-b3ba-4bb1-9c5a-29e60865f258",
"lastReceiveId": "17d8e7ea-b3ba-4bb1-9c5a-29e60865f258",
"lastReceiveTime": "2018-01-27T21:00:13.070Z",
"origin": "curl",
"previousSeverity": "indeterminate",
"rawData": null,
"receiveTime": "2018-01-27T21:00:13.070Z",
"repeat": false,
"resource": "web01",
"service": [
"example.com"
],
"severity": "major",
"status": "open",
(continues on next page)
202 ACCEPTED
{
"message": "Suppressed alert during blackout period",
"id": "1711c57e-5c6a-4c39-881b-9d8d174feafe",
"status": "ok"
}
Retrieve an alert
Example Request
$ curl http://localhost:8080/alert/17d8e7ea-b3ba-4bb1-9c5a-29e60865f258 \
-H 'Authorization: Key demo-key'
Example Response
200 OK
{
"alert": {
"attributes": {
"flapping": false,
"ip": "127.0.0.1",
"notify": true,
"region": "EU"
},
"correlate": [
"HttpServerError",
(continues on next page)
Sets the status of an alert, and logs the status change to the alert history.
PUT /alert/:id/status
Input
Example Request
Action alert
Takes an action against an alert which can change the status or severity of the alert and logs the action to the alert
history.
PUT /alert/:id/action
Input
Example Request
Adds or removes tag values from the set of tags for an alert.
PUT /alert/:id/tag
PUT /alert/:id/untag
Input
Example Request
Adds, deletes or modifies alert attributes. To delete an attribute assign “null” to the attribute.
PUT /alert/:id/attributes
Input
Example Request
Delete an alert
DELETE /alert/:id
Example Request
Search alerts
Find alerts using various alert attributes or a mongo-type query parameter to filter results.
GET /alerts
Parameters
Deprecated since version 6.3: The q parameter using Mongo-style query format has been replaced with a query format
based on Lucene query syntax supported by both MongoDB and Postgres backends. For more information see API
Query String Syntax.
Example Request
$ curl http://localhost:8080/alerts?group=Web \
-H 'Authorization: Key demo-key'
Example Response
200 OK
{
"alerts": [
{
(continues on next page)
GET /alerts/history
Parameters
Example Request
$ curl http://localhost:8080/alerts/history?service=example.com \
-H 'Authorization: Key demo-key'
Example Response
200 OK
{
"history": [
{
"attributes": {
"flapping": false,
"incidentKey": "1234abcd",
"ip": "10.1.1.1",
"notify": true
},
"customer": null,
"environment": "Production",
"event": "HttpServerError",
"group": "Web",
"href": "http://localhost:8080/alert/17d8e7ea-b3ba-4bb1-9c5a-29e60865f258",
"id": "17d8e7ea-b3ba-4bb1-9c5a-29e60865f258",
"origin": "curl",
"resource": "web01",
"service": [
"example.com"
],
"severity": "major",
"tags": [
"dc1",
"linux",
"linux2.6",
"dell"
],
"text": "Site is down.",
"type": "severity",
"updateTime": "2018-01-27T21:00:12.999Z",
"value": "Bad Gateway (501)"
},
{
"attributes": {
"flapping": false,
"incidentKey": "1234abcd",
"ip": "10.1.1.1",
"notify": true
},
"customer": null,
"environment": "Production",
"event": "HttpServerError",
"group": "Web",
"href": "http://localhost:8080/alert/17d8e7ea-b3ba-4bb1-9c5a-29e60865f258",
"id": "17d8e7ea-b3ba-4bb1-9c5a-29e60865f258",
"origin": "curl",
"resource": "web01",
"service": [
"example.com"
],
"status": "ack",
"tags": [
"dc1",
"linux",
"linux2.6",
"dell"
],
(continues on next page)
GET /alerts/count
Parameters
Example Request
$ curl http://localhost:8080/alerts/count?environment=Production \
-H 'Authorization: Key demo-key'
Example Response
200 OK
{
"severityCounts": {
"critical": 1,
"major": 1
},
"status": "ok",
"statusCounts": {
"ack": 1,
"open": 1
},
"total": 2
}
Returns a list of the top 10 resources grouped by an alert attribute. By default it is grouped by event but this can be
any valid attribute.
GET /alerts/top10/count
GET /alerts/top10/flapping
Parameters
Example Request
$ curl http://localhost:8080/alerts/top10?group-by=group \
-H 'Authorization: Key demo-key'
Example Response
200 OK
{
"status": "ok",
"top10": [
{
"count": 2,
"duplicateCount": 0,
"environments": [
"Production"
],
"group": "Web",
"resources": [
{
"href": "http://localhost:8080/alert/0099bae5-9683-48a1-a49d-f566fe143770",
"id": "0099bae5-9683-48a1-a49d-f566fe143770",
"resource": "web02"
},
{
"href": "http://localhost:8080/alert/e9fb05a0-b65c-4faa-8868-6f06a74a2b5b",
"id": "e9fb05a0-b65c-4faa-8868-6f06a74a2b5b",
"resource": "web01"
}
],
"services": [
"example.com"
]
}
],
"total": 1
}
1.16.2 Environments
GET /environments
Parameters
Example Request
$ curl http://localhost:8080/environments \
-H 'Authorization: Key demo-key'
Example Response
200 OK
{
"environments": [
{
"count": 2,
"environment": "Production"
}
],
"status": "ok",
"total": 1
}
1.16.3 Services
Returns a list of services grouped by environment and an alert count for each.
GET /services
Parameters
Example Request
$ curl http://localhost:8080/services?environment=Production \
-H 'Authorization: Key demo-key'
Example Response
200 OK
{
"services": [
{
"count": 2,
"environment": "Production",
"service": "example.com"
}
],
"status": "ok",
"total": 1
}
1.16.4 Tags
Returns a list of tags grouped by environment and an alert count for each.
GET /tags
Parameters
Example Request
$ curl http://localhost:8080/tags?environment=Production \
-H 'Authorization: Key demo-key'
Example Response
200 OK
{
"status": "ok",
"tags": [
{
"count": 2,
"environment": "Production",
"tag": "linux"
},
{
"count": 1,
"environment": "Production",
"tag": "dc2"
},
{
"count": 1,
"environment": "Production",
"tag": "hp"
},
{
"count": 2,
"environment": "Production",
"tag": "dell"
},
{
"count": 2,
"environment": "Production",
"tag": "dc1"
},
{
"count": 2,
"environment": "Production",
"tag": "linux2.6"
}
],
"total": 6
}
Create a blackout
POST /blackout
Input
Example Request
Example Response
201 CREATED
{
"blackout": {
"customer": null,
"duration": 3600,
"endTime": "2018-01-27T22:10:31.705Z",
"environment": "Production",
"event": null,
"group": "Web",
"href": "http://localhost:8080/blackout/79d12b79-45b9-4419-80e4-1f6c17478eb6",
"id": "79d12b79-45b9-4419-80e4-1f6c17478eb6",
"priority": 3,
"remaining": 3599,
"resource": null,
"service": [
"example.com"
],
"startTime": "2018-01-27T21:10:31.705Z",
"status": "active",
"tags": []
},
"id": "79d12b79-45b9-4419-80e4-1f6c17478eb6",
"status": "ok"
}
GET /blackouts
Example Request
$ curl http://localhost:8080/blackouts \
-H 'Authorization: Key demo-key'
Example Response
200 OK
{
"blackouts": [
{
"customer": null,
"duration": 3600,
"endTime": "2018-01-27T22:10:31.705Z",
"environment": "Production",
"event": null,
"group": "Web",
"href": "http://localhost:8080/blackout/79d12b79-45b9-4419-80e4-1f6c17478eb6",
"id": "79d12b79-45b9-4419-80e4-1f6c17478eb6",
"priority": 3,
"remaining": 3345,
"resource": null,
"service": [
"example.com"
],
"startTime": "2018-01-27T21:10:31.705Z",
"status": "active",
"tags": []
},
{
"customer": null,
"duration": 3600,
"endTime": "2018-01-27T22:14:32.377Z",
"environment": "Development",
"event": null,
"group": "Performance",
"href": "http://localhost:8080/blackout/c17832d4-c477-4eb1-b2d5-662e7a3600be",
"id": "c17832d4-c477-4eb1-b2d5-662e7a3600be",
"priority": 5,
"remaining": 3586,
"resource": null,
"service": [],
"startTime": "2018-01-27T21:14:32.377Z",
"status": "active",
"tags": []
}
(continues on next page)
Delete a blackout
DELETE /blackout/:id
Example Request
1.16.6 Heartbeats
Send a heartbeat
Creates a new heartbeat, or updates an existing heartbeat if a heartbeat from the origin already exists.
POST /heartbeat
Input
Example Request
Example Response
201 CREATED
{
"heartbeat": {
"createTime": "2018-01-27T21:15:38.675Z",
"customer": null,
"href": "http://localhost:8080/heartbeat/1a3f2e0a-3c65-4199-84ae-a21fb892ccc0",
"id": "1a3f2e0a-3c65-4199-84ae-a21fb892ccc0",
"latency": 0,
"origin": "cluster05",
"receiveTime": "2018-01-27T21:15:38.675Z",
"since": 0,
"status": "ok",
"tags": [
"db05",
"dc2"
],
"timeout": 120,
"type": "Heartbeat"
},
"id": "1a3f2e0a-3c65-4199-84ae-a21fb892ccc0",
"status": "ok"
}
Get a heartbeat
GET /heartbeat/:id
Example Request
$ curl http://localhost:8080/heartbeat/1a3f2e0a-3c65-4199-84ae-a21fb892ccc0 \
-H 'Authorization: Key demo-key'
Example Response
200 OK
{
"heartbeat": {
"createTime": "2018-01-27T21:15:38.675Z",
"customer": null,
"href": "http://localhost:8080/heartbeat/1a3f2e0a-3c65-4199-84ae-a21fb892ccc0",
"id": "1a3f2e0a-3c65-4199-84ae-a21fb892ccc0",
"latency": 0,
"origin": "cluster05",
"receiveTime": "2018-01-27T21:15:38.675Z",
(continues on next page)
GET /heartbeats
Example Request
$ curl http://localhost:8080/heartbeats \
-H 'Authorization: Key demo-key'
Example Response
200 OK
{
"heartbeats": [
{
"createTime": "2018-01-27T21:17:13.922Z",
"customer": null,
"href": "http://localhost:8080/heartbeat/f5eb11ef-e02b-42f2-9013-6efca6eca22a",
"id": "f5eb11ef-e02b-42f2-9013-6efca6eca22a",
"latency": 0,
"origin": "web02",
"receiveTime": "2018-01-27T21:17:13.922Z",
"since": 45,
"status": "ok",
"tags": [
"linux",
"dc1"
],
"timeout": 120,
"type": "Heartbeat"
},
{
"createTime": "2018-01-27T21:17:55.936Z",
"customer": null,
(continues on next page)
Delete a heartbeat
DELETE /heartbeat/:id
Example Request
POST /key
Input
Example Request
Example Response
201 CREATED
{
"data": {
"count": 0,
"customer": null,
"expireTime": "2019-01-27T22:18:42.245Z",
"href": "http://localhost:8080/key/_Jwm-qaGa0kBM9R1CyyQn-0qxLtBtij4ToQf6beL",
"id": "ca931aec-4e56-496f-a8d6-be11d93ddaed",
"key": "_Jwm-qaGa0kBM9R1CyyQn-0qxLtBtij4ToQf6beL",
"lastUsedTime": null,
"scopes": [
"write"
],
"text": "API key for external system",
"type": "read-write",
"user": "[email protected]"
},
"key": "_Jwm-qaGa0kBM9R1CyyQn-0qxLtBtij4ToQf6beL",
"status": "ok"
}
GET /keys
Example Request
$ curl http://localhost:8080/keys \
-H 'Authorization: Key demo-key'
Example Response
200 OK
{
"keys": [
{
"count": 0,
"customer": null,
"expireTime": "2019-01-27T22:18:42.245Z",
"href": "http://localhost:8080/key/_Jwm-qaGa0kBM9R1CyyQn-0qxLtBtij4ToQf6beL",
"id": "ca931aec-4e56-496f-a8d6-be11d93ddaed",
"key": "_Jwm-qaGa0kBM9R1CyyQn-0qxLtBtij4ToQf6beL",
"lastUsedTime": null,
"scopes": [
"write"
],
"text": "API key for external system",
"type": "read-write",
"user": "[email protected]"
},
{
"count": 21,
"customer": null,
"expireTime": "2019-01-27T19:22:27.120Z",
"href": "http://localhost:8080/key/demo-key",
"id": "532c9b59-9e90-40d4-8a3b-887362a79e9c",
"key": "demo-key",
"lastUsedTime": "2018-01-27T22:19:04.113Z",
"scopes": [
"admin",
"write",
"read"
],
"text": "Admin key created by alertad script",
"type": "read-write",
"user": "[email protected]"
}
],
"status": "ok",
"total": 2
}
DELETE /key/:key
Example Request
1.16.8 Users
Create a user
POST /auth/signup
Input
Example Request
Example Response
200 OK
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.
˓→ eyJzdWIiOiI4Y2IwYjYyNC0zY2Q3LTQ1YjktOThhNS01ZGZhYzVmMDE2NmMiLCJyb2xlcyI6WyJ1c2VyIl0sImlzcyI6Imh0dHA
˓→c5jpr8YksoJmoZ6KUwsYP5fgwZr-jdA4W3JUCbv1vXU"
Update a user
Updates the specified user by setting the values of the parameters passed. Any parameters not provided will be left
unchanged.
PUT /user/:user
Input
Example Request
Update me
Updates the logged in user by setting the values of the parameters passed. Any parameters not provided will be left
unchanged.
It is not allowed to update roles, email_verified status or change the email to one that is already associated
with another user.
PUT /user/me
Input
Example Request
PUT /user/:id/attributes
Input
Example Request
PUT /user/me/attributes
Input
Example Request
Example Request
$ curl http://localhost:8080/users \
-H 'Authorization: Key demo-key'
Example Response
200 OK
{
"domains": [
"*"
],
"groups": [
"*"
],
"orgs": [
"*"
],
"status": "ok",
"time": "2017-01-02T00:24:00.393Z",
"total": 2,
"users": [
{
"createTime": "2017-01-01T23:49:38.486Z",
"email_verified": false,
"id": "b91811e7-52dd-4a8f-adae-b4d5c628d6f8",
"login": "[email protected]",
"name": "Jane Doe",
"provider": "basic",
"role": "user",
"text": "demo user"
},
{
(continues on next page)
Delete a user
DELETE /user/:user
Example Request
1.16.9 Permissions
Create permission
POST /perm
Input
Example Request
Example Response
201 CREATED
{
"id": "40c2daee-1d77-44d5-b62d-e3e446396cef",
"permission": {
"id": "40c2daee-1d77-44d5-b62d-e3e446396cef",
"match": "alerta_ops",
"scopes": [
"read",
"write",
"admin:keys"
]
},
"status": "ok"
}
GET /perms
Example Request
$ curl http://localhost:8080/perms \
-H 'Authorization: Key demo-key'
Example Response
200 OK
{
"permissions": [
{
"id": "5b726183-019f-4add-b6dc-caba87e873f7",
"match": "alerta_ro",
"scopes": [
"read"
]
},
{
"id": "f4c91af3-5222-4201-9da0-02c40122f4c4",
"match": "alerta_rw",
"scopes": [
"read",
"write"
]
},
(continues on next page)
Delete a permission
Example Request
1.16.10 Customers
Create a customer
Input
Example Request
Example Response
201 CREATED
{
"customer": {
"customer": "Example Corp.",
"id": "289ca657-ea2c-4775-9e07-cc96844cc717",
"match": "example.com"
},
"id": "289ca657-ea2c-4775-9e07-cc96844cc717",
"status": "ok"
}
Example Request
$ curl http://localhost:8080/customers \
-H 'Authorization: Key demo-key'
Example Response
200 OK
{
"customers": [
{
"customer": "Example Corp.",
"id": "289ca657-ea2c-4775-9e07-cc96844cc717",
"match": "example.com"
},
{
"customer": "Example Org.",
"id": "90f4e211-c815-4112-9e1a-6e53de5a59c6",
"match": "example.org"
}
],
"status": "ok",
"time": "2017-01-02T01:21:38.958Z",
(continues on next page)
Delete a customer
DELETE /customer/:customer
Example Request
• If “customer views” is enabled then the appropriate customer filter for that user will be automatically applied.
The query string syntax is used by the q query string parameter. It is based on the Lucene query string syntax and is
described below.
• Search terms
• Field names
• Wildcards
• Regular expressions
• Ranges
• Grouping
• Field Grouping
Search terms
or:
bar
A search term can also be a phrase, surrounded by double quotes, which searches for all the words in the phrase, in
the same order:
"foo bar"
Field names
When no explicit field name is specified to search on in the query string the default field text will be used unless a
prefix is specified.
For example, where status field contains “ack”:
status:ack
Where the text field contains the exact phrase “kernel panic”:
text:"kernel panic"
_exists_:region
Wildcards
Wildcard searches can be used on individual terms using ? to replace single characters and * to replace one or more
characters:
To search for “foo”, “fu”, “bar” or “baz” use:
f* ba?
te?t
Regular expressions
Regular expression patterns can be embedded in the query string by wrapping them in forward-slashes (/). Typical
examples include:
/[mb]oat/
and:
name:/joh?n(ath[oa]n)/
To search for numbered devices beginning with “net”, “netwrk” or “network” use:
resource:/net(wo?rk)?[0-9]/
Note: Regular expressions are implemented by the database backends so there may be subtle differences between
Postgres POSIX regular expressions and MongoDB PCRE $regex pattern matching in practice.
Ranges
Ranges can be specified for numeric or string fields. Inclusive ranges are specified with square brackets [min TO
max] and exclusive ranges with curly brackets {min TO max}:
timeout:[1 TO 86400]
group:{alpha TO zulu}
value:{* TO 300}
value:[500 TO *]
Ranges with one side unbounded (using *) can use a simplified syntax:
value:>500
value:>=500
value:<500
value:<=500
Grouping
Multiple terms or clauses can be grouped together with parentheses, to form sub-queries:
Field Grouping
status:(open OR ack)
text:(full text search)
Note: The following are not currently supported: boolean operators (+,-), range queries by date, and range queries
based on severity levels.
Note: The following will not be supported: fuzziness, proximity searches, and boosting which are features specific
to Lucene and/or Elasticsearch.
Alerts received and sent by Alerta conform to a common alert format. All components of alerta use this message
format and any external systems must produce or consume messages in this format also.
1.18.1 Attributes
Attribute Description
resource resource under alarm, deliberately not host-centric
event event name eg. NodeDown, QUEUE:LENGTH:EXCEEDED
environment effected environment, used to namespace the resource
severity severity of alert (default normal). see Alert Severities table
correlate list of related event names
status status of alert (default open). see Alert Status table
service list of effected services
group event group used to group events of similar type
value event value eg. 100%, Down, PingFail, 55ms, ORA-1664
text freeform text description
tags set of tags in any format eg. aTag, aDouble:Tag, a:Triple=Tag
attributes dictionary of key-value pairs
origin name of monitoring component that generated the alert
type alert type eg. snmptrapAlert, syslogAlert, gangliaAlert
createTime UTC date-time the alert was generated in ISO8601 format
timeout number of seconds before alert is considered stale
rawData unprocessed data eg. full syslog message or SNMP trap
Attention: If the reject plugin is enabled (which it is by default) then alerts must have an environment
attribute that is one of either Production or Development and it must define a service attribute. For more
information on configuring or disabling this plugin see Plugin Settings.
Attribute Description
id globally unique random UUID
a count of the number of times this event has been received for a resource
duplicateCount
repeat if duplicateCount is 0 or the alert status has changed then repeat is False, otherwise it is True
the previous severity of the same event for this resource. if no event or correlate events exist
previousSeverity
in the database for this resource then it will be unknown
based on severity and previousSeverity will be one of moreSevere, lessSevere
trendIndication
or noChange
receiveTime UTC datetime the alert was received by the Alerta server daemon
the last alert id received for this event
lastReceiveId
the last time this alert was received. only different to receiveTime if the alert is a duplicate
lastReceiveTime
customer assigned based on the owner of the API key used when submitting the alert, if “Customer Views”
is enabled, or can be set if admin user
history whenever an alert changes severity or status then a list of key alert attributes are appended to the
history log
The Alarms in Syslog RFC 5674 was referenced when defining alert severities.
Attribute Description
id alert id that history log entry relates to
event event name of alert changing severity or status
severity (*) new severity of alert changing severity
status (+) new status of alert changing status
value (*) event value of alert changing severity
text text describing reason for severity or status change
type history type eg. action, status, severity or value change
updateTime UTC date-time the alert triggering the change was created
Note: The severity and value attributes are only added to the history log for alerts with event changes (See *
above). And the status attribute is only added to the history log for alerts with status changes (See + above).
1.18.6 Example
{
"attributes": {
"flapping": false,
"ip": "127.0.0.1",
"notify": true,
"region": "EU"
},
"correlate": [
"HttpServerError",
"HttpServerOK"
],
"createTime": "2018-01-27T21:00:12.999Z",
"customer": null,
"duplicateCount": 0,
(continues on next page)
1.19.1 Attributes
Attribute Description
id globally unique random UUID
origin name of monitoring component that generated the heartbeat
tags set of tags in any format eg. aTag, aDouble:Tag, a:Triple=Tag
type heartbeat type. only Heartbeat is currently supported
createTime UTC date and time the heartbeat was generated in ISO 8601 format
timeout number of seconds before heartbeat is considered stale
Attribute Description
receiveTime UTC date and time the heartbeat was received by the Alerta server daemon
customer assigned based on the owner of the API key used when submitting the heartbeat, if “Customer
Views” are enabled
1.19.3 Example
{
"origin": "macbook",
"tags": [
"foo",
"bar",
"baz"
],
"createTime": "2015-10-03T00:00:59.055Z",
"href": "http://api.alerta.io/heartbeat/a8b97056-8415-4b4f-83c8-e84ffcc676a3",
"timeout": 300,
"receiveTime": "2015-10-03T00:00:59.681Z",
"type": "Heartbeat",
"id": "a8b97056-8415-4b4f-83c8-e84ffcc676a3"
}
Contribute
103
alerta Documentation, Release 6.0
Support
3.1.1 Alerta
If you can send and query for alerts using the alerta CLI tool this problem is almost certainly related to cross-origin
browser errors. Open up the Javascript developer console in your browser of choice and look for CORS errors like:
To fix this you can either serve the web UI from the same origin as the API using a web server to reverse proxy the web
UI or ensure that the API server allows the origin where the web UI is hosted by adding it to the CORS_ORIGINS
server configuration setting.
Why do I need to set an environment and service when they are not mandatory?
Only resource and event are technically required to ensure that Alerta can process alerts correctly. However,
the “out-of-the-box” default server setting for PLUGINS has the reject plugin enabled. This plugin enforces an
alert “policy” of requiring an environment attribute of either Production or Development and a value for
the service attribute.
105
alerta Documentation, Release 6.0
This is to encourage good habits early in defining useful alert attributes that can be used to “namespace” alerts (this is
what the environment attribute is for) and so that the web console can organise by environemnt and filter alerts
by service.
However, one of the principles of Alerta is not to enforce its view of the world on users so the plugin can be easily
configured, modified or completely disabled. It’s up to you.
Yes, you can now completely change the severity names, severity levels and colours. See Alerta Web UI for more
information.
Using the web console to sort alerts by priority as well as severity would require some development effort.
Alerts are meant to auto-close when a corresponding normal or cleared alert is received for that event-resource combi-
nation. If no normal alert exists for a particular event (which may be the case for alerts from log files or SNMP traps,
for example) then the alert will be deleted when the timeout period has expired. Alerts timeout after 1 day by default
but that is configurable on a per-alert basis.
If, as an operator, you want to remove an event from view then you can either ack the alert or DELETE it. If the alert is
DELETED a new alert with the same event-resource combination will trigger a new notification email (if configured)
whereas an ack’ed alert will not.
Why don’t you have a plugin or integration for X, where X is whatever you use in your job?
We could spend countless hours writing plugins for everything and never finish or we could focus on building an easily
extensible system with great documentation and let the end-user build the plugins they need. Having said that, we have
still created many plugins and integrations as working examples and we are not against writing more if there is popular
demand. We are also happy to accept submissions.
With the update to PyMongo 3.x multiprocessing applications “parent process and each child process must create their
own instances of MongoClient”.
For Apache WSGI applications, an example Apache “vhost” configuration for the Alerta API would look like this:
<VirtualHost *:8080>
ServerName localhost
WSGIDaemonProcess alerta processes=5 threads=5
WSGIProcessGroup alerta
WSGIApplicationGroup %{GLOBAL}
WSGIScriptAlias / /var/www/api.wsgi
WSGIPassAuthorization On
<Directory /opt/alerta>
Require all granted
</Directory>
</VirtualHost>
Full examples are available on GitHub and more information on why this is necessary is available on stackoverflow
and the PyMongo where they discussion PyMongo in relation to forking and mod_wsgi site.
Alerta Release 5.2 is the last version to support Python 2.7 and from 31 August, 2018 it will only receive crtical bug
fixes and security patches.
Alerta Release 6 supports Python 3.5+ and is recommended for new production environments and existing installations
should be switched to Python 3 well before 1 January, 2020 when Python 2.7 becomes End-of-Life.
License
4.1 Releases
4.1.1 Roadmap
109
alerta Documentation, Release 6.0
• alarm shelving for temporarily removing alerts from the main alert list
• new blackout status that don’t trigger plugins to keep track of suppressed alerts
• add history entry for de-duplicated alerts with a value change
• multiple customers for auth providers that allow membership of more than one group
• Python 3 support only (no breaking changes for Python 2, yet)
• Support for PostgreSQL (including Amazon RDS and Google Cloud SQL)
• API responses are Gzipped to make everything faster
• Development command line has changed from alertad to alertad run
• Major code refactor with flatter structure (beware imports! see next)
• WSGI import has changed from from alerta.app import app to simply from alerta import app
• Plugins import has changed from from alerta.app import app to from alerta.plugins import app
• Blackout is now a plugin so it can be disabled and replaced with a custom blackout handler
• Switched to using wheels for distribution via PyPI See http://pythonwheels.com/
• Alerta API now supports multiple roles for BasicAuth (though not supported in the web UI yet)
• Alert format: value is now always cast to a string.
• Added /management/housekeeping URL to replace housekeepingAlerts.js cron job script
• DATABASE_URL connection URI setting replaces every other MongoDB setting with a non-mongo specific
variable
4.2 About
Alerta started at The Guardian out of necessity as a replacement for a legacy monitoring tool but only after exhaustively
evaluating all credible alternatives first.
Initially all we wanted was to be able to create alert thresholds against the hundreds of thousands of Ganglia metrics
collected for the website and view the alerts in a web console ie. a Ganglia “alerter”. Not having a proper name for
this metrics and monitoring system the working name of “an alerter” stuck and a simple homophone was chosen to
aid future Google searches.
In the end, the thresholding of metrics proved very difficult to scale so we eventually split the project in two and metric
thresholding was given to Riemann (see riemann-config) and the alert correlation, de-duplication and visualisation
became the “Alerta” project.
Over the years the project has evolved to meet the constantly changing needs of the Guardian developer teams as they
moved to a more agile, dynamic, “swimlaned” architecture which has meant, for the operations team, a shift from
static, self-hosted infrastructure to an internal OpenStack cloud to then finally an external cloud service.
In that time certain key features of Alerta have been deprecated as requirements changed (eg. the message bus, Ganglia,
Riemann) and others added (eg. OAuth2 login, CloudWatch, Pingdom, PagerDuty integration). In the process it has
been slimmed down to fewer core components making it easier to understand, deploy and manage.
As a result, Alerta is now quite different to the somewhat “over engineered” initial solution but the core concepts of
being a flexible, easy-to-use tool remain and it is now a “cloud-ready” solution adapted to the challenges of a fast
changing environment.
• genindex
• search
115
alerta Documentation, Release 6.0
A CUSTOMER_VIEWS, 46, 51
ACTIONS, 49
ADMIN_USERS, 46, 51
D
ALARM_MODEL, 44 DATABASE_NAME, 9, 45, 51
ALERT_TIMEOUT, 48 DATABASE_RAISE_ON_ERROR, 45
ALERTA_API_KEY, 13 DATABASE_URL, 9, 45, 51
ALERTA_CONF_FILE, 13 DATE_FORMAT_LONG_DATE, 49
ALERTA_DEFAULT_PROFILE, 13 DATE_FORMAT_MEDIUM_DATE, 49
ALERTA_ENDPOINT, 13 DATE_FORMAT_SHORT_TIME, 49
ALERTA_SVR_CONF_FILE, 43 DEBUG, 13, 44, 50
ALLOWED_EMAIL_DOMAINS, 46, 51 DEFAULT_AUDIO_FILE, 49
ALLOWED_ENVIRONMENTS, 50, 58 DEFAULT_FIELD, 44
ALLOWED_GITHUB_ORGS, 46, 51 DEFAULT_NORMAL_SEVERITY, 48
ALLOWED_GITLAB_GROUPS, 46, 51 DEFAULT_PAGE_SIZE, 44
ALLOWED_KEYCLOAK_ROLES, 46, 51 DEFAULT_PREVIOUS_SEVERITY, 48
ALLOWED_SAML2_GROUPS, 46
API_KEY_EXPIRE_DAYS, 46
E
AUDIT_LOG, 47 EMAIL_VERIFICATION, 48
AUDIT_TRAIL, 47 environment variable
AUDIT_URL, 47 ADMIN_USERS, 51
AUTH_PROVIDER, 46, 51 ALERTA_API_KEY, 13
AUTH_REQUIRED, 46, 51 ALERTA_CONF_FILE, 13
AUTO_REFRESH_INTERVAL, 49 ALERTA_DEFAULT_PROFILE, 13
ALERTA_ENDPOINT, 13
B ALERTA_SVR_CONF_FILE, 43
BASE_URL, 44, 50 ALLOWED_EMAIL_DOMAINS, 51
BASIC_AUTH_REALM, 46 ALLOWED_ENVIRONMENTS, 58
BLACKOUT_ACCEPT, 50 ALLOWED_GITHUB_ORGS, 51
BLACKOUT_DURATION, 50 ALLOWED_GITLAB_GROUPS, 51
blackouts, 7 ALLOWED_KEYCLOAK_ROLES, 51
BULK_QUERY_LIMIT, 45 AUTH_PROVIDER, 51
AUTH_REQUIRED, 51
C BASE_URL, 50
CLICOLOR, 13
CELERY_BROKER_URL, 45
CORS_ORIGINS, 51, 105
CELERY_RESULT_BACKEND, 45
CUSTOMER_VIEWS, 51
CLICOLOR, 13
DATABASE_NAME, 9, 51
COLOR_MAP, 48
DATABASE_URL, 9, 51
COLUMNS, 49
DEBUG, 13, 50
CORS_ORIGINS, 47, 51, 105
GITHUB_URL, 51
117
alerta Documentation, Release 6.0
GITLAB_URL, 51 LOG_METHODS, 44
GOOGLE_TRACKING_ID, 51
KEYCLOAK_REALM, 51 M
KEYCLOAK_URL, 51 MAIL_FROM, 48, 51
MAIL_FROM, 51 MAIL_LOCALHOST, 48
MONGO_PORT, 52 MONGO_PORT, 52
MONGO_URI, 51 MONGO_URI, 51
MONGODB_URI, 51 MONGODB_URI, 51
MONGOHQ_URL, 52 MONGOHQ_URL, 52
MONGOLAB_URI, 52 MONGOLAB_URI, 52
OAUTH2_CLIENT_ID, 51
OAUTH2_CLIENT_SECRET, 51 N
ORIGIN_BLACKLIST, 58 NOTIFICATION_BLACKOUT, 50
PINGFEDERATE_OPENID_ACCESS_TOKEN_URL,
51 O
PINGFEDERATE_OPENID_PAYLOAD_EMAIL, OAUTH2_CLIENT_ID, 46, 51
51 OAUTH2_CLIENT_SECRET, 46, 51
PINGFEDERATE_OPENID_PAYLOAD_GROUP, ORIGIN_BLACKLIST, 50, 58
51
P
PINGFEDERATE_OPENID_PAYLOAD_USERNAME,
51 PINGFEDERATE_OPENID_ACCESS_TOKEN_URL,
PINGFEDERATE_PUBKEY_LOCATION, 51 51
PINGFEDERATE_TOKEN_ALGORITHM, 51 PINGFEDERATE_OPENID_PAYLOAD_EMAIL, 46,
PLUGINS, 51 51
REQUESTS_CA_BUNDLE, 13 PINGFEDERATE_OPENID_PAYLOAD_GROUP, 46,
SECRET_KEY, 30, 51 51
SMTP_PASSWORD, 51 PINGFEDERATE_OPENID_PAYLOAD_USERNAME,
USE_PROXYFIX, 51 46, 51
PINGFEDERATE_PUBKEY_LOCATION, 46, 51
G PINGFEDERATE_TOKEN_ALGORITHM, 46, 51
GITHUB_URL, 46, 51 PINGFEDERATE_URL, 46
GITLAB_URL, 46, 51 PLUGINS, 49, 51
GOOGLE_TRACKING_ID, 49, 51 PLUGINS_RAISE_ON_ERROR, 49
H R
heartbeat REQUESTS_CA_BUNDLE, 13
stale, 8 RFC
HEARTBEAT_TIMEOUT, 48 RFC 3164, 25
HISTORY_LIMIT, 44 RFC 5424, 25
HISTORY_ON_VALUE_CHANGE, 44 RFC 5674, 98
K S
KEYCLOAK_REALM, 46, 51 SAML2_CONFIG, 46
KEYCLOAK_URL, 46, 51 SAML2_USER_NAME_FORMAT, 46
SECRET_KEY, 30, 44, 51
L SEVERITY_MAP, 48
LDAP_DOMAINS, 46 SIGNUP_ENABLED, 46
LDAP_URL, 46 SITE_LOGO_URL, 49
LOG_BACKUP_COUNT, 44 SMTP_HOST, 48
LOG_CONFIG_FILE, 44 SMTP_PASSWORD, 48, 51
LOG_FILE, 44 SMTP_PORT, 48
LOG_FORMAT, 44 SMTP_STARTTLS, 48
LOG_HANDLERS, 44 SMTP_USE_SSL, 48
LOG_MAX_BYTES, 44 SMTP_USERNAME, 48
118 Index
alerta Documentation, Release 6.0
SORT_LIST_BY, 49
SSL_CERT_FILE, 48
SSL_KEY_FILE, 48
stale
heartbeat, 8
T
TOKEN_EXPIRE_DAYS, 46
U
USE_PROXYFIX, 44, 51
USER_DEFAULT_SCOPES, 46
Index 119