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

LLD: Value should be a JSON object on valid json

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Done
    • Icon: Major Major
    • None
    • 3.4.11
    • Server (S)
    • None
    • Docker image zabbix/zabbix-server-mysql ubuntu-3.4-latest

      We have one userparam for discover cifs mountpoint that returns a json but on discovery rules says "value should be a json object"

      Steps to reproduce:

      • Create /etc/zabbix/zabbix_agentd.conf.d/samba.userparams.conf
      UserParameter=discoverSMB,echo -n '{"data":['; for i in $(grep -v "^#" /etc/fstab |grep -i -e cifs -e smbfs  | awk '{print $2}'); do echo -n '{"{#MOUNTPOINT}":"'$i'"},';done | sed -e 's/,$//' ; echo -n ']}'
      • Go to webinterface and create a discovery rule on empty template:

      Name: CIFSmountpoints
      Type: Zabbix agent
      Key: discoverSMB

      • Go to server and check what you get:
      root@zabbix-server:/var/lib/zabbix# zabbix_get -s x.x.x.x -k discoverSMB
      {"data":[{"{#MOUNTPOINT}":"/mnt/winfs/directorioBackup"},{"{#MOUNTPOINT}":"/mnt/winfs/directorioBBDD"}]}
      
      • Validate json on https://jsonlint.com/
      • Apply the template to a host and check that you get the alert "Value should be a JSON object"

       

            Unassigned Unassigned
            xalabin Néstor
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: