diff --git a/cron.sh b/cron.sh
index 6906210a78..43788cf6ae 100755
--- a/cron.sh
+++ b/cron.sh
@@ -1,5 +1,6 @@
#!/bin/bash
+./discovery.php --forced >> /var/log/observer.log
./poll-mac_accounting.php >> /var/log/observer.log &
./discover-bgp_peers.php >> /var/log/observer.log &
./poll-device.php --odd >> /var/log/observer.log &
diff --git a/discovery.php b/discovery.php
index 9558f5dd3c..187bf44a88 100755
--- a/discovery.php
+++ b/discovery.php
@@ -21,9 +21,10 @@ if($argv[1] == "--device" && $argv[2]) {
} elseif ($argv[1] == "--all") {
$where = "";
} elseif ($argv[1] == "--forced") {
+ echo("Doing forced discoveries\n");
$sql = mysql_query("SELECT * FROM devices_attribs AS A, `devices` AS D WHERE A.attrib_type = 'discover' AND A.device_id = D.device_id AND D.ignore = '0' AND D.disabled = '0'");
while($device = mysql_fetch_array($sql)){
- shell_exec("./discover --device " . $device['device_id']);
+ echo(shell_exec("./discovery.php --device " . $device['device_id']));
}
exit;
} else {
diff --git a/html/includes/print-interface.inc b/html/includes/print-interface.inc
index 084a355348..8fa7e0ae52 100644
--- a/html/includes/print-interface.inc
+++ b/html/includes/print-interface.inc
@@ -5,7 +5,7 @@
$interface['device_id'] = $device['device_id'];
$interface['hostname'] = $device['hostname'];
- if(!$graph_type) { $graph_type = "bits"; }
+ if(!$_GET['type']) { $_GET['type'] = "bits"; }
$if_id = $interface['interface_id'];
@@ -19,13 +19,16 @@
$ifHardType = $interface['ifHardType'];
if($ifAlias) {$ifAlias = $ifAlias . "";}
- if($bg == "#e5e5e5") { $bg = "#ffffff"; } else { $bg="#e5e5e5"; }
+ if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; }
if($interface['in_errors'] > 0 || $interface['out_errors'] > 0) {
$error_img = generateiflink($interface,"
",errors);
} else { $error_img = ""; }
- echo("
+# $graph_url = "graph.php?if=$if_id&from=$twoday&to=$now&width=400&height=120&type=bits";
+
+
+ echo("
");
echo("
@@ -207,19 +210,19 @@ echo(" | ");
// If we're showing graphs, generate the graph and print the img tags
if($dographs && is_file($config['rrd_dir'] . "/" . $hostname . "/". $ifIndex . ".rrd")) {
- $type = $graph_type;
+ $type = $_GET['type'];
- $daily_traffic = "graph.php?if=$if_id&type=" . $graph_type . "&from=$day&to=$now&width=210&height=100";
- $daily_url = "graph.php?if=$if_id&type=" . $graph_type . "&from=$day&to=$now&width=500&height=150";
+ $daily_traffic = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$day&to=$now&width=210&height=100";
+ $daily_url = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$day&to=$now&width=500&height=150";
- $weekly_traffic = "graph.php?if=$if_id&type=" . $graph_type . "&from=$week&to=$now&width=210&height=100";
- $weekly_url = "graph.php?if=$if_id&type=" . $graph_type . "&from=$week&to=$now&width=500&height=150";
+ $weekly_traffic = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$week&to=$now&width=210&height=100";
+ $weekly_url = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$week&to=$now&width=500&height=150";
- $monthly_traffic = "graph.php?if=$if_id&type=" . $graph_type . "&from=$month&to=$now&width=210&height=100";
- $monthly_url = "graph.php?if=$if_id&type=" . $graph_type . "&from=$month&to=$now&width=500&height=150";
+ $monthly_traffic = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$month&to=$now&width=210&height=100";
+ $monthly_url = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$month&to=$now&width=500&height=150";
- $yearly_traffic = "graph.php?if=$if_id&type=" . $graph_type . "&from=$year&to=$now&width=210&height=100";
- $yearly_url = "graph.php?if=$if_id&type=" . $graph_type . "&from=$year&to=$now&width=500&height=150";
+ $yearly_traffic = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$year&to=$now&width=210&height=100";
+ $yearly_url = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$year&to=$now&width=500&height=150";
echo("
");
diff --git a/includes/functions.php b/includes/functions.php
index adcf0289f5..3558b7e995 100755
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -571,7 +571,9 @@ function createHost ($host, $community, $snmpver, $port = 161){
if($host_os) {
$sql = mysql_query("INSERT INTO `devices` (`hostname`, `sysName`, `community`, `port`, `os`, `status`) VALUES ('$host', '$host', '$community', '$port', '$host_os', '1')");
if(mysql_affected_rows()) {
- return("Created host : $host ($host_os)");
+ $device_id = mysql_result(mysql_query("SELECT device_id FROM devices WHERE hostname = '$host'"),0);
+ mysql_query("INSERT INTO devices_attribs (attrib_type, attrib_value, device_id) VALUES ('discover','1','$device_id')");
+ return("Created host : $host (id:$device_id) (os:$host_os)");
} else { return FALSE; }
} else {
return FALSE;
|