Ad Widget

Collapse

Json Invalid

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • HeadQuaker
    Member
    • Jul 2015
    • 58

    #1

    Json Invalid

    Hello,

    I have a Powershell script returning a file like :
    {
    "data":[
    {
    "{#SHARENAME}":"Informatique",
    "{#SHARENAME}":"Marketing"
    }
    ]
    }

    I've set a discovery rule (zabbix agent) + an Item prototype (zabbix trapper) with the Key : sharename[{#SHARENAME}]

    But the discovery rule says : Invalid discovery rule value: cannot parse as a valid JSON object: invalid object format, expected opening character '{' or '[' at: '/c zabbix_sender -c "C:\Program Files\Zabbix\Configurations\ZabbixAgentConf_x64_Cu stom.conf" -i C:\Temp\JSON.log sent: 0; skipped: 8; total: 8'

    Why ?!
  • HeadQuaker
    Member
    • Jul 2015
    • 58

    #2
    Please help !

    Comment

    • vso
      Zabbix developer
      • Aug 2016
      • 190

      #3
      You can create regular text item and check what is it returning, but looks like script is not returning valid json.

      Comment

      • Piper22
        Junior Member
        • Jun 2019
        • 1

        #4
        Your emails element is being defined as a string starting with "( and ending with )".

        Inside that string, you then have separate strings each starting and ending with quote marks.

        This is obviously incorrect.

        What you probably intended is "emails" : [ ...... ]

        (... unless you actually intended for the emails element to be a string, in which case the quotes within it need to be escaped as ", as do the line feeds as \n. but I don't think that's what you intended, is it?). tellthebell

        That's why you're getting a syntax error.
        Last edited by Piper22; 25-06-2019, 06:51.

        Comment

        • Teter
          Junior Member
          • Dec 2021
          • 2

          #5
          Hi, I have the same error message.
          I need to use this template and .sh file in zabbix:

          I finally get the following message at the discovery stage:

          Invalid discovery rule value: cannot parse as a valid JSON object: invalid object format, expected opening character '{' or '[' at: '/usr/lib/zabbix/externalscripts/v3700_status.sh: line 114: sshpass: command not found
          [
          ]'

          I don't know json and I can't fix it, I don't know what the correct .sh file should look like​

          Comment

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

            #6
            In your case, you see in the message a piece of error executing the script that generates json.
            And the error is actually in the "usr/lib/zabbix/externalscripts/v3700_status.sh" file in the line number 114 -> "sshpass: command not found".

            Comment

            • Teter
              Junior Member
              • Dec 2021
              • 2

              #7
              Yes, that's right, and line 114 in the .sh file is:

              Code:
              RESULT=$(sshpass -p $3 ssh -o StrictHostKeyChecking=no $2@$1 '( lsvdisk -nohdr -delim :)' )
              whole file: https://github.com/Yarli/Zabbix-IBM-...3700_status.sh
              And I don't know enough about json to say what's wrong here.​

              Comment

              Working...