Cacti / plugin_mactrack

Mactrack Plugin for Cacti
GNU General Public License v2.0
12 stars 24 forks source link

MAC address not populating on Juniper EX switch #158

Closed DaveNet4300 closed 2 months ago

DaveNet4300 commented 3 years ago

Describe the bug A clear and concise description of what the bug is. MAC addresses are not populating for Juniper EX switch using get_JEX_switch_Ports may be due to this errors loged.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/mactrack/mactrack_scanner.php[168]:get_JEX_switch_ports(), /plugins/mactrack/lib/mactrack_juniper.php[100]:CactiErrorHandler()) ERROR PHP NOTICE in Plugin 'mactrack': Undefined index: in file: /usr/share/cacti/plugins/mactrack/lib/mactrack_juniper.php on line: 100 CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/mactrack/mactrack_scanner.php[168]:get_JEX_switch_ports(), /plugins/mactrack/lib/mactrack_juniper.php[99]:CactiErrorHandler()) ERROR PHP NOTICE in Plugin 'mactrack': Undefined index: in file: /usr/share/cacti/plugins/mactrack/lib/mactrack_juniper.php on line: 99 CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/mactrack/mactrack_scanner.php[168]:get_JEX_switch_ports(), /plugins/mactrack/lib/mactrack_juniper.php[98]:CactiErrorHandler()) ERROR PHP NOTICE in Plugin 'mactrack': Undefined offset: 591 in file: /usr/share/cacti/plugins/mactrack/lib/mactrack_juniper.php on line: 98 CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/mactrack/mactrack_scanner.php[168]:get_JEX_switch_ports(), /plugins/mactrack/lib/mactrack_juniper.php[100]:CactiErrorHandler()) ERROR PHP NOTICE in Plugin 'mactrack': Undefined index: in file: /usr/share/cacti/plugins/mactrack/lib/mactrack_juniper.php on line: 100

Expected behavior A clear and concise description of what you expected to happen. Mac addresses populated in tab DeviceTracking->Devices or DeviceTracking->MAC address Screenshots If applicable, add screenshots to help explain your problem. image image

Plugin (please complete the following information):

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here. Thank you

DaveNet4300 commented 3 years ago

Line of code based on the error message. Forgot to include in original issue. mactrack_debug("Vlan assembly complete.");

if (sizeof($active_vlans) > 0) {
    $i = 0;
    /* get the port status information */
    //$port_results = get_base_dot1dTpFdbEntry_ports($site, $device, $ifInterfaces, "", "", FALSE);
    $mac_results  = xform_stripped_oid ( ".1.3.6.1.2.1.17.7.1.2.2.1.2", $device );
    $port_results = xform_stripped_oid ( ".1.3.6.1.2.1.17.1.4.1.2", $device );

    $i = 0;
    $j = 0;
    $port_array = array();
    foreach($mac_results as $num => $mac_result) {
        if ( $mac_result != 0 ) {
            $Xvlanid = substr ( $num, 0, strpos ( $num, "." ) );
            $Xmac    = mach ( substr ( $num, strpos ( $num, ".") + 1 ) );

            $ifIndex = $port_results[$mac_result];   -->Line 98
            $ifType = $ifInterfaces[$ifIndex]["ifType"]; ---> Line 99
            $ifName = $ifInterfaces[$ifIndex]["ifName"];   ---> Line 100
            $portName = $ifName;
            $portTrunkStatus = @$ifInterfaces[$ifIndex]["trunkPortState"];
TheWitness commented 2 years ago

Can you create a pull request for this change please?

xmacan commented 2 months ago

I think it is fixed via #206