summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2022-03-26 19:58:59 +0300
committerMaxim Devaev <[email protected]>2022-03-26 19:58:59 +0300
commit9a19be92a0ae75c5d7c4f7ab5fc933cacc4b1f73 (patch)
treee25243d95dd6105605eb959c27b368bbabacfe50
parent6922f70dcddc610cf6bd9cfa174691e6b8524be4 (diff)
export fan state to prometheus
-rw-r--r--kvmd/apps/kvmd/api/export.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/kvmd/apps/kvmd/api/export.py b/kvmd/apps/kvmd/api/export.py
index e5ab1564..91031056 100644
--- a/kvmd/apps/kvmd/api/export.py
+++ b/kvmd/apps/kvmd/api/export.py
@@ -50,9 +50,10 @@ class ExportApi:
@exposed_http("GET", "/export/prometheus/metrics")
async def __prometheus_metrics_handler(self, _: Request) -> Response:
- (atx_state, hw_state, gpio_state) = await asyncio.gather(*[
+ (atx_state, hw_state, fan_state, gpio_state) = await asyncio.gather(*[
self.__atx.get_state(),
self.__info_manager.get_submanager("hw").get_state(),
+ self.__info_manager.get_submanager("fan").get_state(),
self.__user_gpio.get_state(),
])
rows: List[str] = []
@@ -65,8 +66,8 @@ class ExportApi:
for key in ["online", "state"]:
self.__append_prometheus_rows(rows, ch_state["state"], f"pikvm_gpio_{mode}_{key}_{channel}")
- if hw_state is not None:
- self.__append_prometheus_rows(rows, hw_state["health"], "pikvm_hw")
+ self.__append_prometheus_rows(rows, hw_state["health"], "pikvm_hw")
+ self.__append_prometheus_rows(rows, fan_state, "pikvm_fan")
return Response(text="\n".join(rows))