Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignoremetrics: add feature to ignore Values returned by modbus device #32

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

bastischubert
Copy link
Collaborator

Devices like CMS700 from ABB send Error codes as Values which break monotonicity for counters.

Example:
Watt Hours should only be increasing in a normal rate. CMS 700 sends out 4.294.934.512 Wh if the sensor has not yet returned data, which can result in sudden GWh consumtion within the scrape interval if you use a "increase()" on that metric.

@RichiH
Copy link
Owner

RichiH commented Aug 22, 2022

That will make the sensor disappear from the scrape though, correct?

Wouldn't it be better to force the value to be 0 in this case?

@bastischubert
Copy link
Collaborator Author

That will raise an error which is handled "upwards" and only return an error for that scrape:

./modbus_exporter  -config.file modbus_ignored.yml 
INFO[0000] Loading configuration file modbus_ignored.yml  source="modbus_exporter.go:49"
INFO[0000] telemetry metrics at: :9602                   source="modbus_exporter.go:56"
INFO[0000] Modbus metrics at: :9602                      source="modbus_exporter.go:64"
INFO[0003] got scrape request for module 'F454-L3-watthours' target '172.26.4.11:8001' and sub_target '2'  source="modbus_exporter.go:98"
ERRO[0003] failed to scrape metrics for module 'F454-L3-watthours': metric 'watt_hours', address '38992': ignored value returned as value: value is 1 - TestValue  source="modbus_exporter.go:113"

Returning a 0 value instead would break the monotonicity for counters (eg. you have 4000 kwh consumed, drop to 0 for one errornous scrape and than be on 4001 on the next scrape. increase() would return "increased by 4001" instead of just one)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants