sbrudenell / sb8200_exporter

A prometheus exporter for the Arris SB8200
MIT License
4 stars 9 forks source link

State should be metrics, not dimensions #4

Closed jakajancar closed 5 years ago

jakajancar commented 5 years ago

Let's say I want to create a dashboard panel for "Connectivity state". The value should be:

a) null => no data (no color and/or missing data point, e.g. cannot connect to modem) b) 0 => not connected (red and/or data point at zero) c) 1 => connected (green and/or data point at one)

I don't think this is currently queryable. Using the metric sb8200_state{acquire_downstream_channel_comment="Locked"}, there is no distinction between (a) and (b) - both are the same.

I would suggest adding the metrics:

Alternatively, a somewhat more generic solution:

What do you think?

sbrudenell commented 5 years ago

I think there's a strong incentive to minimize the logic in the exporter. We're scraping HTML, not an API, and it's already subtly changed since I originally wrote this code (I guess my modem downloads some firmware updates from Comcast at boot time?). When the HTML changes, it seems nicer to only need to update my dashboard, rather than need to update both my dashboard and the exporter code.

For what it's worth: my approach was to treat all these state values as very black-box. I don't know what "acquire downstream channel = locked" really means, or whether it's sufficient to mean the modem is up. What I really want is just to know when anything changes. So it's sufficient for me to have a grafana panel that just graphs sb8200_state, with fill enabled. When state changes, the labels change, and grafana treats it as a new series and gives it a new color. This clearly shows me when the state changed, and hover shows what the state was at any given time.

jakajancar commented 5 years ago

Do I get this right?

Seems pretty unreadable to me, but I guess it's good in capturing all changes.

jakajancar commented 5 years ago

Managed to avoid the original problem by using e.g.:

sb8200_state{acquire_downstream_channel_comment="Locked"} or sb8200_state*0

this way the metric is correctly 1, 0 or null.