Skip to content

Commit 5b24bda

Browse files
authored
Merge pull request #164 from Helene/sensorsconfig
Add sensorsconfig endpoint
2 parents 09affe2 + a6ef67c commit 5b24bda

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

source/opentsdb.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,12 @@ def GET(self, **params):
294294
resp = self.md.update()
295295
# resp = json.dumps(resp)
296296

297+
# /sensorsconfig
298+
elif '/sensorsconfig' == cherrypy.request.script_name:
299+
# cherrypy.response.headers['Content-Type'] = 'application/json'
300+
resp = self.md.SensorsConfig
301+
# resp = json.dumps(resp)
302+
297303
elif 'aggregators' in cherrypy.request.script_name:
298304
resp = ["noop", "sum", "avg", "max", "min", "rate"]
299305

source/prometheus.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ def GET(self, **params):
153153
# cherrypy.response.headers['Content-Type'] = 'application/json'
154154
resp = self.md.update()
155155

156+
# /sensorsconfig
157+
elif '/sensorsconfig' == cherrypy.request.script_name:
158+
# cherrypy.response.headers['Content-Type'] = 'application/json'
159+
resp = self.md.SensorsConfig
160+
156161
elif self.endpoints and self.endpoints.get(cherrypy.request.script_name,
157162
None):
158163
sensor = self.endpoints[cherrypy.request.script_name]

source/zimonGrafanaIntf.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,12 @@ def main(argv):
258258
{'request.dispatch': cherrypy.dispatch.MethodDispatcher()}
259259
}
260260
)
261+
# query for list configured zimon sensors
262+
cherrypy.tree.mount(api, '/sensorsconfig',
263+
{'/':
264+
{'request.dispatch': cherrypy.dispatch.MethodDispatcher()}
265+
}
266+
)
261267
# query for list of aggregators (openTSDB)
262268
cherrypy.tree.mount(api, '/api/aggregators',
263269
{'/':
@@ -287,6 +293,12 @@ def main(argv):
287293
{'request.dispatch': cherrypy.dispatch.MethodDispatcher()}
288294
}
289295
)
296+
# query for list configured zimon sensors
297+
cherrypy.tree.mount(api, '/sensorsconfig',
298+
{'/':
299+
{'request.dispatch': cherrypy.dispatch.MethodDispatcher()}
300+
}
301+
)
290302
# query for all metrics (PrometheusExporter)
291303
cherrypy.tree.mount(exporter, '/metrics',
292304
{'/':

0 commit comments

Comments
 (0)