Ad Widget

Collapse

Modbus question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hello There
    Member
    • Feb 2018
    • 30

    #1

    Modbus question

    Hello all,

    is there anybody who knows how to work with Modbus devices? Recently we received one but I have no idea how to make it work.

    I already tried to follow this https://www.zabbix.com/cz/integrations/modbus but no joy.

    I installed Zabbix Agent 2 on the server as a requirement, stopped Zabbix Agent(1), and verified that Zabbix Agent 2 is running. Then I edited zabbix_agent2.conf:
    Code:
    Server=192.168.1.20
    ServerActive=192.168.1.20
    Hostname=Zabbix server
    Plugins.Modbus.Sessions.MB1.Endpoint=tcp://192.168.1.20:502
    Plugins.Modbus.Sessions.MB1.SlaveID=1
    Plugins.Modbus.Sessions.MB1.Timeout=5
    After that, I restarted the Zabbix Agent 2 service. I created a new host with IP address 192.168.1.50 and left the default port 10050. But Zabbix says:
    Get value from agent failed: cannot connect to [[192.168.1.50]:10050]: [111] Connection refused

    Also I am not sure how to configure an item. What is the correct Type (Zabbix Agent, Simple check, etc) and Key?

    Zabbix version: 5.0
    Zabbix server: 192.168.1.20
    Modbus device: 192.168.1.50

    Thank you.
    Last edited by Hello There; 22-09-2022, 14:15.
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    Item type is "Zabbix agent", I guess "zabbix agent active" also works..

    There is basically one key to be used with needed parameters, some of which can be defined in plugin config..... All described on that same page you already linked here...

    Supported keys


    modbus.get[endpoint,slaveid,function,address,count,type,endia nness,offset] — receive value from modbus device Params:
    • endpoint — tcp or rtu connection string. tcp://localhost:511 rtu://COM1:9600:8n1
    • slaveid — Modbus address of the device. Optional.
    • function — 1,2,3,4 modbus read functions. Optional.
    • address — Address of first registry , coil or input. Default 00001. Optional.
    • count — count of number for return. Default 1. Optional.
    • type — acceptable values: bit, int8, uint8, uint16, int16, uint32, int32, float, uint64 and double. Default bit or uint8. Optional.
    • endianness — acceptable values: be, le, mbe, mle. Optional.
    • offset — Number of registers or bits, starting from 'address', the result of which will be discarded. Optional. Returns: Array of numbers in JSON format.

    something is off if the data you provide... you say your device has IP 192.168.1.50 so that you should define as endpoint in plugin config...
    that "Get value from agent failed: cannot connect to [[192.168.1.50]:10050]: [111] Connection refused" looks like you defined a host with IP 192.168.1.50 and tried to connect directly to that as to agent...eventho you claim to create a host with ip ending with 1.20... which is also your zabbix server ...

    Comment

    • Hello There
      Member
      • Feb 2018
      • 30

      #3
      You are right, there was a typo...

      I also specified the Zabbix server IP address in zabbix_agent2.conf (Plugins.Modbus.Sessions.MB1.Endpoint=tcp://192.168.1.20:502)... I guess I have to specify the Modbus IP address instead?

      Anyway even if I change it and use Zabbix Agent, I still get Unsupported item key.

      We have Zabbix 5.0... I believe it shouldn't be a problem since I found discussions/articles where people poll Modbus data from older releases... But maybe the configuration and syntax are different?

      I tried to use Zabbix Agent and this key modbus_read[{HOST.IP},{$MODBUSID},00001,3,f,0] but I wasn't successful.

      Comment

      • nczaw
        Member
        • Sep 2023
        • 31

        #4
        i also faced same issue. anyone have some solution ?

        Comment

        Working...