Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Alerta unified command-line tool and SDK

Project Description
Alerta Command-Line Tool
========================

[![Build Status](https://travis-ci.org/alerta/python-alerta-client.svg?branch=master)](https://travis-ci.org/alerta/python-alerta-client) [![Gitter chat](https://badges.gitter.im/alerta/chat.png)](https://gitter.im/alerta/chat)

Unified command-line tool, terminal GUI and python SDK for the Alerta monitoring system.

![screen shot](/docs/images/alerta-top-80x25.png?raw=true&v=1)

Related projects can be found on the Alerta Org Repo at <https://github.com/alerta/>.

----

Installation
------------

To install the Alerta CLI tool run::

$ pip install alerta

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.

| Option | Config File | Environment Variable | Optional Argument | Default |
|------------|-------------|----------------------------|---------------------------------|---------------------------|
| file | n/a | ``ALERTA_CONF_FILE`` | n/a | ``~/.alerta.conf`` |
| profile | profile | ``ALERTA_DEFAULT_PROFILE`` | ``--profile PROFILE`` | None |
| endpoint | endpoint | ``ALERTA_ENDPOINT`` | ``--endpoint-url URL`` | ``http://localhost:8080`` |
| key | key | ``ALERTA_API_KEY`` | n/a | None |
| timezone | timezone | n/a | n/a | Europe/London |
| SSL verify | sslverify | ``REQUESTS_CA_BUNDLE`` | n/a | verify SSL certificates |
| timeout | timeout | n/a | n/a | 5s TCP connection timeout |
| output | output | n/a | ``--output-format OUTPUT`` | simple |
| color | color | ``CLICOLOR`` | ``--color``, ``--no-color`` | color on |
| debug | debug | ``DEBUG`` | ``--debug`` | no debug |

Example
-------

Configuration file ``~/.alerta.conf``::

[DEFAULT]
timezone = Australia/Sydney
# output = psql
profile = production

[profile production]
endpoint = https://api.alerta.io
key = demo-key

[profile development]
endpoint = https://localhost:8443
sslverify = off
timeout = 10.0
debug = yes

Environment Variables
---------------------

Set environment variables to use production configuration settings by default::

$ export ALERTA_CONF_FILE=~/.alerta.conf
$ export ALERTA_DEFAULT_PROFILE=production

$ alerta query

And to switch to development configuration settings when required use the ``--profile`` option::

$ alerta --profile development query

Usage
-----

$ alerta
Usage: alerta [OPTIONS] COMMAND [ARGS]...

Alerta client unified command-line tool.

Options:
--config-file <FILE> Configuration file.
--profile <PROFILE> Configuration profile.
--endpoint-url <URL> API endpoint URL.
--output-format <FORMAT> Output format. eg. simple, grid, psql, presto, rst
--color / --no-color Color-coded output based on severity.
--debug Debug mode.
--help Show this message and exit.

Commands:
ack Acknowledge alerts
blackout Suppress alerts
blackouts List alert suppressions
close Close alerts
customer Add customer lookup
customers List customer lookups
delete Delete alerts
heartbeat Send a heartbeat
heartbeats List heartbeats
help Show this help
history Show alert history
key Create API key
keys List API keys
login Login with user credentials
logout Clear login credentials
perm Add role-permission lookup
perms List role-permission lookups
query Search for alerts
raw Show alert raw data
revoke Revoke API key
send Send an alert
status Display status and metrics
tag Tag alerts
token Display current auth token
unack Un-acknowledge alerts
untag Untag alerts
update Update alert attributes
uptime Display server uptime
user Update user
users List users
version Display version info
whoami Display current logged in user

Python SDK
==========

The alerta client python package can also be used as a Python SDK.

Example
-------

>>> from alertaclient.api import Client

>>> client = Client(key='NGLxwf3f4-8LlYN4qLjVEagUPsysn0kb9fAkAs1l')
>>> client.send_alert(environment='Production', service=['Web', 'Application'], resource='web01', event='HttpServerError', value='501', text='Web server unavailable.')
Alert(id='42254ef8-7258-4300-aaec-a9ad7d3a84ff', environment='Production', resource='web01', event='HttpServerError', severity='normal', status='closed', customer=None)

>>> [a.id for a in client.search([('resource','~we.*01'), ('environment!', 'Development')])]
['42254ef8-7258-4300-aaec-a9ad7d3a84ff']

>>> client.heartbeat().serialize()['status']
'ok'

License
-------

Copyright (c) 2014-2017 Nick Satterly. Available under the MIT License.
Release History

Release History

This version
History Node

5.0.9

History Node

5.0.7

History Node

5.0.6

History Node

5.0.5

History Node

5.0.4

History Node

5.0.3

History Node

5.0.2

History Node

5.0.1

History Node

5.0.0

History Node

4.10.5

History Node

4.10.4

History Node

4.10.3

History Node

4.10.2

History Node

4.10.1

History Node

4.10.0

History Node

4.8.10

History Node

4.8.9

History Node

4.8.8

History Node

4.8.7

History Node

4.8.6

History Node

4.8.5

History Node

4.8.4

History Node

4.8.3

History Node

4.8.2

History Node

4.8.1

History Node

4.8.0

History Node

4.7.17

History Node

4.7.16

History Node

4.7.15

History Node

4.7.14

History Node

4.7.13

History Node

4.7.11

History Node

4.7.10

History Node

4.7.9

History Node

4.7.8

History Node

4.7.5

History Node

4.6.15

History Node

4.6.14

History Node

4.6.13

History Node

4.6.12

History Node

4.6.11

History Node

4.6.10

History Node

4.6.9

History Node

4.6.1

History Node

4.6.0

History Node

4.5.1

History Node

4.5.0

History Node

4.3.5

History Node

4.3.4

History Node

4.3.3

History Node

4.3.2

History Node

4.3.1

History Node

4.3.0

History Node

4.2.0

History Node

4.1.8

History Node

4.1.7

History Node

4.1.6

History Node

4.1.5

History Node

4.1.4

History Node

4.1.3

History Node

4.1.2

History Node

4.1.1

History Node

4.1.0

History Node

4.0.2

History Node

4.0.1

History Node

4.0.0

History Node

3.2.9

History Node

3.2.8

History Node

3.2.7

History Node

3.2.6

History Node

3.2.4

History Node

3.2.3

History Node

3.2.2

History Node

3.2.0

History Node

3.1.3

History Node

3.1.2

History Node

3.1.1

History Node

3.1.0

History Node

3.0.7

History Node

3.0.4

History Node

3.0.3

History Node

3.0.1

History Node

2.1.5

History Node

2.1.3

History Node

2.1.2

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
alerta-5.0.9-py2.py3-none-any.whl (44.6 kB) Copy SHA256 Checksum SHA256 3.6 Wheel Nov 17, 2017
alerta-5.0.9.tar.gz (24.3 kB) Copy SHA256 Checksum SHA256 Source Nov 17, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting