Skip to content

Commit 26f61f8

Browse files
committed
Update README with timeout, users, keys, examples and (c) 2017
1 parent 254a0da commit 26f61f8

1 file changed

Lines changed: 18 additions & 9 deletions

File tree

README.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Profiles can be used to easily switch between different configuration settings.
3232
| key | key | ``ALERTA_API_KEY`` | n/a | None |
3333
| timezone | timezone | n/a | n/a | Europe/London |
3434
| SSL verify | sslverify | ``REQUESTS_CA_BUNDLE`` | n/a | verify SSL certificates |
35+
| timeout | timeout | n/a | n/a | 5s TCP connection timeout |
3536
| output | output | n/a | ``--output OUTPUT``, ``--json`` | text |
3637
| color | color | ``CLICOLOR`` | ``--color``, ``--no-color`` | color on |
3738
| debug | debug | ``DEBUG`` | ``--debug`` | no debug |
@@ -53,6 +54,7 @@ Configuration file ``~/.alerta.conf``::
5354
[profile development]
5455
endpoint = https://localhost:8443
5556
sslverify = off
57+
timeout = 10.0
5658
debug = yes
5759

5860
Environment Variables
@@ -72,14 +74,14 @@ And to switch to development configuration settings when required use the ``--pr
7274
Usage
7375
-----
7476

75-
$ alerta help
77+
$ alerta --help
7678
usage: alerta [OPTIONS] COMMAND [FILTERS]
7779

7880
Alerta client unified command-line tool
7981

8082
optional arguments:
8183
-h, --help show this help message and exit
82-
--profile PROFILE Profile to apply from /Users/nsatterl/.alerta.conf
84+
--profile PROFILE Profile to apply from ~/.alerta.conf
8385
--endpoint-url URL API endpoint URL
8486
--output OUTPUT Output format of "text" or "json"
8587
--json, -j Output in JSON format. Shortcut for "--output json"
@@ -105,6 +107,10 @@ Usage
105107
heartbeat Send heartbeat to server
106108
heartbeats List all heartbeats
107109
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
108114
status Show status and metrics
109115
uptime Show server uptime
110116
version Show alerta version info
@@ -135,26 +141,29 @@ Example
135141
>>> api = ApiClient(endpoint='http://api.alerta.io', key='tiPMW41QA+cVy05E7fQA/roxAAwHqZq/jznh8MOk')
136142
>>> alert = Alert(resource='foo', event='bar')
137143
>>> alert
138-
Alert(id='6e625266-fb7c-4c11-bf95-27a6a0be432b', environment='', resource='foo', event='bar', severity='normal', status='unknown')
144+
Alert(id='b34410b0-884f-49f9-9685-f54c2f0a449c', environment='', resource='foo', event='bar', severity='normal', status='unknown', customer=None)
139145
>>> api.send(alert)
140-
{u'status': u'ok', u'id': u'5fdb224b-9378-422d-807e-fdf8610416d2'}
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'
141150

142151
>>> api.get_alert('5fdb224b-9378-422d-807e-fdf8610416d2')['alert']['severity']
143152
u'normal'
144153
>>>
145-
>>> api.get_alerts(resource='foo')['alerts'][0]['id']
154+
>>> api.get_alerts(query=[('resource','foo')])['alerts'][0]['id']
146155
u'5fdb224b-9378-422d-807e-fdf8610416d2'
147156

148157
>>> from alertaclient.heartbeat import Heartbeat
149158
>>> hb = Heartbeat(origin='baz')
150159
>>> hb
151-
Heartbeat(id='21d586a6-9bd5-4b18-b0bb-4fb876db4851', origin='baz', create_time=datetime.datetime(2014, 6, 14, 20, 2, 33, 55118), timeout=300)
152-
>>> api.send(hb)
153-
{u'status': u'ok', u'id': u'6bf11e97-9664-4fa3-b830-8e6d0d84b4cc'}
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'
154163
>>>
155164

156165
License
157166
-------
158167

159-
Copyright (c) 2014-2016 Nick Satterly. Available under the MIT License.
168+
Copyright (c) 2014-2017 Nick Satterly. Available under the MIT License.
160169

0 commit comments

Comments
 (0)