Skip to content

Commit 8f80f8b

Browse files
authored
Merge pull request #78 from alerta/release-5-beta1
Release 5 beta1
2 parents 5d0ffa8 + daea389 commit 8f80f8b

74 files changed

Lines changed: 2393 additions & 3193 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015 Nick Satterly
3+
Copyright (c) 2015-2017 Nick Satterly
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
PYTHON=python
3+
VERSION=`cut -d "'" -f 2 alerta/version.py`
4+
5+
all: help
6+
7+
help:
8+
@echo ""
9+
@echo "Usage: make <command>"
10+
@echo ""
11+
@echo "Commands:"
12+
@echo " init Initialise environment"
13+
@echo " pylint Lint source code"
14+
@echo " clean Clean source"
15+
@echo " test Run tests"
16+
@echo " run Run application"
17+
@echo " tag Git tag with current version"
18+
@echo " upload Upload package to PyPI"
19+
@echo ""
20+
21+
init:
22+
pip install -r requirements.txt
23+
24+
pylint:
25+
@pip -q install pylint
26+
pylint --rcfile pylintrc alerta
27+
28+
clean:
29+
find . -name "*.pyc" -exec rm {} \;
30+
rm -Rf build dist *.egg-info
31+
32+
test:
33+
nosetests tests
34+
35+
tag:
36+
git tag -a v$(VERSION) -m "version $(VERSION)"
37+
38+
upload:
39+
$(PYTHON) setup.py sdist bdist_wheel upload

README.md

Lines changed: 59 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Profiles can be used to easily switch between different configuration settings.
3333
| timezone | timezone | n/a | n/a | Europe/London |
3434
| SSL verify | sslverify | ``REQUESTS_CA_BUNDLE`` | n/a | verify SSL certificates |
3535
| timeout | timeout | n/a | n/a | 5s TCP connection timeout |
36-
| output | output | n/a | ``--output OUTPUT``, ``--json`` | text |
36+
| output | output | n/a | ``--output OUTPUT`` | simple |
3737
| color | color | ``CLICOLOR`` | ``--color``, ``--no-color`` | color on |
3838
| debug | debug | ``DEBUG`` | ``--debug`` | no debug |
3939

@@ -44,7 +44,7 @@ Configuration file ``~/.alerta.conf``::
4444

4545
[DEFAULT]
4646
timezone = Australia/Sydney
47-
# output = json
47+
# output = psql
4848
profile = production
4949

5050
[profile production]
@@ -74,58 +74,53 @@ And to switch to development configuration settings when required use the ``--pr
7474
Usage
7575
-----
7676

77-
$ alerta --help
78-
usage: alerta [OPTIONS] COMMAND [FILTERS]
79-
80-
Alerta client unified command-line tool
81-
82-
optional arguments:
83-
-h, --help show this help message and exit
84-
--profile PROFILE Profile to apply from ~/.alerta.conf
85-
--endpoint-url URL API endpoint URL
86-
--output OUTPUT Output format of "text" or "json"
87-
--json, -j Output in JSON format. Shortcut for "--output json"
88-
--color, --colour Color-coded output based on severity
89-
--debug Print debug output
90-
77+
$ alerta
78+
Usage: alerta [OPTIONS] COMMAND [ARGS]...
79+
80+
Alerta client unified command-line tool.
81+
82+
Options:
83+
--config-file <FILE> Configuration file.
84+
--profile <PROFILE> Configuration profile.
85+
--endpoint-url <URL> API endpoint URL.
86+
--output-format <FORMAT> Output format. eg. simple, grid, psql, presto, rst
87+
--color / --no-color Color-coded output based on severity.
88+
--debug Debug mode.
89+
--help Show this message and exit.
90+
9191
Commands:
92-
COMMAND
93-
send Send alert to server
94-
query List alerts based on query filter
95-
watch Watch alerts based on query filter
96-
top Show top offenders and stats
97-
raw Show alert raw data
98-
history Show alert history
99-
tag Tag alerts
100-
untag Remove tags from alerts
101-
ack Acknowledge alerts
102-
unack Unacknowledge alerts
103-
close Close alerts
104-
delete Delete alerts
105-
blackout Blackout alerts based on attributes
106-
blackouts List all blackout periods
107-
heartbeat Send heartbeat to server
108-
heartbeats List all heartbeats
109-
user Manage user details (Basic Auth only).
110-
users List all users
111-
key Create API key
112-
keys List all API keys
113-
revoke Revoke API key
114-
status Show status and metrics
115-
uptime Show server uptime
116-
version Show alerta version info
117-
help Show this help
118-
119-
Filters:
120-
Query parameters can be used to filter alerts by any valid alert attribute
121-
122-
resource=web01 Show alerts with resource equal to "web01"
123-
resource!=web01 Show all alerts except those with resource of "web01"
124-
event=~down Show alerts that include "down" in event name
125-
event!=~down Show all alerts that don't have "down" in event name
126-
127-
Special query parameters include "limit", "sort-by", "from-date" and "q" (a
128-
json-compliant mongo query).
92+
ack acknowledge alert
93+
blackout suppress alerts
94+
blackouts list alert suppressions
95+
close close alert
96+
customer add customer lookup
97+
customers list customer lookups
98+
delete delete alert
99+
heartbeat send a heartbeat
100+
heartbeats list heartbeats
101+
help show this help
102+
history show alert history
103+
key create API key
104+
keys list API keys
105+
login login with user credentials
106+
logout clear local login credentials
107+
perm add role-permission lookup
108+
perms list role-permission lookups
109+
query search for alerts
110+
raw show alert raw data
111+
revoke revoke API key
112+
send send an alert
113+
status display status and metrics
114+
tag tag alert
115+
token display current auth token
116+
unack un-acknowledge alert
117+
untag untag alert
118+
update update alert attributes
119+
uptime display server uptime
120+
user update user
121+
users list users
122+
version display version info
123+
whoami disply current logged in user
129124

