Commit 9dce1a53 authored by litaolemo's avatar litaolemo

update

parent 0492d468
......@@ -81,9 +81,10 @@ def get_node_status(ip):
query_current = data["indices"]["search"]["query_current"]
fetch_current = data["indices"]["search"]["fetch_current"]
cpu_percent = data["os"]["cpu"]["percent"]
cpu_1m = data["os"]["cpu"]["load_average"]['1m']
cpu_5m = data["os"]["cpu"]["load_average"]['5m']
cpu_15m = data["os"]["cpu"]["load_average"]['15m']
cpu_1m = data["process"]["cpu"]["percent"]
# cpu_1m = data["os"]["cpu"]["load_average"]['1m']
# cpu_5m = data["os"]["cpu"]["load_average"]['5m']
# cpu_15m = data["os"]["cpu"]["load_average"]['15m']
young_gc = data["jvm"]["gc"]["collectors"]['young']['collection_count']
young_gc_ms = data["jvm"]["gc"]["collectors"]['young']['collection_time_in_millis']
old_gc = data["jvm"]["gc"]["collectors"]['young']['collection_count']
......@@ -91,8 +92,7 @@ def get_node_status(ip):
search_thread_pool = data["thread_pool"]["search"]
young_gc_per_ms = int(young_gc_ms/young_gc)
old_gc_ms = int(old_gc_ms/old_gc)
yield node_name, ip, query_time, query_current, fetch_current, cpu_percent, cpu_1m, cpu_5m, cpu_15m,\
young_gc_per_ms, old_gc, old_gc_ms ,search_thread_pool
yield node_name, ip, query_time, query_current, fetch_current, cpu_percent, cpu_1m, young_gc_per_ms, old_gc, old_gc_ms ,search_thread_pool
def parse_cluster_stats(data):
......@@ -109,7 +109,7 @@ def parse_cluster_stats(data):
def parse_node_stats(data):
res_str = ""
node_name, ip, query_time, query_current, fetch_current, cpu_percent, cpu_1m, cpu_5m, cpu_15m, young_gc, \
node_name, ip, query_time, query_current, fetch_current, cpu_percent, cpu_1m, young_gc, \
old_gc, old_gc_ms, search_thread_pool = data
if not data_dict.get(node_name):
data_dict[node_name] = {}
......@@ -128,11 +128,9 @@ def parse_node_stats(data):
res_str += "{name}节点 old_gc增长中 old_gc为{old_gc} 平均{old_gc_ms}ms\n".format(name=node_name, old_gc=str(old_gc),
old_gc_ms=str(old_gc_ms))
if cpu_1m >= cpu_top or cpu_5m >= cpu_top or cpu_15m >= cpu_top:
res_str += "{name}节点CPU使用率预警 1m {cpu_1m} 5m {cpu_5m} 15m {cpu_15m} \n" \
if cpu_1m >= cpu_top:
res_str += "{name}节点CPU使用率预警 1m {cpu_1m} \n" \
"目前 query_current为{query_current} fetch_current为{fetch_current} young_gc为{young_gc}ms".format(cpu_1m=str(int(cpu_1m*100))+"%",name=node_name,
cpu_5m=str(int(cpu_5m*100))+"%",
cpu_15m= str(int(cpu_15m*100))+"%",
query_current=str(query_current),fetch_current=str(fetch_current),young_gc=str(young_gc))
data_dict[node_name]['old_gc'] = old_gc
......
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