Ad Widget

Collapse

protocol request info

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AlBoPo
    Junior Member
    • Aug 2018
    • 23

    #1

    protocol request info

    Hello,

    When we use JSON protocol, we have to give a request information such as "proxy data", "sender data", "agent data".

    I don't understand why Zabbix has to know what kind of remote process sent the data.

    Could you please enlight me please? What is the consequence on Zabbix server side?
  • kloczek
    Senior Member
    • Jun 2006
    • 1771

    #2
    JSON it is not protocol but format/notation of the data + desrition.
    https://en.wikipedia.org/wiki/JSON
    http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
    https://kloczek.wordpress.com/
    zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
    My zabbix templates https://github.com/kloczek/zabbix-templates

    Comment

    • AlBoPo
      Junior Member
      • Aug 2018
      • 23

      #3
      Ok thanks for this precision but my question was more about the meaning given by request info to better understand how it works.

      Comment

      • kloczek
        Senior Member
        • Jun 2006
        • 1771

        #4
        How it works .. what exactly?
        You question have still missing few bits and by this is not possible to figure out about what exactly you are asking.
        http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
        https://kloczek.wordpress.com/
        zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
        My zabbix templates https://github.com/kloczek/zabbix-templates

        Comment

        • AlBoPo
          Junior Member
          • Aug 2018
          • 23

          #5
          Because I tried to send data from a simple custom zabbix agent, and it fails so I suppose I don't understand what these request info exactly mean.

          For a precise example,, I declared a host and an item like this in Zabbix: https://i.imgur.com/qgucGxj.png

          Then my custom agent sends the follwing JSON request which seems to be correct according to the doc:

          AVB[12547]: Send JSON string {"request":"agent data","data":[{"host":"LL709601401410","key":"heartbeat","val ue" :1,"clock":1534953473,"ns":564379000}]}

          And I receive:

          AVB[12547]: Received JSON string {"response":"success","info":"processed: 0; failed: 1; total: 1; seconds spent: 0.000026"}


          And I really cannot figure out what's wrong.

          Do I have to use 'agent data', 'sender data', 'proxy data'?

          How can I explore more precisely what failed? I cannot see anything in zabbix_server.log
          Last edited by AlBoPo; 22-08-2018, 18:49.

          Comment

          • kloczek
            Senior Member
            • Jun 2006
            • 1771

            #6
            You said that you are trying to send some "simple custom zabbix agent" (whatever it means) then you showing some screenshot from web frontend.
            If it is some problem on agent side you should check agent logs.

            Then you've mention again about your "custom agent".
            I have no idea about what kind of "custom agent" you are trying to tell and what exactly you are trying to do or archive (zero details about this so far).

            And I really cannot figure out what's wrong.
            And probably no one is able to figure out what exactly you are doing.
            http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
            https://kloczek.wordpress.com/
            zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
            My zabbix templates https://github.com/kloczek/zabbix-templates

            Comment

            • DmitryL
              Senior Member
              Zabbix Certified SpecialistZabbix Certified Professional
              • May 2016
              • 278

              #7
              I guess he is simply trying to push JSON to server without actual agent installed on the machine.
              If that is true, then everything is correct - except a typo in "val ue" :1

              Comment

              • AlBoPo
                Junior Member
                • Aug 2018
                • 23

                #8
                The screenshot shows what I've configured on Zabbix server.

                Then because I cannot find any ready made zabbix agent for my target, I wrote a C program supposed to mimic a zabbix agent based on the info found here (https://www.zabbix.com/documentation.../activepassive)

                This C program sends the following request:

                {"request":"agent data","data":[{"host":"LL709601401410","key":"heartbeat","val ue" :1,"clock":1534953473,"ns":564379000}]}

                As Zabbix answered {"response":"success","info":"processed: 0; failed: 1; total: 1; seconds spent: 0.000026"}, I can suppose it well receive the request but that something is anyway not well formatted or I don't use the right request .... etc

                The screenshot about my zabbix configuration may help to guess what's wrong for some experienced zabbix user....
                Last edited by AlBoPo; 23-08-2018, 11:49.

                Comment

                • AlBoPo
                  Junior Member
                  • Aug 2018
                  • 23

                  #9
                  DmitryL it's exactly this
                  and 'val ue' is a typo in the post, not in the program.

                  And strangely, I cannot fix it....

                  Comment

                  • kloczek
                    Senior Member
                    • Jun 2006
                    • 1771

                    #10
                    If you able to read/understand/write C code you can always have look on current agent implementation (despite this typo in json str)
                    http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
                    https://kloczek.wordpress.com/
                    zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
                    My zabbix templates https://github.com/kloczek/zabbix-templates

                    Comment

                    • DmitryL
                      Senior Member
                      Zabbix Certified SpecialistZabbix Certified Professional
                      • May 2016
                      • 278

                      #11
                      Code:
                      [root@localhost ~]# telnet 192.168.56.101 10051
                      Trying 192.168.56.101...
                      Connected to 192.168.56.101.
                      Escape character is '^]'.
                      {"request":"agent data","data":[{"host":"test","key":"test","value" :1,"clock":1534953473,"ns":564379000}]}
                      ZBXDZ{"response":"success","info":"processed: 1; failed: 0; total: 1; seconds spent: 0.000033"}Connection closed by foreign host.
                      Try to increase debug level on Zabbix server for trapper and check the logs.
                      Or try to send it simply through telnet without C script.
                      Such errors usually appear when hostname/key don't match the one configured in frontend.

                      Comment

                      • AlBoPo
                        Junior Member
                        • Aug 2018
                        • 23

                        #12
                        hmm yes didn't think about that , I download the sources

                        Comment

                        • AlBoPo
                          Junior Member
                          • Aug 2018
                          • 23

                          #13
                          I get the same error by telnet also

                          Comment

                          • DmitryL
                            Senior Member
                            Zabbix Certified SpecialistZabbix Certified Professional
                            • May 2016
                            • 278

                            #14
                            From screenshot it looks like your host is monitored via Zabbix proxy.
                            To which process you try to send data? Proxy or Server?

                            Comment

                            • AlBoPo
                              Junior Member
                              • Aug 2018
                              • 23

                              #15
                              I tried to set debug to level 4, and then send my request with telnet:

                              Here is what I can see in the log:

                              2731:20180823:131255.544 trapper got '{"request":"agent data","data":[{"host":"LL709601401410","key":"heartbeat","value" :1,"clock":1534953473,"ns":564379000}]}'
                              2731:20180823:131255.544 In recv_agenthistory()
                              2731:20180823:131255.544 In process_client_history_data()
                              2731:20180823:131255.544 In parse_history_data()
                              2731:20180823:131255.544 End of parse_history_data():SUCCEED processed:1/1
                              2731:20180823:131255.544 In process_history_data()
                              2731:20180823:131255.544 End of process_history_data() processed:0
                              2731:20180823:131255.544 End of process_client_history_data():SUCCEED
                              2731:20180823:131255.544 In zbx_send_response()
                              2731:20180823:131255.544 zbx_send_response() '{"response":"success","info":"processed: 0; failed: 1; total: 1; seconds spent: 0.000221"}'
                              2731:20180823:131255.544 End of zbx_send_response():SUCCEED

                              And so? Does it tell you something?

                              Comment

                              Working...