Commit b272e69b authored by akhuziy's avatar akhuziy
Browse files

fixes in fetching nodes' info

parent 07c57cda
...@@ -8,12 +8,13 @@ from . import metrics ...@@ -8,12 +8,13 @@ from . import metrics
m_node = conf.measurements["node"] m_node = conf.measurements["node"]
def get_nodeinfo_query(node_id): def get_nodeinfo_query(node_id, t_start, t_end):
random_field = metrics.metrics_node["sockets"]["dbname"] random_field = metrics.metrics_node["sockets"]["dbname"]
query = ( query = (
'SELECT last({:s}), * FROM "{:s}" ' 'SELECT last({:s}), * FROM "{:s}" '
'WHERE "host" = \'{:s}\' GROUP BY "host";' 'WHERE time >= {:d}s AND time <= {:d}s AND '
).format(random_field, m_node, node_id) '"host" = \'{:s}\' GROUP BY "host";'
).format(random_field, m_node, t_start, t_end, node_id)
return query return query
def get_query_max_of_node(node_id, msrmnt, metric, metric_db, t_start, t_end): def get_query_max_of_node(node_id, msrmnt, metric, metric_db, t_start, t_end):
...@@ -38,7 +39,7 @@ def get_node_queries(nodes, t_start, t_end): ...@@ -38,7 +39,7 @@ def get_node_queries(nodes, t_start, t_end):
queries = "" queries = ""
for n in nodes: for n in nodes:
q = get_nodeinfo_query(n) q = get_nodeinfo_query(n, t_start, t_end)
queries += q queries += q
for m, par in metrics.metrics_node.items(): for m, par in metrics.metrics_node.items():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment