diff --git a/consul/base.py b/consul/base.py index ee6ab254..47dd6453 100755 --- a/consul/base.py +++ b/consul/base.py @@ -806,6 +806,18 @@ def force_leave(self, node): return self.agent.http.put( CB.bool(), '/v1/agent/force-leave/%s' % node) + def metrics(self, token=None): + """ + Returns dump of the metrics for the most recent finished interval + """ + params = [] + token = token or self.agent.token + if token: + params.append(('token', token)) + return self.agent.http.get( + CB.json(), '/v1/agent/metrics', + params=params) + class Service(object): def __init__(self, agent): self.agent = agent