Status API: now use LIVE_[HOST|SERVICE]_STATUS measurments

Change-Id: I615d11b162fc197be0cb1e325ab53309a3b0b22d
This commit is contained in:
aviau 2015-05-07 19:13:18 -04:00
parent 905f4af92c
commit 2cabcedd5b
4 changed files with 17 additions and 17 deletions

View File

@ -26,7 +26,7 @@ class HostHandler(handler.Handler):
def get(self, host_name):
"""Return a host."""
cli = self.request.influxdb_client
query = ("SELECT * from HOST_STATE "
query = ("SELECT * from LIVE_HOST_STATE "
"WHERE host_name='%s' "
"GROUP BY * "
"ORDER BY time DESC "
@ -43,7 +43,7 @@ class HostHandler(handler.Handler):
cli = self.request.influxdb_client
query = influxdb_query.build_influxdb_query(
live_query,
'HOST_STATE',
'LIVE_HOST_STATE',
group_by=['host_name', 'address', 'childs', 'parents'],
order_by=['time DESC'],
limit=1

View File

@ -25,7 +25,7 @@ class ServiceHandler(handler.Handler):
def get(self, host_name, service_name):
"""Return a specific service."""
cli = self.request.influxdb_client
query = ("SELECT * from SERVICE_STATE "
query = ("SELECT * from LIVE_SERVICE_STATE "
"WHERE host_name='%s' "
"AND service_description='%s' "
"GROUP BY * "
@ -43,7 +43,7 @@ class ServiceHandler(handler.Handler):
cli = self.request.influxdb_client
query = influxdb_query.build_influxdb_query(
live_query,
'SERVICE_STATE',
'LIVE_SERVICE_STATE',
group_by=['host_name', 'service_description'],
order_by=['time DESC'],
limit=1

View File

@ -27,7 +27,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
"results": [
{
"series": [
{"name": "HOST_STATE",
{"name": "LIVE_HOST_STATE",
"tags": {"host_name": "localhost",
"address": "127.0.0.1",
"childs": '[]',
@ -50,7 +50,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
"HARD",
0]
]},
{"name": "HOST_STATE",
{"name": "LIVE_HOST_STATE",
"tags": {"host_name": "test_keystone",
"address": "127.0.0.1",
"childs": '[]',
@ -73,7 +73,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
"HARD",
0]
]},
{"name": "HOST_STATE",
{"name": "LIVE_HOST_STATE",
"tags": {"host_name": "ws-arbiter",
"address": "127.0.0.1",
"childs": '["test_keystone"]',
@ -144,7 +144,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
self.assertItemsEqual(json.loads(response.body), expected)
self.assertEqual(
httpretty.last_request().querystring['q'],
["SELECT * FROM HOST_STATE "
["SELECT * FROM LIVE_HOST_STATE "
"GROUP BY host_name, address, childs, parents "
"ORDER BY time DESC LIMIT 1"]
)
@ -155,7 +155,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
"results": [
{
"series": [
{"name": "HOST_STATE",
{"name": "LIVE_HOST_STATE",
"tags": {"host_name": "ws-arbiter",
"address": "127.0.0.1",
"childs": '["test_keystone"]',
@ -204,7 +204,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
self.assertEqual(
httpretty.last_request().querystring['q'],
["SELECT * FROM HOST_STATE WHERE host_name!='localhost' "
["SELECT * FROM LIVE_HOST_STATE WHERE host_name!='localhost' "
"AND description!='test_keystone' "
"GROUP BY host_name, address, childs, parents "
"ORDER BY time DESC "
@ -216,7 +216,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
influx_response = json.dumps(
{"results": [
{"series": [
{"name": "HOST_STATE",
{"name": "LIVE_HOST_STATE",
"tags": {"address": "localhost",
"childs": "[\"test_keystone\"]",
"parents": '["parent.com"]',
@ -258,7 +258,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
self.assertEqual(
httpretty.last_request().querystring['q'],
["SELECT * from HOST_STATE WHERE host_name='localhost'"
["SELECT * from LIVE_HOST_STATE WHERE host_name='localhost'"
" GROUP BY * "
"ORDER BY time DESC "
"LIMIT 1"]
@ -324,7 +324,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
self.assertItemsEqual(json.loads(response.body), expected)
self.assertEqual(
httpretty.last_request().querystring['q'],
["SELECT * from SERVICE_STATE "
["SELECT * from LIVE_SERVICE_STATE "
"WHERE host_name='ws-arbiter' "
"AND service_description='check-ws-arbiter' "
"GROUP BY * "

View File

@ -26,7 +26,7 @@ class TestStatusServices(functionalTest.FunctionalTest):
self.influxdb_response = json.dumps({
"results": [
{"series": [
{"name": "SERVICE_STATE",
{"name": "LIVE_SERVICE_STATE",
"tags": {"host_name": "test_keystone",
"service_description":
"Check KeyStone service."},
@ -49,7 +49,7 @@ class TestStatusServices(functionalTest.FunctionalTest):
"SOFT",
0]
]},
{"name": "SERVICE_STATE",
{"name": "LIVE_SERVICE_STATE",
"tags": {"host_name": "ws-arbiter",
"service_description": "check-ws-arbiter"},
"columns": [
@ -107,7 +107,7 @@ class TestStatusServices(functionalTest.FunctionalTest):
self.assertEqual(
httpretty.last_request().querystring['q'],
["SELECT * FROM SERVICE_STATE GROUP BY host_name,"
["SELECT * FROM LIVE_SERVICE_STATE GROUP BY host_name,"
" service_description "
"ORDER BY time DESC "
"LIMIT 1"]
@ -118,7 +118,7 @@ class TestStatusServices(functionalTest.FunctionalTest):
influxdb_response = json.dumps({
"results": [
{"series": [
{"name": "SERVICE_STATE",
{"name": "LIVE_SERVICE_STATE",
"tags": {"host_name": "test_keystone",
"service_description":
"Check KeyStone service."},