From 3f392bcd71d8344e1b8665ec7997edd434fbc25e Mon Sep 17 00:00:00 2001
From: Adam Amstrong
Date: Wed, 25 Mar 2009 14:54:21 +0000
Subject: [PATCH] fixes
git-svn-id: http://www.observium.org/svn/observer/trunk@381 61d68cd4-352d-0410-923a-c4978735b2b8
---
discovery.php | 7 +++++++
html/pages/addhost.php | 11 ++++++-----
includes/discovery/cisco-vlans.php | 1 -
3 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/discovery.php b/discovery.php
index e5b012bc9..9558f5dd3 100755
--- a/discovery.php
+++ b/discovery.php
@@ -20,6 +20,12 @@ if($argv[1] == "--device" && $argv[2]) {
$where = "AND MOD(device_id,2) = 0";
} elseif ($argv[1] == "--all") {
$where = "";
+} elseif ($argv[1] == "--forced") {
+ $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']);
+ }
+ exit;
} else {
echo("--device Poll single device\n");
echo("--os Poll all devices of a given OS\n");
@@ -65,6 +71,7 @@ while ($device = mysql_fetch_array($device_query)) {
}
echo("\n"); $devices_polled++;
+ mysql_query("DELETE FROM `devices_attribs` WHERE `device_id` = '".$device['device_id']."' AND `attrib_type` = 'discover'");
}
$end = utime(); $run = $end - $start;
diff --git a/html/pages/addhost.php b/html/pages/addhost.php
index c1734dfcc..37b6c7ac2 100644
--- a/html/pages/addhost.php
+++ b/html/pages/addhost.php
@@ -7,17 +7,17 @@ exit;
}
-echo("Add Device
");
+echo("Add Device
");
if($_POST['hostname'] && $_POST['community']) {
if($_SESSION['userlevel'] > '5') {
$hostname = mres($_POST['hostname']);
$community = mres($_POST['community']);
$snmpver = mres($_POST['snmpver']);
+ if($_POST['port']) { $port = mres($_POST['port']); } else { $port = "161"; }
echo("");
- echo("Adding host $hostname community $community
");
- $result = addHost($hostname, $community, $snmpver);
- echo("$result");
+ echo("Adding host $hostname community $community port $port
");
+ $result = addHost($hostname, $community, $snmpver, $port);
echo("");
} else {
echo("Error: You don't have the necessary privileges to add hosts.
");
@@ -30,7 +30,7 @@ echo("Error: A hostname is required.
");
?>
-