mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-30 17:41:54 +08:00
new events model
This commit is contained in:
@@ -55,10 +55,9 @@ class ExportApi:
|
||||
|
||||
@async_lru.alru_cache(maxsize=1, ttl=5)
|
||||
async def __get_prometheus_metrics(self) -> str:
|
||||
(atx_state, hw_state, fan_state, gpio_state) = await asyncio.gather(*[
|
||||
(atx_state, info_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.__info_manager.get_state(["hw", "fan"]),
|
||||
self.__user_gpio.get_state(),
|
||||
])
|
||||
rows: list[str] = []
|
||||
@@ -72,8 +71,8 @@ class ExportApi:
|
||||
for key in ["online", "state"]:
|
||||
self.__append_prometheus_rows(rows, ch_state["state"], f"pikvm_gpio_{mode}_{key}_{channel}")
|
||||
|
||||
self.__append_prometheus_rows(rows, hw_state["health"], "pikvm_hw") # type: ignore
|
||||
self.__append_prometheus_rows(rows, fan_state, "pikvm_fan")
|
||||
self.__append_prometheus_rows(rows, info_state["hw"]["health"], "pikvm_hw") # type: ignore
|
||||
self.__append_prometheus_rows(rows, info_state["fan"], "pikvm_fan")
|
||||
|
||||
return "\n".join(rows)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user