Skip to content
This repository was archived by the owner on Jul 23, 2018. It is now read-only.

Commit 381d721

Browse files
committed
Refs #23. handle /healthz endpoint
1 parent f74df17 commit 381d721

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

vmware_exporter/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
__version__ = "0.1.0"
1+
__version__ = "0.1.1"
22
__author__ = "Remi Verchere"
33
__license__ = "BSD 3-Clause License"

vmware_exporter/vmware_exporter.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
class VMWareMetricsResource(Resource):
3232
"""
3333
VMWare twisted ``Resource`` handling multi endpoints
34-
Only handle /metrics path
34+
Only handle /metrics and /healthz path
3535
"""
3636
isLeaf = True
3737

@@ -56,6 +56,9 @@ def render_GET(self, request):
5656
d.addCallback(self.generate_latest_target)
5757
d.addErrback(self.errback, request)
5858
return NOT_DONE_YET
59+
elif path == '/healthz':
60+
request.setResponseCode(200)
61+
return 'Server is UP'.encode()
5962
else:
6063
request.setResponseCode(404)
6164
return '404 Not Found'.encode()
@@ -430,6 +433,7 @@ def main():
430433
# Start up the server to expose the metrics.
431434
root = Resource()
432435
root.putChild(b'metrics', VMWareMetricsResource(args))
436+
root.putChild(b'healthz', VMWareMetricsResource(args))
433437

434438
factory = Site(root)
435439
print("Starting web server on port {}".format(args.port))

0 commit comments

Comments
 (0)