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

creating custom low-level discovery rule using JSON format: wrong data in JSON object

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.0.0rc1
    • 1.9.9 (beta)
    • Server (S)

      I am trying to create my own low-level discovery rule using JSON format which is described on:
      http://www.zabbix.com/documentation/2.0/manual/discovery/low_level_discovery#discovery_item_json_format

      1. zabbix_agentd host (h157)

      a) file /usr/local/home/a (exact from documentation content):

      #!/usr/bin/perl

      $first = 1;

      print "{\n";
      print "\t\"vfs.fs.discovery_perl\":[\n\n";

      for (`cat /proc/mounts`)
      {
      ($fsname, $fstype) = m/\S+ (\S+) (\S+)/;
      $fsname =~ s!/!
      /!g;

      print "\t,\n" if not $first;
      $first = 0;

      print "\t{\n";
      print "\t\t\"

      {#FSNAME}\":\"$fsname\",\n";
      print "\t\t\"{#FSTYPE}\":\"$fstype\"\n";
      print "\t}\n";
      }

      print "\n\t]\n";
      print "}\n";

      b) zabbix_agentd.conf:

      UserParameter=a,/usr/local/home/a


      2. zabbix_server side:

      a) testing item 'a':

      # zabbix_get -s h157 -k a
      {
      "vfs.fs.discovery_perl":[

      {
      "{#FSNAME}

      ":"\/",
      "

      {#FSTYPE}":"rootfs"
      }
      ,
      {
      "{#FSNAME}":"\/",
      "{#FSTYPE}

      ":"ext4"
      }
      ,
      {
      "

      {#FSNAME}":"\/dev",
      "{#FSTYPE}":"devtmpfs"
      }
      ,
      {
      "{#FSNAME}

      ":"\/proc",
      "

      {#FSTYPE}":"proc"
      }
      ,
      {
      "{#FSNAME}":"\/sys",
      "{#FSTYPE}

      ":"sysfs"
      }
      ,
      {
      "

      {#FSNAME}":"\/run",
      "{#FSTYPE}":"tmpfs"
      }
      ,
      {
      "{#FSNAME}

      ":"\/dev\/pts",
      "

      {#FSTYPE}":"devpts"
      }
      ,
      {
      "{#FSNAME}":"\/dev\/shm",
      "{#FSTYPE}

      ":"tmpfs"
      }
      ,
      {
      "

      {#FSNAME}":"\/dist",
      "{#FSTYPE}":"ext4"
      }
      ,
      {
      "{#FSNAME}

      ":"\/dist\/dev",
      "

      {#FSTYPE}":"ext4"
      }
      ,
      {
      "{#FSNAME}":"\/dist\/usr\/run",
      "{#FSTYPE}

      ":"ext4"
      }
      ,
      {
      "

      {#FSNAME}":"\/matrix\/dev\/cgroup",
      "{#FSTYPE}":"cgroup"
      }
      ,
      {
      "{#FSNAME}

      ":"\/fs\/m-b10",
      "

      {#FSTYPE}":"ext4"
      }
      ,
      {
      "{#FSNAME}":"\/fs\/data2",
      "{#FSTYPE}

      ":"ext4"
      }
      ,
      {
      "

      {#FSNAME}

      ":"\/fs\/data",
      "

      {#FSTYPE}

      ":"ext4"
      }

      ]
      }

      Data returned from item 'a' seems to be correct JSON format.

      However in position with discovery rule 'a' there is an error:
      "wrong data in JSON object"

            Unassigned Unassigned
            rob Robert Jerzak
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: