RichiH / modbus_exporter

Exporter which retrieves stats from a modbus system and exports them via HTTP for Prometheus consumption.
Apache License 2.0
90 stars 44 forks source link

combine 2 unint16 values into one 32-bit word #79

Open stefangweichinger opened 4 days ago

stefangweichinger commented 4 days ago

Maybe I have to do that later in grafana or so.

I read 2 modbus-registers in format uint16, they are the lower and higher part of one 32-bit word.

Can the exporter already "shift" the higher word so that I can later simply add the 2 values?

"factor:" in modbus.yml seems not fit exactly, but I am not used to the needed conversion work, so maybe it's possible.

I use:

      - name: "energy_counter__ac2dc_lower"
        help: "state of charge"
        address: 31069
        dataType: uint16
        metricType: gauge

      - name: "energy_counter__ac2dc_higher"
        help: "state of charge"
        address: 31070
        dataType: uint16
        metricType: gauge

for a start ... and I get values into prometheus, that's ok.

Maybe it's more a grafana-issue: how to define the needed transformation.

Sorry if I bark up the wrong tree here ;-)