-
Notifications
You must be signed in to change notification settings - Fork 31
/
README.txt
109 lines (81 loc) · 2.78 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
=================
PingdomLib v2.0.3
=================
Written by: Kenneth Wilke <[email protected]>
This is a python library to provide full access to the pingdom API, along with
a few additional features to make using the API easier and pythonic.
Usage examples
=================
Connecting to pingdom
---------------------
.. code-block:: python
import pingdomlib
api = pingdomlib.Pingdom(username, password, apikey)
Show all checks that are not in 'UP' status
-------------------------------------------
.. code-block:: python
# See pingdomlib.pingdom documentation to see available calls and settings
pingdomchecks = api.getChecks()
for check in pingdomchecks:
# See pingdomlib.check documentation for information on PingdomCheck class
if check.status != 'up':
print check
Creating a new check
--------------------
.. code-block:: python
newcheck = api.newCheck("New check name", "www.hostnametocheck.com")
Updating a check
----------------
.. code-block:: python
# Updates to check objects are pushed immediately to pingdom
newcheck.paused = True
Disabling change pushing for checks
-----------------------------------
.. code-block:: python
api.pushChanges = False
Get last 10 pingdom alerts sent
-------------------------------
.. code-block:: python
import datetime
for alert in api.alerts(limit=10):
time = datetime.datetime.fromtimestamp(alert['time'])
timestamp = time.strftime('%Y-%m-%d %H:%M:%S')
print "[%s] %s is %s" % (time, alert['name'], alert['status'])
Get outages for a specific check
--------------------------------
.. code-block:: python
import datetime
check = api.getCheck(227878)
for outage in check.outages():
# timestamp conversion
time_start = datetime.datetime.fromtimestamp(outage['timefrom'])
timestamp_start = time_start.strftime('%Y-%m-%d %H:%M:%S')
time_end = datetime.datetime.fromtimestamp(outage['timeto'])
timestamp_end = time_end.strftime('%Y-%m-%d %H:%M:%S')
print "%s: %s from %s to %s [%dm]" % (check.name, outage['status'],
timestamp_start, timestamp_end,
(outage['timeto'] -
outage['timefrom']) / 60)
Contributors
============
* Wil Clouser
* Ash Berlin
* Wu Jiang
* Gertjan Oude Lohuis
* Benjamin Boudreau
* Britt Gresham
* Allard Hoeve
* Willem de Groot
* Aaron Fay
* Rick van de Loo
* Oleksandr Kushchenko
* Steven Bailey
Special thanks
==============
Anders Ekman, Pingdom, for offering warm and helpful support with the API
TODO list
=========
Planned improvements
--------------------
* Optional Gzip Compression
* Improve check update process with pushChanges disabled