$entry) { $roleoid = '.1.3.6.1.4.1.9.9.500.1.2.1.1.3.' . $index; $roledescr = 'Switch ' . $entry['cswSwitchNumCurrent'] . ' stacking role'; $stateoid = '.1.3.6.1.4.1.9.9.500.1.2.1.1.6.' . $index; $statedescr = 'Switch ' . $entry['cswSwitchNumCurrent'] . ' stacking state'; if ($stack_count === 1 && $entry['cswSwitchNumCurrent'] == 1 && $stackredundant === 'false' && $ports_down === 2 && $entry['cswSwitchRole'] === 'master' && $entry['cswSwitchState'] === 'ready') { // Heh, on IOS 15.x stacking is always enabled and does not have any way to detect if stack module exists and stacking is configured $stack_count = 0; print_debug("Stacking exists, but not configured and not active."); break; // exit foreach } if (!empty($entry['cswSwitchRole'])) { discover_status_ng($device, $mib, 'cswSwitchRole', $roleoid, $index, 'cisco-stackwise-member-state', $roledescr, $entry['cswSwitchRole'], ['entPhysicalClass' => 'stack', 'entPhysicalIndex' => $index]); discover_status_ng($device, $mib, 'cswSwitchState', $stateoid, $index, 'cisco-stackwise-switch-state', $statedescr, $entry['cswSwitchState'], ['entPhysicalClass' => 'stack', 'entPhysicalIndex' => $index]); } } if ($stack_count) { $oid = '.1.3.6.1.4.1.9.9.500.1.1.3.0'; $descr = 'Stackports in redundant ring'; discover_status_ng($device, $mib, 'cswRingRedundant', $oid, '0', 'cisco-stackwise-redundant-state', $descr, $stackredundant, ['entPhysicalClass' => 'stack']); foreach ($stackportoper as $index => $entry) { $oid = '.1.3.6.1.4.1.9.9.500.1.2.2.1.1.' . $index; $port = get_port_by_index_cache($device, $index); $descr = 'Stackport ' . $port['port_label']; if (!empty($entry['cswStackPortOperStatus'])) { $options = ['entPhysicalClass' => 'port', 'entPhysicalIndex' => $index, 'measured_class' => 'port', 'measured_entity' => $port['port_id']]; discover_status_ng($device, $mib, 'cswStackPortOperStatus', $oid, $index, 'cisco-stackwise-port-oper-state', $descr, $entry['cswStackPortOperStatus'], $options); } } } else { echo "No stacking detected."; } } unset($device_tmp); // EOF