mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-14 02:00:32 +08:00
prometheus: tidying gpio channel name
This commit is contained in:
parent
4a0029bab7
commit
cfbb6f1be7
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import re
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
@ -68,6 +69,7 @@ class ExportApi:
|
|||||||
for mode in sorted(UserGpioModes.ALL):
|
for mode in sorted(UserGpioModes.ALL):
|
||||||
for (channel, ch_state) in gpio_state["state"][f"{mode}s"].items(): # type: ignore
|
for (channel, ch_state) in gpio_state["state"][f"{mode}s"].items(): # type: ignore
|
||||||
if not channel.startswith("__"): # Hide special GPIOs
|
if not channel.startswith("__"): # Hide special GPIOs
|
||||||
|
channel = re.sub(r"[^\w]", "_", channel)
|
||||||
for key in ["online", "state"]:
|
for key in ["online", "state"]:
|
||||||
self.__append_prometheus_rows(rows, ch_state["state"], f"pikvm_gpio_{mode}_{key}_{channel}")
|
self.__append_prometheus_rows(rows, ch_state["state"], f"pikvm_gpio_{mode}_{key}_{channel}")
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user