Skip to content

Commit

Permalink
Shift to more label based output
Browse files Browse the repository at this point in the history
  • Loading branch information
jcpunk committed Feb 16, 2024
1 parent 43018b6 commit f0bf28e
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions storcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,10 @@
"MegaRAID CacheVault temperature",
["controller", "cvidx"], namespace=namespace, registry=registry,
),
"cv_optimal": Gauge(
"cv_optimal",
"MegaRAID CacheVault is Optimal",
["controller", "cvidx"], namespace=namespace, registry=registry,
),
"cv_degraded": Gauge(
"cv_degraded",
"MegaRAID CacheVault is Degraded",
["controller", "cvidx"], namespace=namespace, registry=registry,
),
"cv_failed": Gauge(
"cv_failed",
"MegaRAID CacheVault is Degraded",
["controller", "cvidx"], namespace=namespace, registry=registry,
"cv_state": Gauge(
"cv_state",
"MegaRAID CacheVault state",
["controller", "cvidx", "state"], namespace=namespace, registry=registry,
),
"ctrl_sched_patrol_read": Gauge(
"scheduled_patrol_read",
Expand Down Expand Up @@ -292,13 +282,13 @@ def handle_megaraid_controller(response):
cvinfo["Temp"].replace("C", "")
)
if "State" in cvinfo:
metrics["cv_optimal"].labels(controller_index, cvidx).set(
metrics["cv_state"].labels(controller_index, cvidx, "optimal").set(
cvinfo["State"] == "Optimal"
)
metrics["cv_degraded"].labels(controller_index, cvidx).set(
metrics["cv_state"].labels(controller_index, cvidx, "degraded").set(
cvinfo["State"] == "Degraded"
)
metrics["cv_failed"].labels(controller_index, cvidx).set(
metrics["cv_state"].labels(controller_index, cvidx, "failed").set(
cvinfo["State"] == "Failed"
)

Expand Down

0 comments on commit f0bf28e

Please sign in to comment.