1 Title: WATO Web-API: Implemented SLA API interface
12 SLA data for services can now be fetched via the Web API.
13 The new action is named <tt>get_sla</tt>.
15 The request object is structured like this:
19 "query": [ [[{sla_configuration}], [{timerange_spec_1}], [{host/service pair}]] ]
23 A query entry always consists of 3 fields.
25 <li>The list of sla_definitions</li>
26 <li>The list of timerange specificiations</li>
27 <li>The list of host/service pairs</li>
30 The sla_definition is simply the id of the configured SLA definition.
32 The timerange specification has some special syntax
35 # # Field to send in query
48 # "The last..." # "last:86400"
49 # "Time range" # "range:1530271236:1530281236"
51 # SLA configurations have no distinct timestamp. The timestamp depends on the SLA period
52 # The following example says
53 # - Start at the penultimate sla period (Note: 0 is current period)
54 # - Look back additional 4 sla periods
55 # There will be 5 period results
56 # "Sla period range" # "sla:2:4"
59 The of host/service pairs identifies the required services.
61 A valid request may look like
64 "query": [ [["sla_configuration_1"], ["w1"], [["HostA", "ServiceB"]]] ]
67 This queries the sla_configuration_1 with the timerange "Last week" for the service HostA/ServiceB.
68 This returns 1 result.
71 As you might have noticed, each field in the query is enclosed by a list.
72 That's because each query entry may have multiple values specified.
75 "query": [ [["sla_configuration_1", "sla_configuration_2"], ["w1"], [["HostA", "ServiceB"]]] ]
78 This queries the sla_configuration_1 and sla_configuration_2 with the timerange "Last week" for the service HostA/ServiceB.
79 This returns 2 results.
82 Now add an additional timerange specification
85 "query": [ [["sla_configuration_1", "sla_configuration_2"], ["w1", "w0"], [["HostA", "ServiceB"]]] ]
88 This queries the sla_configuration_1 and sla_configuration_2 with the timerange "Last week" and "This week" for the service HostA/ServiceB.
89 This returns 4 results.
93 Finally, you can also add additional triples to the query.
96 "query": [ [["sla_configuration_1"], ["w1"], [["HostA", "ServiceB"]]],
97 [["sla_configuration_2"], ["w0"], [["HostX", "ServiceY"]]] ]
100 This queries sla_configuration_1 with the timerange "Last week" for HostA/ServiceB and
101 sla_configuration_2 with the timerange "This week" for HostX/ServiceY.
105 The returned result for these queries is a python dictionary with lots of infos
107 {'mysite': {'myhost': {'CPU load':
108 {(('myhost', 'CPU load'), 'sla_configuration_1', ('sla_period_range', (0, 1)), 'weekly'):
109 {'plugin_results': [{'period_results': [{'duration': 604800.0,
111 'statistics': {'duration': {-1: 604800.0},
112 'percentage': {-1: 100.0}},
113 'subresults': [{'deviation_info': {'deviation': 0.0,
114 'deviation_state': 2,
118 'error_instances': [],
122 'sla_broken': False}],
123 'timerange': (1529272800.0,
125 {'duration': 396134.0,
127 'statistics': {'duration': {-1: 385358.0,
129 'percentage': {-1: 97.27970838150726,
130 0: 2.7202916184927326}},
131 'subresults': [{'deviation_info': {'deviation': 2.7202916184927326,
132 'deviation_state': 0,
136 'error_instances': [],
140 'sla_broken': False}],
141 'timerange': (1529877600.0,
143 'plugin_id': 'service_state_percentage',
144 'timerange_sla_duration': 1000934.0}],
145 'sla_id': 'sla_configuration_1',
146 'sla_period': 'weekly'}}}}}
148 Keep in mind that this API implementation is an initial version, so there might be interface changes within the next months.