130125
Python SDK
131126
==========
@@ -135,35 +130,19 @@ The alerta client python package can also be used as a Python SDK.
135130
Example
136131
-------
137132

138-
>>> from alertaclient.api import ApiClient
139-
>>> from alertaclient.alert import Alert
140-
>>>
141-
>>> api = ApiClient(endpoint='http://api.alerta.io', key='tiPMW41QA+cVy05E7fQA/roxAAwHqZq/jznh8MOk')
142-
>>> alert = Alert(resource='foo', event='bar')
143-
>>> alert
144-
Alert(id='b34410b0-884f-49f9-9685-f54c2f0a449c', environment='', resource='foo', event='bar', severity='normal', status='unknown', customer=None)
145-
>>> api.send(alert)
146-
{u'status': u'error', u'message': u'[POLICY] Alert environment must be one of Production, Development'}
147-
>>> alert = Alert(environment='Development', resource='foo', event='bar', service=['Web'])
148-
>>> api.send(alert)['id']
149-
u'5fdb224b-9378-422d-807e-fdf8610416d2'
150-
151-
>>> api.get_alert('5fdb224b-9378-422d-807e-fdf8610416d2')['alert']['severity']
152-
u'normal'
153-
>>>
154-
>>> api.get_alerts(query=[('resource','foo')])['alerts'][0]['id']
155-
u'5fdb224b-9378-422d-807e-fdf8610416d2'
156-
157-
>>> from alertaclient.heartbeat import Heartbeat
158-
>>> hb = Heartbeat(origin='baz')
159-
>>> hb
160-
Heartbeat(id='83ecb3d6-c6cf-44eb-bdf6-1e8990b82050', origin='baz', create_time=datetime.datetime(2017, 8, 17, 21, 45, 25, 914369), timeout=300, customer=None)
161-
>>> api.send(hb)['status']
162-
u'ok'
163-
>>>
133+
>>> from alertaclient.api import Client
134+
135+
>>> client = Client(key='NGLxwf3f4-8LlYN4qLjVEagUPsysn0kb9fAkAs1l')
136+
>>> client.send_alert(environment='Production', service=['Web', 'Application'], resource='web01', event='HttpServerError', value='501', text='Web server unavailable.')
137+
Alert(id='42254ef8-7258-4300-aaec-a9ad7d3a84ff', environment='Production', resource='web01', event='HttpServerError', severity='normal', status='closed', customer=None)
138+
139+
>>> [a.id for a in client.search([('resource','~we.*01'), ('environment!', 'Development')])]
140+
['42254ef8-7258-4300-aaec-a9ad7d3a84ff']
141+
142+
>>> client.heartbeat().serialize()['status']
143+
'ok'
164144

165145
License
166146
-------
167147

168148
Copyright (c) 2014-2017 Nick Satterly. Available under the MIT License.
169-

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.10.5
1+
5.0.0-beta1

alerta.spec

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)