git-svn-id: http://www.observium.org/svn/observer/trunk@381 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2009-03-25 14:54:21 +00:00
parent 6adb378b42
commit 3f392bcd71
3 changed files with 13 additions and 6 deletions

View File

@@ -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 <device id> Poll single device\n");
echo("--os <os string> 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;

View File

@@ -7,17 +7,17 @@ exit;
}
echo("<h1>Add Device</h1>");
echo("<h2>Add Device</h2>");
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("<p class='messagebox'>");
echo("Adding host $hostname community $community</p>");
$result = addHost($hostname, $community, $snmpver);
echo("$result");
echo("Adding host $hostname community $community port $port</p>");
$result = addHost($hostname, $community, $snmpver, $port);
echo("</p>");
} else {
echo("<p class='errorbox'><b>Error:</b> You don't have the necessary privileges to add hosts.</p>");
@@ -30,7 +30,7 @@ echo("<p class='errorbox'><b>Error:</b> A hostname is required.</p>");
?>
<form name="form1" method="post" action="?page=addhost">
<form name="form1" method="post" action="<?php echo($config['base_url']); ?>/addhost/">
<p>Devices will be checked for Ping and SNMP reachability before being probed. Only devices with recognised OSes will be added.</p>
<div style="padding: 10px; background: #f0f0f0;">
@@ -48,6 +48,7 @@ echo("<p class='errorbox'><b>Error:</b> A hostname is required.</p>");
<option value="v1">v1</option>
<option value="v2c" selected>v2c</option>
</select>
&nbsp;<strong>Port</strong> <input type="text" name="port" size="16">
</td>
</tr>
<tr>

View File

@@ -3,7 +3,6 @@
echo("Cisco VLANs : ");
$vtpversion_cmd = $config['snmpget'] . " -Oqv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " .1.3.6.1.4.1.9.9.46.1.1.1.0";
echo("$vtpversion_cmd");
$vtpversion = trim(`$vtpversion_cmd 2>/dev/null`);
if($vtpversion == '1' || $vtpversion == '2' || $vtpversion == 'two' || $vtpversion == 'three') {