Example #1
0
                }
            case 'state':
                if ($value == "down") {
                    $where .= "AND `ifAdminStatus` = ? AND `ifOperStatus` = ?";
                    $param[] = "up";
                    $param[] = "down";
                } elseif ($value == "up") {
                    $where .= "AND `ifAdminStatus` = ? AND ( `ifOperStatus` = ? OR `ifOperStatus` = ? )";
                    $param[] = "up";
                    $param[] = "up";
                    $param[] = "monitoring";
                } elseif ($value == "admindown") {
                    $where .= "AND `ifAdminStatus` = ?";
                    $param[] = "down";
                }
                break;
        }
    }
}
$sql = "SELECT " . $select;
$sql .= " FROM `ports`";
$sql .= " INNER JOIN `devices` ON `ports`.`device_id` = `devices`.`device_id`";
$sql .= " LEFT JOIN `ports-state` ON `ports`.`port_id` = `ports-state`.`port_id`";
$sql .= " " . $where;
$row = 1;
$ports = dbFetchRows($sql, $param);
port_permitted_array($ports);
$ports_count = count($ports);
include $config['html_dir'] . '/includes/port-sort.inc.php';
include $config['html_dir'] . '/pages/ports/' . $vars['format'] . '.inc.php';
// EOF
            $cache['locations']['entries'][$device['location_country']]['entries'][$device['location_state']]['count']++;
            $cache['locations']['entries'][$device['location_country']]['entries'][$device['location_state']]['level'] = 'location_state';
            $cache['locations']['entries'][$device['location_country']]['entries'][$device['location_state']]['entries'][$device['location_county']]['count']++;
            $cache['locations']['entries'][$device['location_country']]['entries'][$device['location_state']]['entries'][$device['location_county']]['level'] = 'location_county';
            $cache['locations']['entries'][$device['location_country']]['entries'][$device['location_state']]['entries'][$device['location_county']]['entries'][$device['location_city']]['count']++;
            $cache['locations']['entries'][$device['location_country']]['entries'][$device['location_state']]['entries'][$device['location_county']]['entries'][$device['location_city']]['level'] = 'location_city';
            $cache['locations']['entries'][$device['location_country']]['entries'][$device['location_state']]['entries'][$device['location_county']]['entries'][$device['location_city']]['entries'][$device['location']]['count']++;
            $cache['locations']['entries'][$device['location_country']]['entries'][$device['location_state']]['entries'][$device['location_county']]['entries'][$device['location_city']]['entries'][$device['location']]['level'] = 'location';
        }
    }
}
// Ports
$ports = array('count' => 0, 'up' => 0, 'down' => 0, 'ignored' => 0, 'disabled' => 0, 'errored' => 0, 'alerts' => 0, 'deleted' => 0);
$cache['ports'] = array('permitted' => array(), 'ignored' => array(), 'errored' => array(), 'poll_disabled' => array(), 'device_ignored' => array(), 'device_disabled' => array(), 'deleted' => array());
$ports_array = dbFetchRows("SELECT `device_id`, `ports`.`port_id`, `ifAdminStatus`, `ifOperStatus`, `deleted`, `ignore`, `ifOutErrors_delta`, `ifInErrors_delta` FROM `ports`\n                            LEFT JOIN `ports-state` ON `ports`.`port_id` = `ports-state`.`port_id`");
port_permitted_array($ports_array);
foreach ($ports_array as $port) {
    if (!$config['web_show_disabled']) {
        if ($cache['devices']['id'][$port['device_id']]['disabled']) {
            $cache['ports']['device_disabled'][] = (int) $port['port_id'];
            // Collect IDs for disabled device
            continue;
        }
    }
    if ($port['deleted']) {
        $ports['deleted']++;
        $cache['ports']['deleted'][] = (int) $port['port_id'];
        // Collect IDs for deleted
        continue;
        // Complete don't count port if it deleted
    }