move upsstatus enum to sensors

This commit is contained in:
Alex 2024-11-09 12:48:53 +03:00
parent 47c110f83e
commit 071d8afb9f
3 changed files with 25 additions and 28 deletions

View file

@ -5,7 +5,6 @@ from datetime import timedelta
from alerting import alerts
from misc import cvars, docker_registry, sensors, vuln
from misc.disks import LVAttr
from misc.enums import UPSStatus
IS_TESTING = False
@ -126,13 +125,13 @@ async def ups_check() -> list[alerts.Alert]:
)
for status in sensor.ups_status:
if IS_TESTING or status == UPSStatus.UPS_OVERLOAD:
if IS_TESTING or status == sensors.UPSStatus.UPS_OVERLOAD:
alert_list.append(
alerts.Alert(
alert_type=alerts.AlertType.UPS, message=f"UPS is overloaded!", severity=alerts.Severity.CRITICAL
)
)
elif IS_TESTING or status == UPSStatus.ON_BATTERY:
elif IS_TESTING or status == sensors.UPSStatus.ON_BATTERY:
alert_list.append(
alerts.Alert(
alert_type=alerts.AlertType.UPS,
@ -140,7 +139,7 @@ async def ups_check() -> list[alerts.Alert]:
severity=alerts.Severity.INFO,
)
)
elif IS_TESTING or status == UPSStatus.UPS_TRIM:
elif IS_TESTING or status == sensors.UPSStatus.UPS_TRIM:
alert_list.append(
alerts.Alert(
alert_type=alerts.AlertType.UPS,
@ -148,7 +147,7 @@ async def ups_check() -> list[alerts.Alert]:
severity=alerts.Severity.INFO,
)
)
elif IS_TESTING or status == UPSStatus.UPS_BOOST:
elif IS_TESTING or status == sensors.UPSStatus.UPS_BOOST:
alert_list.append(
alerts.Alert(
alert_type=alerts.AlertType.UPS,