16 lines
483 B
Python
16 lines
483 B
Python
|
#!/usr/bin/env python3
|
||
|
|
||
|
def ratio_to_status(ratio):
|
||
|
if ratio > 0.99:
|
||
|
return "ok"
|
||
|
elif ratio > 0.8:
|
||
|
return "warning"
|
||
|
else:
|
||
|
return "critical"
|
||
|
|
||
|
def process_instance(instance):
|
||
|
return {
|
||
|
"name": instance["metric"]["instance"].split(".")[0],
|
||
|
"i": [{"status": "unknown", "ratio": None} for i in range(56 - len(instance["values"]))] + [{"status": ratio_to_status(float(i[1])), "ratio": float(i[1])} for i in instance["values"]],
|
||
|
}
|