예제 #1
0
파일: cronjobs.php 프로젝트: wAmpIre/netmon
        $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
 */
echo "Clean database\n";
//Delete old Crawls
echo "Remove old crawl data\n";
Crawling::deleteOldCrawlDataExceptLastOnlineCrawl($GLOBALS['hours_to_keep_mysql_crawl_data'] * 60 * 60);
//Remove old events
echo "Remove old events\n";
//Get number of total events in db