Commit 8101f3f9 authored by Clemens John's avatar Clemens John

Move crawl interfaces from hardcoded config to dynamic db config, add router...

Move crawl interfaces from hardcoded config to dynamic db config, add router status page interface whitelist
Signed-off-by: Clemens John's avatarClemens John <clemens.john@floh1111.de>
parent 1c7b86a0
......@@ -55,6 +55,9 @@ if(Permission::checkPermission(PERM_ROOT)) {
$smarty->assign('hours_to_keep_mysql_crawl_data', ConfigLine::configByName('hours_to_keep_mysql_crawl_data'));
$smarty->assign('hours_to_keep_history_table', ConfigLine::configByName('hours_to_keep_history_table'));
$smarty->assign('crawl_cycle_length_in_minutes', ConfigLine::configByName('crawl_cycle_length_in_minutes'));
$smarty->assign('crawl_interfaces', ConfigLine::configByName('crawl_interfaces'));
$smarty->assign('router_status_interface_whitelist', ConfigLine::configByName('router_status_interface_whitelist'));
$smarty->assign('message', Message::getMessage());
$smarty->display("header.tpl.html");
......@@ -77,6 +80,8 @@ if(Permission::checkPermission(PERM_ROOT)) {
Config::writeConfigLine('hours_to_keep_mysql_crawl_data', $_POST['hours_to_keep_mysql_crawl_data']);
Config::writeConfigLine('hours_to_keep_history_table', $_POST['hours_to_keep_history_table']);
Config::writeConfigLine('crawl_cycle_length_in_minutes', $_POST['crawl_cycle_length_in_minutes']);
Config::writeConfigLine('crawl_interfaces', $_POST['crawl_interfaces']);
Config::writeConfigLine('router_status_interface_whitelist', $_POST['router_status_interface_whitelist']);
$message[] = array('Die Daten wurden gespeichert.', 1);
Message::setMessage($message);
......
......@@ -33,7 +33,8 @@
$ping_hard_timeout = 2; // set the timout for each ping command to X s
$crawl_timeout = 18; // timeout after X seconds on fetching crawldata
$network_connection_ipv6_interface = ConfigLine::configByName("network_connection_ipv6_interface"); //use this interface to connect to ipv6 linc local hosts
$interfaces_used_for_crawling = array("br-mesh", "br-client", "floh_fix", "tata_fix"); //use the ip adresses of these interfaces for crawling
$crawl_interfaces = explode(",", ConfigLine::configByName("crawl_interfaces"));
//array("br-mesh", "br-client", "floh_fix", "tata_fix"); //use the ip adresses of these interfaces for crawling
$actual_crawl_cycle = Crawling::getActualCrawlCycle()['id'];
......@@ -42,7 +43,7 @@
echo " ping_timeout: $ping_timeout\n";
echo " crawl_timeout: $crawl_timeout\n";
echo " network_connection_ipv6_interface: $network_connection_ipv6_interface\n";
echo " interfaces_used_for_crawling: "; foreach($interfaces_used_for_crawling as $iface) echo $iface; echo "\n";
echo " interfaces_used_for_crawling: "; foreach($crawl_interfaces as $iface) echo $iface." "; echo "\n";
echo " actual_crawl_cycle: ".$actual_crawl_cycle."\n";
//fetch all routers that need to be crawled by a crawler. Respect offset and limit!
......@@ -50,7 +51,7 @@
(int)$router_offset, (int)$router_limit, "router_id", "asc");
foreach($routerlist->getRouterlist() as $key=>$router) {
echo ($key+1).". crawling Router ".$router->getHostname()." (".$router->getRouterId().")\n";
foreach($interfaces_used_for_crawling as $name) {
foreach($crawl_interfaces as $name) {
echo " Fetching IP-Addresses of interface ".$name."\n";
$networkinterface = new Networkinterface(false, $router->getRouterId(), $name);
if($networkinterface->fetch()) {
......
......@@ -20,7 +20,7 @@ class Crawl {
/**Insert Router Interfaces*/
foreach($data['interface_data'] as $sendet_interface) {
if (!Validation::isValidInterfaceName($sendet_interface['name']))
if (!in_array($sendet_interface['name'], explode(",", ConfigLine::configByName('router_status_interface_whitelist'))))
continue;
//Update RRD Graph DB
......
......@@ -7,6 +7,8 @@
<p>Stunden nach denen Crawl Daten gelöscht werden sollen:<br><input name="hours_to_keep_mysql_crawl_data" type="text" size="30" value="{$hours_to_keep_mysql_crawl_data}"></p>
<p>Stunden nach denen die History gelöscht werden soll:<br><input name="hours_to_keep_history_table" type="text" size="30" value="{$hours_to_keep_history_table}"></p>
<p>Länge eines Crawl Zyklus in Minuten:<br><input name="crawl_cycle_length_in_minutes" type="text" size="30" value="{$crawl_cycle_length_in_minutes}"></p>
<p>Crawl Interfaces:<br><input name="crawl_interfaces" type="text" size="30" value="{$crawl_interfaces}"></p>
<p>Router Status Interface Whitelist:<br><input name="router_status_interface_whitelist" type="text" size="30" value="{$router_status_interface_whitelist}"></p>
<p><input type="submit" value="Absenden"></p>
</form>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment