Exemple #1
0
        $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
    } catch (PDOException $e) {
        echo $e->getMessage();
        echo $e->getTraceAsString();
    }
    foreach ($result as $interface) {
        echo "\tInserting offline data for interface " . $interface['name'] . "\n";
        $networkinterface_status = new NetworkinterfaceStatus(false, (int) $actual_crawl_cycle['id'], (int) $interface['id'], (int) $interface['router_id']);
        $networkinterface_status->store();
    }
    echo "Close old crawl cycle and create new one\n";
    //Create new crawl cycle and close old crawl cycle
    //Create new crawl cycle
    Crawling::newCrawlCycle();
    //Close old Crawl cycle
    Crawling::closeCrawlCycle($actual_crawl_cycle['id']);
    echo "Create graph statistics\n";
    //Make statistic graphs
    $online = Router_old::countRoutersByCrawlCycleIdAndStatus($actual_crawl_cycle['id'], 'online');
    $offline = Router_old::countRoutersByCrawlCycleIdAndStatus($actual_crawl_cycle['id'], 'offline');
    $unknown = Router_old::countRoutersByCrawlCycleIdAndStatus($actual_crawl_cycle['id'], 'unknown');
    $total = $unknown + $offline + $online;
    RrdTool::updateNetmonHistoryRouterStatus($online, $offline, $unknown, $total);
    $client_count = Router_old::countRoutersByCrawlCycleId($actual_crawl_cycle['id']);
    RrdTool::updateNetmonClientCount($client_count);
} else {
    echo "There is an crawl cycle running actually. Doing nothing.\n";
}
/**
 * Clean database
 */