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

Details

    • 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)
    • 1

    Description

      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

      Attachments

        Activity

          People

            drasihov Denis Rasihov
            aigars.kadikis Aigars Kadikis
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: