mdlayher / apcupsd_exporter

Prometheus exporter that exposes metrics from apcupsd's NIS. MIT Licensed.
MIT License
153 stars 65 forks source link

Add Status to Metrics #19

Closed crockk closed 3 years ago

crockk commented 3 years ago

Hi there,

The apcaccess command outputs STATUS, with values such as:

This would be extremely useful to know when a device switches to using the battery. I think something like this other exporter could be merged into this exporter: https://github.com/damomurf/apcupsd-exporter

I'm proposing adding this as a label in apcupsd_info so that it would look something like:

apcupsd_info{status="ONLINE", hostname="xxx", instance="xxx", job="xxx", model="xxx", ups="UnitedScaffold-SBC1"}

Using such a label would allows us to create alerts such as:

   - alert: UPSSwitchedToBattery
     expr: apcupsd_info{status="ONBATT"} == 1
crockk commented 3 years ago

Dupe of #16