Ad Widget

Collapse

Send JSON?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jmaurin
    Junior Member
    • Apr 2013
    • 20

    #1

    Send JSON?

    Hi.
    Is possible to send JSON strig with field/value using zabbix_agent or zabbix_sender?
    I'm not talking about LLD, but item/value itself.

    Also, is possible to use auto-registration using only zabbix_sender (not zabbix_agent)? zabbix_sender will trigger auto-registration actions (if any)?
  • Atsushi
    Senior Member
    • Aug 2013
    • 2028

    #2
    For Zabbix item value, JSON can handle only text.

    It is impossible to automatically register hosts when receiving data from zabbix_sender.
    Please consider registering using Zabbix API.

    Comment

    • jmaurin
      Junior Member
      • Apr 2013
      • 20

      #3
      Ok.
      I managed to get this working. Connecting to server (port 10051) and sending JSON string, I could register my station....I also could send data, but it offen fails with error in json, even if my JSON string is valid (validaded on more than one tools).
      What could be wrong? Sometimes this work, but most doesn't. All strign are sent with "\n" at the end.

      Code:
      {"request":"sender data","data":[{"host":"EXTRPI000002","key":"packets_received","value":"0"},{"host":"EXTRPI000002","key":"version","value":"20170524174840"},{"host":"EXTRPI000002","key":"total_adsb_pkts_received","value":"7846"},{"host":"EXTRPI000002","key":"total_adsb_positions_received","value":"0"},{"host":"EXTRPI000002","key":"bytes_last_minute","value":"0"},{"host":"EXTRPI000002","key":"total_bytes_received","value":"0"},{"host":"EXTRPI000002","key":"frames_s","value":"0.00"},{"host":"EXTRPI000002","key":"acars_is_running","value":"0"},{"host":"EXTRPI000002","key":"vhf_is_running","value":"0"},{"host":"EXTRPI000002","key":"mlat_is_running","value":"0"},{"host":"EXTRPI000002","key":"connection_count","value":"1"},{"host":"EXTRPI000002","key":"demod_preambles","value":"0"},{"host":"EXTRPI000002","key":"demod_rejected_bad","value":"0"},{"host":"EXTRPI000002","key":"demod_rejected_unknown_icao","value":"0"},{"host":"EXTRPI000002","key":"demod_accepted","value":"0"},{"host":"EXTRPI000002","key":"demod_modeac","value":"0"},{"host":"EXTRPI000002","key":"samples_processed","value":"0"},{"host":"EXTRPI000002","key":"samples_dropped","value":"0"},{"host":"EXTRPI000002","key":"noise_power","value":"0.00"},{"host":"EXTRPI000002","key":"signal_power","value":"0.00"},{"host":"EXTRPI000002","key":"signal_peak","value":"0.00"},{"host":"EXTRPI000002","key":"strong_signal_count","value":"0"},{"host":"EXTRPI000002","key":"rmt_rec_ac","value":"0"},{"host":"EXTRPI000002","key":"rmt_s","value":"0"},{"host":"EXTRPI000002","key":"remote_rejected_bad","value":"0"}]}
      
      Return this on server:
      8767:20170525:001355.701 received invalid JSON object from XXX: cannot parse as a valid JSON object: unexpected end of string data
      Code:
      {"request":"sender data","data":[{"host":"EXTRPI000002","key":"packets_received","value":"9203"},{"host":"EXTRPI000002","key":"version","value":"20170524174840"},{"host":"EXTRPI000002","key":"total_adsb_pkts_received","value":"9527"},{"host":"EXTRPI000002","key":"total_adsb_positions_received","value":"0"},{"host":"EXTRPI000002","key":"bytes_last_minute","value":"195659"},{"host":"EXTRPI000002","key":"total_bytes_received","value":"195659"},{"host":"EXTRPI000002","key":"frames_s","value":"0.00"},{"host":"EXTRPI000002","key":"acars_is_running","value":"0"},{"host":"EXTRPI000002","key":"vhf_is_running","value":"0"},{"host":"EXTRPI000002","key":"mlat_is_running","value":"0"},{"host":"EXTRPI000002","key":"connection_count","value":"1"},{"host":"EXTRPI000002","key":"demod_preambles","value":"0"},{"host":"EXTRPI000002","key":"demod_rejected_bad","value":"0"},{"host":"EXTRPI000002","key":"demod_rejected_unknown_icao","value":"0"},{"host":"EXTRPI000002","key":"demod_accepted","value":"0"},{"host":"EXTRPI000002","key":"demod_modeac","value":"0"},{"host":"EXTRPI000002","key":"samples_processed","value":"0"},{"host":"EXTRPI000002","key":"samples_dropped","value":"0"},{"host":"EXTRPI000002","key":"noise_power","value":"0.00"},{"host":"EXTRPI000002","key":"signal_power","value":"0.00"},{"host":"EXTRPI000002","key":"signal_peak","value":"0.00"},{"host":"EXTRPI000002","key":"strong_signal_count","value":"0"},{"host":"EXTRPI000002","key":"rmt_rec_ac","value":"0"},{"host":"EXTRPI000002","key":"rmt_s","value":"0"},{"host":"EXTRPI000002","key":"remote_rejected_bad","value":"0"}]}
      
      8767:20170525:001445.744 received invalid JSON object from X: cannot parse as a valid JSON object: invalid object name at: ''

      Now without dougle-quote in values:
      Code:
      {"request":"sender data","data":[{"host":"EXTRPI000002","key":"packets_received","value":8898},{"host":"EXTRPI000002","key":"version","value":"20170524174840"},{"host":"EXTRPI000002","key":"total_adsb_pkts_received","value":18904},{"host":"EXTRPI000002","key":"total_adsb_positions_received","value":0},{"host":"EXTRPI000002","key":"bytes_last_minute","value":190708},{"host":"EXTRPI000002","key":"total_bytes_received","value":190708},{"host":"EXTRPI000002","key":"frames_s","value":0.00},{"host":"EXTRPI000002","key":"acars_is_running","value":0},{"host":"EXTRPI000002","key":"vhf_is_running","value":0},{"host":"EXTRPI000002","key":"mlat_is_running","value":0},{"host":"EXTRPI000002","key":"connection_count","value":1},{"host":"EXTRPI000002","key":"demod_preambles","value":0},{"host":"EXTRPI000002","key":"demod_rejected_bad","value":0},{"host":"EXTRPI000002","key":"demod_rejected_unknown_icao","value":0},{"host":"EXTRPI000002","key":"demod_accepted","value":0},{"host":"EXTRPI000002","key":"demod_modeac","value":0},{"host":"EXTRPI000002","key":"samples_processed","value":0},{"host":"EXTRPI000002","key":"samples_dropped","value":0},{"host":"EXTRPI000002","key":"noise_power","value":0.00},{"host":"EXTRPI000002","key":"signal_power","value":0.00},{"host":"EXTRPI000002","key":"signal_peak","value":0.00},{"host":"EXTRPI000002","key":"strong_signal_count","value":0},{"host":"EXTRPI000002","key":"rmt_rec_ac","value":0},{"host":"EXTRPI000002","key":"rmt_s","value":69728},{"host":"EXTRPI000002","key":"remote_rejected_bad","value":0}]}
      
      8766:20170525:001746.512 received invalid JSON object from X: cannot parse as a valid JSON object: unexpected end of string data
      Code:
      {"request":"sender data","data":[{"host":"EXTRPI000002","key":"packets_received","value":10883},{"host":"EXTRPI000002","key":"version","value":"20170524174840"},{"host":"EXTRPI000002","key":"total_adsb_pkts_received","value":20602},{"host":"EXTRPI000002","key":"total_adsb_positions_received","value":0},{"host":"EXTRPI000002","key":"bytes_last_minute","value":230499},{"host":"EXTRPI000002","key":"total_bytes_received","value":421207},{"host":"EXTRPI000002","key":"frames_s","value":1082.08},{"host":"EXTRPI000002","key":"acars_is_running","value":0},{"host":"EXTRPI000002","key":"vhf_is_running","value":0},{"host":"EXTRPI000002","key":"mlat_is_running","value":0},{"host":"EXTRPI000002","key":"connection_count","value":1},{"host":"EXTRPI000002","key":"demod_preambles","value":0},{"host":"EXTRPI000002","key":"demod_rejected_bad","value":0},{"host":"EXTRPI000002","key":"demod_rejected_unknown_icao","value":0},{"host":"EXTRPI000002","key":"demod_accepted","value":0},{"host":"EXTRPI000002","key":"demod_modeac","value":0},{"host":"EXTRPI000002","key":"samples_processed","value":0},{"host":"EXTRPI000002","key":"samples_dropped","value":0},{"host":"EXTRPI000002","key":"noise_power","value":0.00},{"host":"EXTRPI000002","key":"signal_power","value":0.00},{"host":"EXTRPI000002","key":"signal_peak","value":0.00},{"host":"EXTRPI000002","key":"strong_signal_count","value":0},{"host":"EXTRPI000002","key":"rmt_rec_ac","value":0},{"host":"EXTRPI000002","key":"rmt_s","value":76383},{"host":"EXTRPI000002","key":"remote_rejected_bad","value":0}]}
      
      
       8766:20170525:001816.557 received invalid JSON object from X: cannot parse as a valid JSON object: invalid object name/value separator at: ''

      Comment

      • jmaurin
        Junior Member
        • Apr 2013
        • 20

        #4
        Well, looks like Zabbix has a limit for JSON string. I don't knwo if is possible to change this, but sending less information per 'packet' (connection) works fine. The only down side is that I need to make more than onde connection, since after sending data connection is closed by server.

        Comment

        Working...