VMware tags are not reliably collected during VM discovery

XMLWordPrintable

    • Type: Problem report
    • Resolution: Fixed
    • Priority: Trivial
    • 6.4.4rc1, 7.0.0alpha2, 7.0 (plan)
    • Affects Version/s: 6.4.1
    • Component/s: Proxy (P), Server (S)
    • Environment:
      VMware vCenter Server 7.0.2 build-18455184
      zabbix-proxy-pgsql-6.2.9
      Rocky Linux release 8.7
    • Sprint 100 (May 2023), Sprint 101 (Jun 2023)
    • 1

      In the JSON generated by vmware.vm.discovery all discovered VMs have an empty "tags" element, even if vmware tags are actually defined in vSphere. It seems taht restarting zabbix_proxy, in most cases, makes appear tags again in the JSON. 

      Since we use vmware tags to filter VMs that need to be discovered and monitored, this issue makes hosts to be randomly created and deleted from zabbix.

       

      Steps to reproduce:

      1. Create an host and apply VMware FQDN template

      2. In the vmware.vm.discovery[] discovery rule: add a Javascript preprocessing step in order to write lld output to the logs

      var obj = JSON.parse(value);
      Zabbix.log(3, "VMdiscovery: "+JSON.stringify(obj));
      return JSON.stringify(obj);

       

      3. Observe JSON output in zabbix_proxy.log: "tags" element is empty.

      843683:20230418:100956.685 VMdiscovery: 
            {
          "{#VM.UUID}": "503a502b-4ed7-b865-9999-8d0e514e34b6",
          "{#VM.ID}": "vm-28941",
          "{#VM.NAME}": "adfs01",
          "{#HV.NAME}": "xxxxxxxmgt03",
          "{#HV.UUID}": "4c4c4544-005a-3410-9999-b6c04f314c32",
          "{#HV.ID}": "host-21",
          "{#DATACENTER.NAME}": "xxxxxxxmgm01",
          "{#CLUSTER.NAME}": "xxxxxxxmgm01",
          "{#VM.IP}": "192.168.2.10",
          "{#VM.DNS}": "adfs01.xxxxxx",
          "{#VM.GUESTFAMILY}": "windowsGuest",
          "{#VM.GUESTFULLNAME}": "Microsoft Windows Server 2016 or later (64-bit)",
          "{#VM.FOLDER}": "xxxxxx-infrastructure",
          "{#VM.SNAPSHOT.COUNT}": 0,
          "{#VM.TOOLS.STATUS}": "guestToolsRunning",
          "{#VM.POWERSTATE}": "poweredOn",
          "{#DATASTORE.NAME}": "xxxxxx-02-ntx-mgm",
          "{#DATASTORE.UUID}": "399972f4-f7529f1a",
          "{#VM.RPOOL.ID}": "resgroup-28833",
          "{#VM.RPOOL.PATH}": "xxxxxx-infrastructure",
          "vm.customattribute": [
            {
              "name": "LastBackupStatus",
              "value": "Successful: 2023-04-18 03:06:00 UTC"
            },
          ],
          "tags": []
          },

      ....

          ]

       

      4. Restart zabbix and look again at zabbix-proxy.log: "tags" element is now properly collected.

      # systemctl restart zabbix-proxy
      # systemctl status zabbix-proxy

      zabbix-proxy.service - Zabbix Proxy
         Active: active (running) since Tue 2023-04-18 11:01:53 CEST; 

      3819356:20230418:110956.470 VMdiscovery: 
          [
          {
            "{#VM.UUID}": "503a502b-4ed7-b865-9999-8d0e514e34b6",
            "{#VM.ID}": "vm-28941",
            "{#VM.NAME}": "adfs01",
            "{#HV.NAME}": "xxxxxxxmgt03",
            "{#HV.UUID}": "4c4c4544-005a-3410-9999-b6c04f314c32",
            "{#HV.ID}": "host-21",
            "{#DATACENTER.NAME}": "xxxxxxxmgm01",
            "{#CLUSTER.NAME}": "xxxxxxxmgm01",
            "{#VM.IP}": "192.168.2.10",
            "{#VM.DNS}": "adfs01.xxxxxx",
            "{#VM.GUESTFAMILY}": "windowsGuest",
            "{#VM.GUESTFULLNAME}": "Microsoft Windows Server 2016 or later (64-bit)",
            "{#VM.FOLDER}": "xxxxxx-infrastructure",
            "{#VM.SNAPSHOT.COUNT}": 0,
            "{#VM.TOOLS.STATUS}": "guestToolsRunning",
            "{#VM.POWERSTATE}": "poweredOn",
            "{#DATASTORE.NAME}": "xxxxxx-02-ntx-mgm",
            "{#DATASTORE.UUID}": "399972f4-f7529f1a",
            "{#VM.RPOOL.ID}": "resgroup-28833",
            "{#VM.RPOOL.PATH}": "xxxxxx-infrastructure",
            "vm_customattribute": [
              {
                "name": "LastBackupStatus",
                "value": "Successful: 2023-04-18 03:06:00 UTC"
      {{        }}}
            ],
            "tags": [
              {
                "name": "IT-OPERATION",
                "description": "",
                "category": "Monitoring-Department"
              },
              {
                "name": "YES",
                "description": "",
                "category": "Monitoring-Agent"
      {{        }}}
            ]
          },
          
          ....
          
          ]

           

       

            Assignee:
            Michael Veksler
            Reporter:
            Nicola Mauri
            Team B
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: