} catch (PDOException $e) { echo $e->getMessage(); } $nodewatcher_versions_count = array(); foreach ($nodewatcher_versions as $key => $nodewatcher_version) { $nodewatcher_versions_count[$key]['nodewatcher_version'] = $nodewatcher_version['nodewatcher_version']; try { $stmt = DB::getInstance()->prepare("SELECT COUNT(*) as count\n\t\t\t\t\t\t\t FROM crawl_routers\n\t\t\t\t\t\t\t WHERE crawl_cycle_id=? AND status='online' AND nodewatcher_version=?"); $stmt->execute(array($last_ended_crawl_cycle['id'], $nodewatcher_versions_count[$key]['nodewatcher_version'])); $count = $stmt->fetch(PDO::FETCH_ASSOC); } catch (PDOException $e) { echo $e->getMessage(); } $nodewatcher_versions_count[$key]['count'] = $count['count']; } $smarty->assign('nodewatcher_versions_count', $nodewatcher_versions_count); //Count router statuses $online = Router_old::countRoutersByCrawlCycleIdAndStatus($last_ended_crawl_cycle['id'], 'online'); $offline = Router_old::countRoutersByCrawlCycleIdAndStatus($last_ended_crawl_cycle['id'], 'offline'); $unknown = Router_old::countRoutersByCrawlCycleIdAndStatus($last_ended_crawl_cycle['id'], 'unknown'); $total = $unknown + $offline + $online; $smarty->assign('router_status_online', $online); $smarty->assign('router_status_offline', $offline); $smarty->assign('router_status_unknown', $unknown); $smarty->assign('router_status_total', $total); $smarty->assign('clients_connected', Router_old::countRoutersByCrawlCycleId($last_ended_crawl_cycle['id'])); } /** Display templates **/ $smarty->display("header.tpl.html"); $smarty->display("networkstatistic.tpl.html"); $smarty->display("footer.tpl.html");
$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 $total_count = new Eventlist();