link: https://github.com/omegaatt36/pwrstat-exporter
Cyberpower UPS Linux daemon (pwrstat) exporter for prometheus
監控 UPS 的電池容量、狀態、輸出電壓以及負載,並提供 prometheus polling
再透過 grafana 對 prometheus 查詢進行圖形化顯示儀表板
範例輸入
The UPS information shows as following: Properties: Model Name................... CP1000PFCLCDa Firmware Number.............. CR01803BBI11 Rating Voltage............... 120 V Rating Power................. 600 Watt(1000 VA) Current UPS status: State........................ Normal Power Supply by.............. Utility Power Utility Voltage.............. 114 V Output Voltage............... 114 V Battery Capacity............. 100 % Remaining Runtime............ 35 min. Load......................... 114 Watt(19 %) Line Interaction............. None Test Result.................. Passed at 2022/09/21 20:44:29 Last Power Event............. None
/metrics
# TYPE promhttp_metric_handler_requests_total counter promhttp_metric_handler_requests_total{code="200"} 3682 promhttp_metric_handler_requests_total{code="500"} 0 promhttp_metric_handler_requests_total{code="503"} 0 # HELP ups_battery_capacity UPS battery capacity(%) # TYPE ups_battery_capacity gauge ups_battery_capacity{device="CP1000PFCLCDa"} 100 # HELP ups_in_voltage UPS Input Voltage(V): pass-> 1 non_pass -> 0 # TYPE ups_in_voltage gauge ups_in_voltage{device="CP1000PFCLCDa"} 112 # HELP ups_load UPS power load (Watt) # TYPE ups_load gauge ups_load{device="CP1000PFCLCDa"} 108 # HELP ups_out_voltage UPS Output Voltage(V): pass-> 1 non_pass -> 0 # TYPE ups_out_voltage gauge ups_out_voltage{device="CP1000PFCLCDa"} 112 # HELP ups_remaining_runtime UPS Remaining Runtime(min) # TYPE ups_remaining_runtime gauge ups_remaining_runtime{device="CP1000PFCLCDa"} 35 # HELP ups_state UPS status (1 -> Normal, 0 -> Not) # TYPE ups_state gauge ups_state{device="CP1000PFCLCDa"} 1 # HELP ups_test_result UPS Test Result # TYPE ups_test_result gauge ups_test_result{device="CP1000PFCLCDa"} 1