Status API: now use LIVE_[HOST|SERVICE]_STATUS measurments
Change-Id: I615d11b162fc197be0cb1e325ab53309a3b0b22d
This commit is contained in:
parent
905f4af92c
commit
2cabcedd5b
@ -26,7 +26,7 @@ class HostHandler(handler.Handler):
|
|||||||
def get(self, host_name):
|
def get(self, host_name):
|
||||||
"""Return a host."""
|
"""Return a host."""
|
||||||
cli = self.request.influxdb_client
|
cli = self.request.influxdb_client
|
||||||
query = ("SELECT * from HOST_STATE "
|
query = ("SELECT * from LIVE_HOST_STATE "
|
||||||
"WHERE host_name='%s' "
|
"WHERE host_name='%s' "
|
||||||
"GROUP BY * "
|
"GROUP BY * "
|
||||||
"ORDER BY time DESC "
|
"ORDER BY time DESC "
|
||||||
@ -43,7 +43,7 @@ class HostHandler(handler.Handler):
|
|||||||
cli = self.request.influxdb_client
|
cli = self.request.influxdb_client
|
||||||
query = influxdb_query.build_influxdb_query(
|
query = influxdb_query.build_influxdb_query(
|
||||||
live_query,
|
live_query,
|
||||||
'HOST_STATE',
|
'LIVE_HOST_STATE',
|
||||||
group_by=['host_name', 'address', 'childs', 'parents'],
|
group_by=['host_name', 'address', 'childs', 'parents'],
|
||||||
order_by=['time DESC'],
|
order_by=['time DESC'],
|
||||||
limit=1
|
limit=1
|
||||||
|
@ -25,7 +25,7 @@ class ServiceHandler(handler.Handler):
|
|||||||
def get(self, host_name, service_name):
|
def get(self, host_name, service_name):
|
||||||
"""Return a specific service."""
|
"""Return a specific service."""
|
||||||
cli = self.request.influxdb_client
|
cli = self.request.influxdb_client
|
||||||
query = ("SELECT * from SERVICE_STATE "
|
query = ("SELECT * from LIVE_SERVICE_STATE "
|
||||||
"WHERE host_name='%s' "
|
"WHERE host_name='%s' "
|
||||||
"AND service_description='%s' "
|
"AND service_description='%s' "
|
||||||
"GROUP BY * "
|
"GROUP BY * "
|
||||||
@ -43,7 +43,7 @@ class ServiceHandler(handler.Handler):
|
|||||||
cli = self.request.influxdb_client
|
cli = self.request.influxdb_client
|
||||||
query = influxdb_query.build_influxdb_query(
|
query = influxdb_query.build_influxdb_query(
|
||||||
live_query,
|
live_query,
|
||||||
'SERVICE_STATE',
|
'LIVE_SERVICE_STATE',
|
||||||
group_by=['host_name', 'service_description'],
|
group_by=['host_name', 'service_description'],
|
||||||
order_by=['time DESC'],
|
order_by=['time DESC'],
|
||||||
limit=1
|
limit=1
|
||||||
|
@ -27,7 +27,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
|
|||||||
"results": [
|
"results": [
|
||||||
{
|
{
|
||||||
"series": [
|
"series": [
|
||||||
{"name": "HOST_STATE",
|
{"name": "LIVE_HOST_STATE",
|
||||||
"tags": {"host_name": "localhost",
|
"tags": {"host_name": "localhost",
|
||||||
"address": "127.0.0.1",
|
"address": "127.0.0.1",
|
||||||
"childs": '[]',
|
"childs": '[]',
|
||||||
@ -50,7 +50,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
|
|||||||
"HARD",
|
"HARD",
|
||||||
0]
|
0]
|
||||||
]},
|
]},
|
||||||
{"name": "HOST_STATE",
|
{"name": "LIVE_HOST_STATE",
|
||||||
"tags": {"host_name": "test_keystone",
|
"tags": {"host_name": "test_keystone",
|
||||||
"address": "127.0.0.1",
|
"address": "127.0.0.1",
|
||||||
"childs": '[]',
|
"childs": '[]',
|
||||||
@ -73,7 +73,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
|
|||||||
"HARD",
|
"HARD",
|
||||||
0]
|
0]
|
||||||
]},
|
]},
|
||||||
{"name": "HOST_STATE",
|
{"name": "LIVE_HOST_STATE",
|
||||||
"tags": {"host_name": "ws-arbiter",
|
"tags": {"host_name": "ws-arbiter",
|
||||||
"address": "127.0.0.1",
|
"address": "127.0.0.1",
|
||||||
"childs": '["test_keystone"]',
|
"childs": '["test_keystone"]',
|
||||||
@ -144,7 +144,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
|
|||||||
self.assertItemsEqual(json.loads(response.body), expected)
|
self.assertItemsEqual(json.loads(response.body), expected)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
httpretty.last_request().querystring['q'],
|
httpretty.last_request().querystring['q'],
|
||||||
["SELECT * FROM HOST_STATE "
|
["SELECT * FROM LIVE_HOST_STATE "
|
||||||
"GROUP BY host_name, address, childs, parents "
|
"GROUP BY host_name, address, childs, parents "
|
||||||
"ORDER BY time DESC LIMIT 1"]
|
"ORDER BY time DESC LIMIT 1"]
|
||||||
)
|
)
|
||||||
@ -155,7 +155,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
|
|||||||
"results": [
|
"results": [
|
||||||
{
|
{
|
||||||
"series": [
|
"series": [
|
||||||
{"name": "HOST_STATE",
|
{"name": "LIVE_HOST_STATE",
|
||||||
"tags": {"host_name": "ws-arbiter",
|
"tags": {"host_name": "ws-arbiter",
|
||||||
"address": "127.0.0.1",
|
"address": "127.0.0.1",
|
||||||
"childs": '["test_keystone"]',
|
"childs": '["test_keystone"]',
|
||||||
@ -204,7 +204,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
|
|||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
httpretty.last_request().querystring['q'],
|
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' "
|
"AND description!='test_keystone' "
|
||||||
"GROUP BY host_name, address, childs, parents "
|
"GROUP BY host_name, address, childs, parents "
|
||||||
"ORDER BY time DESC "
|
"ORDER BY time DESC "
|
||||||
@ -216,7 +216,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
|
|||||||
influx_response = json.dumps(
|
influx_response = json.dumps(
|
||||||
{"results": [
|
{"results": [
|
||||||
{"series": [
|
{"series": [
|
||||||
{"name": "HOST_STATE",
|
{"name": "LIVE_HOST_STATE",
|
||||||
"tags": {"address": "localhost",
|
"tags": {"address": "localhost",
|
||||||
"childs": "[\"test_keystone\"]",
|
"childs": "[\"test_keystone\"]",
|
||||||
"parents": '["parent.com"]',
|
"parents": '["parent.com"]',
|
||||||
@ -258,7 +258,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
|
|||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
httpretty.last_request().querystring['q'],
|
httpretty.last_request().querystring['q'],
|
||||||
["SELECT * from HOST_STATE WHERE host_name='localhost'"
|
["SELECT * from LIVE_HOST_STATE WHERE host_name='localhost'"
|
||||||
" GROUP BY * "
|
" GROUP BY * "
|
||||||
"ORDER BY time DESC "
|
"ORDER BY time DESC "
|
||||||
"LIMIT 1"]
|
"LIMIT 1"]
|
||||||
@ -324,7 +324,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
|
|||||||
self.assertItemsEqual(json.loads(response.body), expected)
|
self.assertItemsEqual(json.loads(response.body), expected)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
httpretty.last_request().querystring['q'],
|
httpretty.last_request().querystring['q'],
|
||||||
["SELECT * from SERVICE_STATE "
|
["SELECT * from LIVE_SERVICE_STATE "
|
||||||
"WHERE host_name='ws-arbiter' "
|
"WHERE host_name='ws-arbiter' "
|
||||||
"AND service_description='check-ws-arbiter' "
|
"AND service_description='check-ws-arbiter' "
|
||||||
"GROUP BY * "
|
"GROUP BY * "
|
||||||
|
@ -26,7 +26,7 @@ class TestStatusServices(functionalTest.FunctionalTest):
|
|||||||
self.influxdb_response = json.dumps({
|
self.influxdb_response = json.dumps({
|
||||||
"results": [
|
"results": [
|
||||||
{"series": [
|
{"series": [
|
||||||
{"name": "SERVICE_STATE",
|
{"name": "LIVE_SERVICE_STATE",
|
||||||
"tags": {"host_name": "test_keystone",
|
"tags": {"host_name": "test_keystone",
|
||||||
"service_description":
|
"service_description":
|
||||||
"Check KeyStone service."},
|
"Check KeyStone service."},
|
||||||
@ -49,7 +49,7 @@ class TestStatusServices(functionalTest.FunctionalTest):
|
|||||||
"SOFT",
|
"SOFT",
|
||||||
0]
|
0]
|
||||||
]},
|
]},
|
||||||
{"name": "SERVICE_STATE",
|
{"name": "LIVE_SERVICE_STATE",
|
||||||
"tags": {"host_name": "ws-arbiter",
|
"tags": {"host_name": "ws-arbiter",
|
||||||
"service_description": "check-ws-arbiter"},
|
"service_description": "check-ws-arbiter"},
|
||||||
"columns": [
|
"columns": [
|
||||||
@ -107,7 +107,7 @@ class TestStatusServices(functionalTest.FunctionalTest):
|
|||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
httpretty.last_request().querystring['q'],
|
httpretty.last_request().querystring['q'],
|
||||||
["SELECT * FROM SERVICE_STATE GROUP BY host_name,"
|
["SELECT * FROM LIVE_SERVICE_STATE GROUP BY host_name,"
|
||||||
" service_description "
|
" service_description "
|
||||||
"ORDER BY time DESC "
|
"ORDER BY time DESC "
|
||||||
"LIMIT 1"]
|
"LIMIT 1"]
|
||||||
@ -118,7 +118,7 @@ class TestStatusServices(functionalTest.FunctionalTest):
|
|||||||
influxdb_response = json.dumps({
|
influxdb_response = json.dumps({
|
||||||
"results": [
|
"results": [
|
||||||
{"series": [
|
{"series": [
|
||||||
{"name": "SERVICE_STATE",
|
{"name": "LIVE_SERVICE_STATE",
|
||||||
"tags": {"host_name": "test_keystone",
|
"tags": {"host_name": "test_keystone",
|
||||||
"service_description":
|
"service_description":
|
||||||
"Check KeyStone service."},
|
"Check KeyStone service."},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user