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

LLD JS preprocessing fails, Network ports discovery, SAN NetApp FAS3220

XMLWordPrintable

    • Team INT
    • Sprint 85 (Feb 2022), Sprint 86 (Mar 2022), Sprint 87 (Apr 2022), Sprint 88 (May 2022), Sprint 89 (Jun 2022), Sprint 90 (Jul 2022), Sprint 91 (Aug 2022), Sprint 92 (Sep 2022), Sprint 93 (Oct 2022), Sprint 94 (Nov 2022), Sprint 95 (Dec 2022), Sprint 96 (Jan 2023), Sprint 97 (Feb 2023), Sprint 98 (Mar 2023), Sprint 99 (Apr 2023), Sprint 100 (May 2023), Sprint 101 (Jun 2023), Sprint 102 (Jul 2023), Sprint 103 (Aug 2023), Sprint 104 (Sep 2023), Sprint 105 (Oct 2023), Sprint 106 (Nov 2023), Sprint 107 (Dec 2023), Sprint candidates, S2401
    • 1

      The template available at:

      https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/san/netapp_fas3220_snmp?at=refs%2Fheads%2Frelease%2F5.0

      Has a discovery rule "Network ports discovery" with key:

      discovery[{#IFNAME},1.3.6.1.4.1.789.1.22.2.1.2,{#NODE},1.3.6.1.4.1.789.1.22.2.1.1,{#TYPE},1.3.6.1.4.1.789.1.22.2.1.15,{#ROLE},1.3.6.1.4.1.789.1.22.2.1.3,{#IFDESCR},1.3.6.1.4.1.789.1.22.1.2.1.2]

      The data reported back looks like:

      [{
      "{#SNMPINDEX}": "8.100.99.45.99.108.45.48.50.3.101.50.100",
      "{#IFNAME}": "e2d",
      "{#NODE}": "dc-cl-02",
      "{#TYPE}": "0",
      "{#ROLE}": "2"
      }]

      This data fails to go through the preprocessing inside discovery section:

      var data = JSON.parse(value);
      var descriptions = {};
      var out = [];
      
      data.forEach(function(elem) {
          if (elem["{#IFDESCR}"]) {
              var parts = elem["{#IFDESCR}"].split(":");
              var port = parts[parts.length-1].split(' ');
              descriptions[parts[0] + ':' + port[port.length-1]] = {
                  "{#IFDESCR}": elem["{#IFDESCR}"],
                  "{#SNMPINDEX}": elem["{#SNMPINDEX}"]
              }
          }
      });
      
      data.forEach(function(elem) {
          if (elem["{#IFNAME}"]) {
              var port = descriptions[elem["{#NODE}"] + ':' + elem["{#IFNAME}"]];
      
              elem["{#IFDESCR}"] = port["{#IFDESCR}"];
              elem["{#IFSNMPINDEX}"] = port["{#SNMPINDEX}"];
      
      
              switch(elem["{#TYPE}"]) {
                  case '0':
                      elem["{#TYPE}"] = 'physical';
                      break;
                  case '1':
                      elem["{#TYPE}"] = 'if-group';
                      break;
                  case '2':
                      elem["{#TYPE}"] = 'vlan';
                      break;
                  case '3':
                      elem["{#TYPE}"] = 'undef';
                      break;
              };
          
              out.push(elem);
          }
      });
      
      return JSON.stringify(out); 

      It prints:

      Preprocessing failed for: [{..."{#SNMPINDEX}": "8.100.99.45.99.108.45.48.49.3.97.48.97",..."{#IFNAME}": "a0a",..."{#NODE}":...
      1. Failed: TypeError: cannot read property '{#IFDESCR}' of undefined
      at [anon] (duktape.c:57260) internal
      at [anon] (function:20) preventsyield
      at forEach () native strict preventsyield
      at [anon] (function:41) preventsyield

            drasikhov Denis Rasikhov
            aigars.kadikis Aigars Kadikis
            Team INT
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: