Use external list of fault states

This commit is contained in:
Joshua Boniface 2023-12-09 12:51:41 -05:00
parent 132cde5591
commit fd717b702d
2 changed files with 7 additions and 4 deletions

View File

@ -161,10 +161,9 @@ def cluster_metrics(zkhandler):
output_lines.append("# HELP pvc_cluster_faults PVC cluster new faults") output_lines.append("# HELP pvc_cluster_faults PVC cluster new faults")
output_lines.append("# TYPE pvc_cluster_faults gauge") output_lines.append("# TYPE pvc_cluster_faults gauge")
fault_map = { fault_map = dict()
"new": 0, for fault_type in pvc_common.fault_state_combinations:
"ack": 0, fault_map[fault_type] = 0
}
for fault in faults_data: for fault in faults_data:
fault_map[fault["status"]] += 1 fault_map[fault["status"]] += 1
for fault_type in fault_map: for fault_type in fault_map:

View File

@ -40,6 +40,10 @@ from functools import wraps
# State lists # State lists
fault_state_combinations = [
"new",
"ack",
]
node_state_combinations = [ node_state_combinations = [
"run,ready", "run,ready",
"run,flush", "run,flush",