MCPcopy Index your code
hub / github.com/alerta/alerta

github.com/alerta/alerta @v9.1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v9.1.0 ↗ · + Follow
1,729 symbols 6,782 edges 158 files 90 documented · 5%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Alerta Release 9.1

Actions Status Slack chat Coverage Status Docker Pulls

The Alerta monitoring tool was developed with the following aims in mind:

  • distributed and de-coupled so that it is SCALABLE
  • minimal CONFIGURATION that easily accepts alerts from any source
  • quick at-a-glance VISUALISATION with drill-down to detail

webui


Requirements

Release 9 only supports Python 3.9 or higher.

The only mandatory dependency is MongoDB or PostgreSQL. Everything else is optional.

  • Postgres version 13 or better
  • MongoDB version 6.0 or better

Installation

To install MongoDB on Debian/Ubuntu run:

$ sudo apt-get install -y mongodb-org
$ mongod

To install MongoDB on CentOS/RHEL run:

$ sudo yum install -y mongodb
$ mongod

To install the Alerta server and client run:

$ pip install alerta-server alerta
$ alertad run

To install the web console run:

$ wget https://github.com/alerta/alerta-webui/releases/latest/download/alerta-webui.tar.gz
$ tar zxvf alerta-webui.tar.gz
$ cd dist
$ python3 -m http.server 8000

>> browse to http://localhost:8000

Docker

Alerta and MongoDB can also run using Docker containers, see alerta/docker-alerta.

Configuration

To configure the alertad server override the default settings in /etc/alertad.conf or using ALERTA_SVR_CONF_FILE environment variable::

$ ALERTA_SVR_CONF_FILE=~/.alertad.conf
$ echo "DEBUG=True" > $ALERTA_SVR_CONF_FILE

Documentation

More information on configuration and other aspects of alerta can be found at http://docs.alerta.io

Development

To run in development mode, listening on port 5000:

$ export FLASK_APP=alerta FLASK_DEBUG=1
$ pip install -e .
$ flask run

To run in development mode, listening on port 8080, using Postgres and reporting errors to Sentry:

$ export FLASK_APP=alerta FLASK_DEBUG=1
$ export DATABASE_URL=postgres://localhost:5432/alerta5
$ export SENTRY_DSN=https://8b56098250544fb78b9578d8af2a7e13:fa9d628da9c4459c922293db72a3203f@sentry.io/153768
$ pip install -e .[postgres]
$ flask run --debugger --port 8080 --with-threads --reload

Troubleshooting

Enable debug log output by setting DEBUG=True in the API server configuration:

DEBUG=True

LOG_HANDLERS = ['console','file']
LOG_FORMAT = 'verbose'
LOG_FILE = '$HOME/alertad.log'

It can also be helpful to check the web browser developer console for JavaScript logging, network problems and API error responses.

Tests

To run the all the tests there must be a local Postgres and MongoDB database running. Then run:

$ TOXENV=ALL make test

To just run the Postgres or MongoDB tests run:

$ TOXENV=postgres make test
$ TOXENV=mongodb make test

To run a single test run something like:

$ TOXENV="mongodb -- tests/test_search.py::QueryParserTestCase::test_boolean_operators" make test
$ TOXENV="postgres -- tests/test_queryparser.py::PostgresQueryTestCase::test_boolean_operators" make test

Cloud Deployment

Alerta can be deployed to the cloud easily using Heroku https://github.com/alerta/heroku-api-alerta, AWS EC2 https://github.com/alerta/alerta-cloudformation, or Google Cloud Platform https://github.com/alerta/gcloud-api-alerta

License

Alerta monitoring system and console
Copyright 2012-2023 Nick Satterly

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Core symbols most depended-on inside this repo

get
called by 894
alerta/utils/client.py
loads
called by 482
alerta/utils/format.py
dumps
called by 400
alerta/utils/format.py
post
called by 399
alerta/utils/client.py
get_db
called by 133
alerta/database/base.py
parse
called by 109
alerta/models/user.py
put
called by 108
alerta/utils/client.py
format
called by 104
alerta/utils/logging.py

Shape

Method 1,226
Class 214
Function 186
Route 103

Languages

Python100%
TypeScript1%

Modules by API surface

alerta/database/base.py142 symbols
alerta/database/backends/postgres/base.py131 symbols
alerta/database/backends/mongodb/base.py118 symbols
tests/test_plugins.py75 symbols
alerta/models/alert.py56 symbols
alerta/views/alerts.py45 symbols
tests/test_search.py41 symbols
alerta/models/metrics.py32 symbols
alerta/models/user.py31 symbols
tests/test_webhooks.py29 symbols
tests/test_queryparser.py29 symbols
tests/test_alerts.py26 symbols

Datastores touched

(mongodb)Database · 1 repos
mlm1Database · 1 repos
mlm2Database · 1 repos
mom1Database · 1 repos
mom2Database · 1 repos
monitoringDatabase · 1 repos
alertaDatabase · 1 repos
monitoringDatabase · 1 repos

For agents

$ claude mcp add alerta \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact