Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-22344

zabbix_sender.exe breaks Json passed with -o option.

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Won't fix
    • Icon: Trivial Trivial
    • None
    • 5.0.31
    • Agent (G)
    • None
    • Windows11

      I have created the following bat file.

      Unable to find source-code formatter for language: bat. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      @echo off
      setlocal
      cd /d %~dp0
      
      set ZabbixServer=ZabbixServerIP
      set Hostname=Speedtest
      set Itemkey=speedtest.json
      
      for /f "usebackq delims=" %%A in (`speedtest.exe -f json`) do set speedtestout=%%A
      
      echo %speedtestout%
      call zabbix_sender.exe -z %ZabbixServer% -s %Hostname% -k %Itemkey% -o %speedtestout%
      

      The result of echo %speedtestout% is as follows

      {"type":"result","timestamp":"2023-02-10T13:11:39Z","ping":{"jitter":0.493,"latency":7.609,"low":6.920,"high":8.576},"download":{"bandwidth":13228804,"bytes":62303424,"elapsed":4702,"latency":{"iqm":10.295,"low":5.819,"high":282.455,"jitter":28.401}},"upload":{"bandwidth":38463020,"bytes":238604274,"elapsed":6213,"latency":{"iqm":153.922,"low":7.502,"high":351.095,"jitter":52.296}},"packetLoss":0,"isp":"au one net","interface":{"internalIp":"240f:101:5a0c:1:a806:f469:a839:fe9e","name":"","macAddr":"98:FD:B4:9A:CE:AE","isVpn":false,"externalIp":"240f:101:5a0c:1:a806:f469:a839:fe9e"},"server":{"id":48463,"host":"speed.udx.icscoe.jp","port":8080,"name":"IPA CyberLab 400G","location":"Tokyo","country":"Japan","ip":"2401:5e40:1000:1112::228"},"result":{"id":"20674f2d-c113-4bf2-b1fa-59fe8aa78fd0","url":"https://www.speedtest.net/result/c/20674f2d-c113-4bf2-b1fa-59fe8aa78fd0","persisted":true}}
      

      However, the value sent by ZabbixSender and received by ZabbixServer will look like this

      {type:result,timestamp:2023-02-10T13:11:39Z,ping:{jitter:0.493,latency:7.609,low:6.920,high:8.576},download:{bandwidth:13228804,bytes:62303424,elapsed:4702,latency:{iqm:10.295,low:5.819,high:282.455,jitter:28.401}},upload:{bandwidth:38463020,bytes:238604274,elapsed:6213,latency:{iqm:153.922,low:7.502,high:351.095,jitter:52.296}},packetLoss:0,isp:au one net,interface:{internalIp:240f:101:5a0c:1:a806:f469:a839:fe9e,name:,macAddr:98:FD:B4:9A:CE:AE,isVpn:false,externalIp:240f:101:5a0c:1:a806:f469:a839:fe9e},server:{id:48463,host:speed.udx.icscoe.jp,port:8080,name:IPA CyberLab 400G,location:Tokyo,country:Japan,ip:2401:5e40:1000:1112::228},result:{id:20674f2d-c113-4bf2-b1fa-59fe8aa78fd0,url:https://www.speedtest.net/result/c/20674f2d-c113-4bf2-b1fa-59fe8aa78fd0,persisted:true}}
      

      -o option removes the double quotes from the value passed, and JsonPerth processing cannot be performed as Json.

      Please allow zabbix_sender.exe to send data in Json format.

            bmickiewicz Bartosz Mickiewicz
            qryuu akihiro ito
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: