&$entry) { $entry['counts']['devices'] = safe_count($entry['devices']); } //r($vlans); // Untagged Vlans $sql = 'SELECT `ifVlan`, COUNT(`ifVlan`) AS `count` FROM `ports` ' . generate_where_clause('(`ifVlan` IS NOT NULL AND `ifVlan` != "") AND `deleted` != 1', $query_permitted_ports) . ' GROUP BY `ifVlan`'; foreach (dbFetchRows($sql) as $otherport) { $vlans[$otherport['ifVlan']]['counts']['ports_untagged'] = $otherport['count']; } $sql = 'SELECT `vlan`, COUNT(`vlan`) AS `count` FROM `ports_vlans` '.generate_where_clause($query_permitted_ports).' GROUP BY `vlan`'; foreach (dbFetchRows($sql) as $port_count) { if (!isset($vlans[$port_count['vlan']])) { //print_error("Unknown VLAN ID '" . $port_count['vlan'] . "' with " . $port_count['count'] . " ports count."); print_debug("Unknown VLAN ID '".$port_count['vlan']."' with ".$port_count['count']." ports count."); continue; } $vlans[$port_count['vlan']]['counts']['ports_tagged'] = $port_count['count']; } $sql = 'SELECT `vlan_id`, COUNT(DISTINCT(`mac_address`)) AS `count` FROM `vlans_fdb` ' . generate_where_clause('`deleted` != 1', $query_permitted_ports) . ' GROUP BY `vlan_id`'; foreach (dbFetchRows($sql) as $mac_count) { if (!isset($vlans[$mac_count['vlan_id']])) { //print_error("Unknown VLAN ID '".$mac_count['vlan_id']."' with ".$mac_count['count']." mac count."); print_debug("Unknown VLAN ID '" . $mac_count['vlan_id'] . "' with " . $mac_count['count'] . " mac count."); continue; } $vlans[$mac_count['vlan_id']]['counts']['macs'] = $mac_count['count']; } ksort($vlans); return $vlans; } function print_vlan_ports_row($device, $vlan, $vars) { if (!is_numeric($vlan['vlan_vlan'])) { return; } if (!isset($device['device_id']) && isset($vlan['device_id'])) { $device = device_by_id_cache($vlan['device_id']); } $graph_type = isset($vars['graph']) ? 'port_' . $vars['graph'] : 'port_bits'; $filters = $vars['filters'] ?? [ 'deleted' => TRUE ]; echo('