Skip to content

Commit

Permalink
update Node Util panel location
Browse files Browse the repository at this point in the history
  • Loading branch information
hector-baez committed Nov 8, 2023
1 parent 95b3e5b commit ee1a2af
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions grafana/main/ben-dashboard-mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,24 @@ def fetch_metrics():
if line == "" or line.startswith('#') or line.startswith("ben"):
continue
nodes.append(line.split()[0])
print(nodes)

for panel in dashboard["panels"]:
try:
if(panel["title"] == "Node Utilization"):
print(nodes)
currRefId='A' #fix? shouldnt be able to reach Z. JS2 max of 25 instances
query=panel["targets"][0]
newTargets=[]
for i in range(0,len(nodes), 2):
source='_'.join(nodes[i].split("_")[0:-1])
query["expr"]=f"{nodes[i]} / {nodes[i+1]}"
query["legendFormat"]=source
query["refId"]=currRefId
currRefId=chr(ord(currRefId)+1)
newTargets.append(copy.deepcopy(query))
panel["targets"]=newTargets
if(panel["title"] == "Ben Server"):
for panel_ in panel["panels"]:
if(panel_["title"] == "Node Utilization"):
currRefId='A' #fix? shouldnt be able to reach Z. JS2 max of 25 instances
query=panel_["targets"][0]
newTargets=[]
for i in range(0,len(nodes), 2):
source='_'.join(nodes[i].split("_")[0:-1])
query["expr"]=f"{nodes[i]} / {nodes[i+1]}"
query["legendFormat"]=source
query["refId"]=currRefId
currRefId=chr(ord(currRefId)+1)
newTargets.append(copy.deepcopy(query))
panel_["targets"]=newTargets
except:
continue

Expand Down

0 comments on commit ee1a2af

Please sign in to comment.