Ad Widget

Collapse

modbus - Translate two 16-bit registers to one 32-bit (float) value?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rfHazard
    Junior Member
    • Nov 2023
    • 4

    #1

    modbus - Translate two 16-bit registers to one 32-bit (float) value?

    We have some RTUs that store values as described by the manufacturer:
    The values of all sensors are in IEEE 32-bit Floating Point Little Endian byte-swapped format. For this reason, two 16-bit registers are used to represent the value of each sensor. The format is IEEE 32-bit Floating Point Little Endian with byte-swapped (the order of bytes is 3,4,1,2)​
    An example of a successful retrieval of a specific stored value:
    Click image for larger version

Name:	modbus snap.png
Views:	410
Size:	30.4 KB
ID:	474844
    Has anyone successfully retrieved values with this format? If so, can you share your solution? I've been through the modbus.get documentation and it's not clear to me if it supports this case directly. That hasn't stopped me from trying to use it anyways, but I haven't found a successful combination of parameters.
  • Hamardaban
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2019
    • 2713

    #2
    I think it is supported and you need to use this parameter:

    endianness
    Modbus endianness for 32bit/64bit datatypes:
    0 or MLE - for MODBUS_MLE_CDAB (Mid-Little Endian (CDAB))​

    More examples- https://github.com/v-zhuravlev/libzbxmodbus

    Comment

    • rfHazard
      Junior Member
      • Nov 2023
      • 4

      #3
      I tried installing the loadable module you referenced, which looks like it hasn't been updated in awhile. The latest Zabbix version it can be compiled to is 3.2 and we're running 7alpha8. There appears to have been at least one change big enough to cause a conflict, Agent wouldn't start after I added the prescribed references to the agent .conf.

      It would be nice if this would work with the Modbus plugin packaged with Agent2 (https://www.zabbix.com/integrations/modbus). The documentation on this is a little lighter than the libzbxmodbus module; I want to believe it's possible but entering the parameters I would expect to work is not returning the expected values.

      Comment

      • Hamardaban
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • May 2019
        • 2713

        #4
        I don't suggest using that module ! All long ago moved native to agent2!
        But since this module was used in agent2 plugin, the following link describes the parameters in more detail and there are examples of use.

        Comment

        • rfHazard
          Junior Member
          • Nov 2023
          • 4

          #5
          Ahhhh I misunderstood your original reply.

          So after reading the documentation and going through several iterations, I've found using the following parameters:
          modbus.get[$endpoint,0,,30012,1,float,,0]

          without specifying a function code or endianness, is returning an expected value... sometimes. I set up a quick script to poll the device once a second, and I *think* what's happening is a value is only returned by zabbix_get:modbus.get when it has changed. Otherwise it's returning 0. The other modbus poller used for testing is not exhibiting the same behavior, so I don't think this is happening on the RTU side.

          zabbix_get -s localhost -p localport -k modbus.get[$endpoint,0,,30012,1,float,,0] @ 14:59:37
          0.000000
          ...
          zabbix_get -s localhost -p localport -k modbus.get[$endpoint,0,,30012,1,float,,0] @ 14:59:39
          76.026001
          zabbix_get -s localhost -p localport -k modbus.get[$endpoint,0,,30012,1,float,,0] @ 14:59:40
          0.000000
          ...
          zabbix_get -s localhost -p localport -k modbus.get[$endpoint,0,,30012,1,float,,0] @ 14:59:44
          76.617554
          zabbix_get -s localhost -p localport -k modbus.get[$endpoint,0,,30012,1,float,,0] @ 14:59:45
          0.000000
          ...
          zabbix_get -s localhost -p localport -k modbus.get[$endpoint,0,,30012,1,float,,0] @ 14:59:51
          76.587036
          (repeated 0 replies removed for brevity)​

          I don't see anything in the zabbix_server.conf or zabbix_agent2.conf or modbus.conf configs that suggest I can influence this behavior. I'm not seeing any errors recorded in the server or agent2 log files. Is it possible I'm missing a "checkbox" somewhere?

          Comment

          Working...