updownio is a free and open-source, it's a python wrapper for the updown.io API.
pip install updownio
Variable | Description | Default |
---|---|---|
UPDOWN_ACCEPT |
HTTP Accept request-header | application/json |
UPDOWN_ACCEPT_ENCODING |
HTTP Accept-Encoding request-header | gzip |
UPDOWN_API_KEY |
API key for authentication | |
UPDOWN_ENDPOINT |
API Endpoint | https://updown.io |
UPDOWN_TIMEOUT |
Request timeout in seconds | 60 |
import updownio
updown_checks = updownio.service('checks',
api_key = 'xxxxxxxxxxx',
endpoint = 'https://example.org/api',
timeout = 3600)
checks = updownio.service('checks').list()
Select check by token
check = updownio.service('checks').show(token = 'xxxx')
or by URL
check = updownio.service('checks').show(url = 'https://example.org')
Select downtimes by token
check = updownio.service('checks').downtimes(token = 'xxxx'
params = {'page': 1,
'results': False})
or by URL
check = updownio.service('checks').downtimes(url = 'https://example.org')
Select metrics by token
check = updownio.service('checks').metrics(token = 'xxxx',
params = {'from': '2022-12-16 15:11:17 +0100',
'to': '2023-01-16 15:11:17 +0100',
'group': 'host'})
or by URL
check = updownio.service('checks').metrics(url = 'https://example.org')
check = updownio.service('checks').add('https://example.org',
data = {'apdex_t': 2.0,
'disabled_locations': ['fra', 'syd'],
'period': 3600,
'recipients': ['email:xxxxxxxx', 'slack:xxxxxxxx']})
Select check by token
check = updownio.service('checks').update(token = 'xxxx',
data = {'apdex_t': 1.0,
'disabled_locations': ['fra', 'syd'],
'recipients': ['email:xxxxxxxx', 'slack:xxxxxxxx']})
or by URL
check = updownio.service('checks').update(url = 'https://example.org',
data = {'apdex_t': 1.0,
'disabled_locations': ['fra', 'syd'],
'recipients': ['email:xxxxxxxx', 'slack:xxxxxxxx']})
Select check by token
updownio.service('checks').delete(token = 'xxxx')
or by URL
updownio.service('checks').delete(url = 'https://example.org')
nodes = updownio.service('nodes').list()
nodes = updownio.service('nodes').ipv4()
nodes = updownio.service('nodes').ipv6()
recipients = updownio.service('recipients').list()
recipients = updownio.service('recipients').add(xtype = 'email',
value = 'xxxxxxxx',
data = {'selected': True})
updownio.service('recipients').delete(xid = 'email:xxxxxxxx')
status_pages = updownio.service('status_pages').list()
status_page = updownio.service('status_pages').add(['xxxx', 'yyyy', 'zzzz'],
data = {'name': 'foo',
'description': 'bar'})
status_page = updownio.service('status_pages').update(token = 'xxxx',
data = {'checks': ['xxxx', 'zzzz'],
'name': 'spam',
'description': 'ham'})
updownio.service('status_pages').delete(token = 'xxxx')