{"action":"created","issue":{"url":"https://api.github.com/repos/cablehead/python-consul/issues/24","labels_url":"https://api.github.com/repos/cablehead/python-consul/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/cablehead/python-consul/issues/24/comments","events_url":"https://api.github.com/repos/cablehead/python-consul/issues/24/events","html_url":"https://github.com/cablehead/python-consul/issues/24","id":59856063,"number":24,"title":"Unable to pull all service health","user":{"login":"pete0emerson","id":296757,"avatar_url":"https://avatars.githubusercontent.com/u/296757?v=3","gravatar_id":"","url":"https://api.github.com/users/pete0emerson","html_url":"https://github.com/pete0emerson","followers_url":"https://api.github.com/users/pete0emerson/followers","following_url":"https://api.github.com/users/pete0emerson/following{/other_user}","gists_url":"https://api.github.com/users/pete0emerson/gists{/gist_id}","starred_url":"https://api.github.com/users/pete0emerson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pete0emerson/subscriptions","organizations_url":"https://api.github.com/users/pete0emerson/orgs","repos_url":"https://api.github.com/users/pete0emerson/repos","events_url":"https://api.github.com/users/pete0emerson/events{/privacy}","received_events_url":"https://api.github.com/users/pete0emerson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-03-04T20:22:40Z","updated_at":"2015-03-04T22:04:08Z","closed_at":null,"body":"With Consul.Health.service() I can pull the current health of a specified service. I'd like to be able to pull the current health of *all* services. This is how I do it with the consul CLI:\r\n\r\nconsul watch -type=checks cat\r\n\r\nLike the current Health.service(), I need to use an index so that I can continually pull changes to the health checks. It looks like this is not possible with Consul.Health.service(), and I don't see how to do it with any of the other classes. "},"comment":{"url":"https://api.github.com/repos/cablehead/python-consul/issues/comments/77259907","html_url":"https://github.com/cablehead/python-consul/issues/24#issuecomment-77259907","issue_url":"https://api.github.com/repos/cablehead/python-consul/issues/24","id":77259907,"user":{"login":"pete0emerson","id":296757,"avatar_url":"https://avatars.githubusercontent.com/u/296757?v=3","gravatar_id":"","url":"https://api.github.com/users/pete0emerson","html_url":"https://github.com/pete0emerson","followers_url":"https://api.github.com/users/pete0emerson/followers","following_url":"https://api.github.com/users/pete0emerson/following{/other_user}","gists_url":"https://api.github.com/users/pete0emerson/gists{/gist_id}","starred_url":"https://api.github.com/users/pete0emerson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pete0emerson/subscriptions","organizations_url":"https://api.github.com/users/pete0emerson/orgs","repos_url":"https://api.github.com/users/pete0emerson/repos","events_url":"https://api.github.com/users/pete0emerson/events{/privacy}","received_events_url":"https://api.github.com/users/pete0emerson/received_events","type":"User","site_admin":false},"created_at":"2015-03-04T22:04:08Z","updated_at":"2015-03-04T22:04:08Z","body":"This seems to be working for me ... I'll try to write some tests for it next.\r\n\r\n```python\r\n        def state(self, name, index=None):\r\n            \"\"\"\r\n\r\n            Returns a tuple of (*index*, *nodes*)\r\n\r\n            *name* is a supported state. From the Consul docs:\r\n\r\n                The supported states are any, unknown, passing, warning, or\r\n                critical. The any state is a wildcard that can be used to return\r\n                all checks.\r\n\r\n            *index* is the current Consul index, suitable for making subsequent\r\n            calls to wait for changes since this query was last run.\r\n\r\n            *nodes* are the nodes providing the given service.\r\n\r\n            \"\"\"\r\n            params = {}\r\n            if index:\r\n                params['index'] = index\r\n            def callback(response):\r\n                data = json.loads(response.body)\r\n                return response.headers['X-Consul-Index'], data\r\n\r\n            return self.agent.http.get(\r\n                callback,\r\n                '/v1/health/state/%s' % name, params=params)\r\n```"}}