Uploaded image for project: 'Observium'
  1. Observium
  2. OBS-4001

Separate $port['ifDescr'] and $port['ifName'] filtering in is_port_valid()

Details

    • Help
    • Resolution: Not A Bug
    • Trivial
    • None
    • Professional Edition
    • Default
    • PHP8, Ubuntu 20

    Description

      Hello,

       

      Currently, the configuration variable "bad_if" and "bad_if_regexp" are used to filtered port on $port['ifDescr'] and $port['ifName'] in includes/entities/port.inc.php.

       

       

         // FIXME. Prefer regexp
        if ($valid_ifDescr && str_icontains_array($port['ifDescr'], (array)$config['bad_if'])) {
          $bi = $GLOBALS['str_last_needle'];
          print_debug("ignored (by ifDescr): ".$port['ifDescr']." [ $bi ]");
          return FALSE;
        }
        if ($valid_ifName && $nosame_ifName && str_icontains_array($port['ifName'], (array)$config['bad_if'])) {
          $bi = $GLOBALS['str_last_needle'];
          print_debug("ignored (by ifName): ".$port['ifName']." [ $bi ]");
          return FALSE;
        }
      

       

      I have problems with this in a Juniper and Nokia environment.
      The two manufacturers do not use the field in the same way, Nokia add ifAlias in the ifDescr :

       

      $config['bad_if'] = array("em", "me", "dsc", "tap", "gre", "gr", "pe", "mt", "ipip", "pime", "pimd", "mtun", "demux", "ip", "pe", "vt", "mt", "pd", "cbp", "pp", "lt", "ut", "ud", "lc", "lsi", "pfe", "pfh", "esi", "jsrv");

       

      NOKIA :

      Xignored (by ifDescr): lag-10, IP interface, IPYX/012345/800/ABC customer name [ ip ]

        [1342177290] => array(
                          [ifDescr]      => string(101) "lag-10, IP interface, IPYX/012345/800/ABC customer name via esat-1/1/1, esat-1/1/2 and esat-1/1/3"
                          [ifAlias]      => string(82) "IPYX/012345/800/ABC customer via esat-1/1/1, esat-1/1/2 and esat-1/1/3"
                          [ifName]       => string(6) "lag-10"
                          [ifType]       => string(13) "ieee8023adLag"
                          [ifOperStatus] => string(2) "up"
                        )

      JUNIPER :

        [576] => array(
                   [ifDescr]      => string(12) "ge-1/1/4.100"
                   [ifAlias]      => string(36) "IPYX/12345/001/ABC customer name."
                   [ifName]       => string(12) "ge-1/1/4.100"
                   [ifType]       => string(6) "l2vlan"
                   [ifOperStatus] => string(14) "lowerLayerDown"
                 )

       

      Maybe interesting to have possibility to split  $port['ifDescr'] and $port['ifName'].
      Or define "bad_if" and "bad_if_regexp" by OS?
      In the meantime, I search with "bad_if_regexp" instead "bad_if", or $config['os'][$os]['ports_ignore']. But less easy.

       

      Thank you!

      Attachments

        Activity

          [OBS-4001] Separate $port['ifDescr'] and $port['ifName'] filtering in is_port_valid()

          Hi Johann Mallet, we have not received the additional information requested earlier from you in this issue 'Hello,

           

          Currently, the configuration variable "bad_if" and "bad_if_regexp" are used to filtered port on $port['ifDescr'] and $port['ifName'] in includes/entities/port.inc.php.

           

           

             // FIXME. Prefer regexp
            if ($valid_ifDescr && str_icontains_array($port['ifDescr'], (array)$config['bad_if'])) {
              $bi = $GLOBALS['str_last_needle'];
              print_debug("ignored (by ifDescr): ".$port['ifDescr']." [ $bi ]");
              return FALSE;
            }
            if ($valid_ifName && $nosame_ifName && str_icontains_array($port['ifName'], (array)$config['bad_if'])) {
              $bi = $GLOBALS['str_last_needle'];
              print_debug("ignored (by ifName): ".$port['ifName']." [ $bi ]");
              return FALSE;
            }
          

           

          I have problems with this in a Juniper and Nokia environment.
          The two manufacturers do not use the field in the same way, Nokia add ifAlias in the ifDescr :

           

          $config['bad_if'] = array("em", "me", "dsc", "tap", "gre", "gr", "pe", "mt", "ipip", "pime", "pimd", "mtun", "demux", "ip", "pe", "vt", "mt", "pd", "cbp", "pp", "lt", "ut", "ud", "lc", "lsi", "pfe", "pfh", "esi", "jsrv");

           

          NOKIA :

          Xignored (by ifDescr): lag-10, IP interface, IPYX/012345/800/ABC customer name [ ip ]

            [1342177290] => array(
                              [ifDescr]      => string(101) "lag-10, IP interface, IPYX/012345/800/ABC customer name via esat-1/1/1, esat-1/1/2 and esat-1/1/3"
                              [ifAlias]      => string(82) "IPYX/012345/800/ABC customer via esat-1/1/1, esat-1/1/2 and esat-1/1/3"
                              [ifName]       => string(6) "lag-10"
                              [ifType]       => string(13) "ieee8023adLag"
                              [ifOperStatus] => string(2) "up"
                            )

          JUNIPER :

            [576] => array(
                       [ifDescr]      => string(12) "ge-1/1/4.100"
                       [ifAlias]      => string(36) "IPYX/12345/001/ABC customer name."
                       [ifName]       => string(12) "ge-1/1/4.100"
                       [ifType]       => string(6) "l2vlan"
                       [ifOperStatus] => string(14) "lowerLayerDown"
                     )

           

          Maybe interesting to have possibility to split  $port['ifDescr'] and $port['ifName'].
          Or define "bad_if" and "bad_if_regexp" by OS?
          In the meantime, I search with "bad_if_regexp" instead "bad_if", or $config['os'][$os]['ports_ignore']. But less easy.

           

          Thank you!'!

          Issues without your response will be closed within 2 weeks.

          landy Mike Stupalov added a comment - Hi Johann Mallet, we have not received the additional information requested earlier from you in this issue 'Hello,   Currently, the configuration variable "bad_if" and "bad_if_regexp" are used to filtered port on $port ['ifDescr'] and $port ['ifName'] in includes/entities/port.inc.php.        // FIXME. Prefer regexp   if ($valid_ifDescr && str_icontains_array($port[ 'ifDescr' ], (array)$config[ 'bad_if' ])) {     $bi = $GLOBALS[ 'str_last_needle' ];     print_debug( "ignored (by ifDescr): " .$port[ 'ifDescr' ]. " [ $bi ]" );     return FALSE;   }   if ($valid_ifName && $nosame_ifName && str_icontains_array($port[ 'ifName' ], (array)$config[ 'bad_if' ])) {     $bi = $GLOBALS[ 'str_last_needle' ];     print_debug( "ignored (by ifName): " .$port[ 'ifName' ]. " [ $bi ]" );     return FALSE;   }   I have problems with this in a Juniper and Nokia environment. The two manufacturers do not use the field in the same way, Nokia add ifAlias in the ifDescr :   $config ['bad_if'] = array("em", "me", "dsc", "tap", "gre", "gr", "pe", "mt", "ipip", "pime", "pimd", "mtun", "demux", "ip", "pe", "vt", "mt", "pd", "cbp", "pp", "lt", "ut", "ud", "lc", "lsi", "pfe", "pfh", "esi", "jsrv");   NOKIA : Xignored (by ifDescr) : lag-10, IP interface, IP YX/012345/800/ABC customer name [ ip ]   [1342177290] => array(                     [ifDescr]      => string(101) "lag-10, IP interface, IPYX/012345/800/ABC customer name via esat-1/1/1, esat-1/1/2 and esat-1/1/3"                     [ifAlias]      => string(82) " IPYX/012345/800/ABC customer via esat-1/1/1, esat-1/1/2 and esat-1/1/3"                     [ifName]       => string(6) "lag-10"                     [ifType]       => string(13) "ieee8023adLag"                     [ifOperStatus] => string(2) "up"                   ) JUNIPER :   [576] => array(               [ifDescr]      => string(12) "ge-1/1/4.100"               [ifAlias]      => string(36) "IPYX/12345/001/ABC customer name."               [ifName]       => string(12) "ge-1/1/4.100"               [ifType]       => string(6) "l2vlan"               [ifOperStatus] => string(14) "lowerLayerDown"            )   Maybe interesting to have possibility to split  $port ['ifDescr'] and $port ['ifName'] . Or define "bad_if" and "bad_if_regexp" by OS? In the meantime, I search with "bad_if_regexp" instead "bad_if", or $config ['os'] [$os] ['ports_ignore'] . But less easy.   Thank you!'! Issues without your response will be closed within 2 weeks.

          You definitely should use bad_if_regexp instead bad_if.
          Such two-character strings will always intersect with other interfaces, separation ifDescr/ifName won't help.

          And we already support per os ignores with more complex rules. Ie:

          $config['os'][$os]['ports_ignore'][]        = [ 'ifType' => 'l2vlan', 'label' => '/^VLAN/i' ];
          

          Here can used common port fields with regexp: ifType, ifAlias, ifDescr, ifName, label.
          But I sure, for you case enough $config['bad_if_regexp'].

          landy Mike Stupalov added a comment - You definitely should use bad_if_regexp instead bad_if . Such two-character strings will always intersect with other interfaces, separation ifDescr/ifName won't help. And we already support per os ignores with more complex rules. Ie: $config['os'][$os]['ports_ignore'][] = [ 'ifType' => 'l2vlan', 'label' => '/^VLAN/i' ]; Here can used common port fields with regexp: ifType, ifAlias, ifDescr, ifName, label. But I sure, for you case enough $config ['bad_if_regexp'] .

          General questions and device support can be discussed in our Discord channel, click here to join.


          Please make and attach additional information about the device:

          • full snmp dump from device:

            snmpwalk -v2c -c <community> -t 3 -Cc --hexOutputLength=0 -ObentxU <hostname> .1 > myagent.snmpwalk
            snmpwalk -v2c -c <community> -t 3 -Cc --hexOutputLength=0 -ObentxU <hostname> .1.3.6.1.4.1 >> myagent.snmpwalk

            If device not support SNMP version 2c, replace -v2c with -v1.

          • If you have problems with discovery or poller processes, please do and attach these debugs:

            ./discovery.php -d -h <device>
            ./poller.php -d -h <device>

          • additionally attach device and/or vendor specific MIB files

          This comment is added automatically.

          bot Observium Bot added a comment - General questions and device support can be discussed in our Discord channel, click here to join . Please make and attach additional information about the device: full snmp dump from device: snmpwalk -v2c -c <community> -t 3 -Cc --hexOutputLength=0 -ObentxU <hostname> .1 > myagent.snmpwalk snmpwalk -v2c -c <community> -t 3 -Cc --hexOutputLength=0 -ObentxU <hostname> .1.3.6.1.4.1 >> myagent.snmpwalk If device not support SNMP version 2c, replace -v2c with -v1. If you have problems with discovery or poller processes, please do and attach these debugs: ./discovery.php -d -h <device> ./poller.php -d -h <device> additionally attach device and/or vendor specific MIB files This comment is added automatically.

          People

            landy Mike Stupalov
            johann Johann Mallet
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: