revert r1957 patch

git-svn-id: http://www.observium.org/svn/observer/trunk@1960 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2011-03-23 09:54:56 +00:00
parent 459af33c43
commit de7ff537cc
43 changed files with 3461 additions and 3452 deletions

View File

@@ -53,6 +53,7 @@ if (isset($argv[1]) && $argv[1])
if (isSNMPable($device))
{
$snmphost = snmp_get($device, "sysName.0", "-Oqv", "SNMPv2-MIB");
if ($snmphost == "" || ($snmphost && ($snmphost == $host || $hostshort = $host)))
{
$added = createHost ($host, $community, $snmpver, $port, $transport);

View File

@@ -6,6 +6,7 @@ include("includes/functions.php");
$sql = "SELECT * FROM devices AS D, services AS S WHERE S.device_id = D.device_id ORDER by D.device_id DESC";
$query = mysql_query($sql);
while ($service = mysql_fetch_array($query))
{
if ($service['status'] = "1")
@@ -65,4 +66,5 @@ while ($service = mysql_fetch_array($query))
rrdtool_update($rrd,"N:".$status);
}
} # while
?>

View File

@@ -11,6 +11,7 @@ $query = "SELECT *,A.id as id FROM ipv4_addresses AS A, ports as I, devices as D
WHERE A.interface_id = I.interface_id AND I.device_id = D.device_id AND D.status = '1'";
$data = mysql_query($query);
while ($row = mysql_fetch_array($data))
{
$addr = Net_IPv4::parseAddress($row['ipv4_address']."/".$row['ipv4_prefixlen']);
@@ -39,13 +40,16 @@ while ($device = mysql_fetch_array($query))
$oids = str_replace("\"", "", $oids); $oids = trim($oids);
unset($valid_ips);
foreach (explode("\n", $oids) as $data) {
$data = trim($data);
list($ipv6addr,$ifIndex) = explode(" ", $data);
$valid_ips[] = $ipv6addr;
}
$sql = "SELECT * FROM ip6addr AS A, ports AS I, devices as D WHERE A.interface_id = I.interface_id AND I.device_id = '".$device['device_id']."'";
$data = mysql_query($sql);
while ($row = mysql_fetch_array($data))
{
echo($row['ipv6_address'] . "\n");
@@ -60,6 +64,7 @@ while ($device = mysql_fetch_array($query))
$query = "SELECT * FROM ports AS I, devices as D WHERE I.device_id = D.device_id AND D.status = '1'";
$data = mysql_query($query);
while ($row = mysql_fetch_array($data))
{
$index = $row['ifIndex'];
@@ -80,6 +85,7 @@ while ($row = mysql_fetch_array($data))
echo(mysql_result(mysql_query("SELECT COUNT(*) FROM `ports`"), 0) . " ports at start\n");
$interface_query = mysql_query("SELECT interface_id,device_id FROM `ports`");
while ($interface = mysql_fetch_array($interface_query))
{
$device_id = $interface['device_id'];
@@ -95,6 +101,7 @@ echo(mysql_result(mysql_query("SELECT COUNT(*) FROM `ports`"), 0) . " ports at e
echo(mysql_result(mysql_query("SELECT COUNT(id) FROM `links`"), 0) . " links at start\n");
$link_query = mysql_query("SELECT id,local_interface_id,remote_interface_id FROM `links`");
while ($link = mysql_fetch_array($link_query))
{
$id = $link['id'];
@@ -110,6 +117,7 @@ echo(mysql_result(mysql_query("SELECT COUNT(id) FROM `links`"), 0) . " links at
echo(mysql_result(mysql_query("SELECT COUNT(adj_id) FROM `adjacencies`"), 0) . " adjacencies at start\n");
$link_query = mysql_query("SELECT * FROM `adjacencies` AS A, `ports` AS I, `devices` AS D, networks AS N WHERE I.interface_id = A.interface_id AND D.device_id = I.device_id AND N.id = A.network_id");
while ($link = mysql_fetch_array($link_query))
{
$id = $link['adj_id'];

View File

@@ -23,12 +23,7 @@ $config['log_file'] = $config['install_dir'] . "/observium.log";
#$config['rrdcached'] = "unix:/var/run/rrdcached.sock";
### Default community
$config['snmp']['community'][] = "public";
### Enable php_snmp
# Enable php_snmp functions to make gets faster
# Often doesn't work, because jwh can't code for shit,
$config['snmp']['internal'] = false;
$config['snmp']['community'] = array("public");
### Authentication Model
$config['auth_mechanism'] = "mysql"; # default, other options: ldap, http-auth

View File

@@ -145,7 +145,6 @@ $discovered_devices = 0;
$device_query = mysql_query("SELECT * FROM `devices` WHERE status = 1 AND disabled = 0 $where ORDER BY device_id DESC");
while ($device = mysql_fetch_array($device_query))
{
$device_start = utime(); // Start counting device poll time
echo($device['hostname'] . " ".$device['device_id']." ".$device['os']." ");

View File

@@ -19,10 +19,13 @@ include("includes/authenticate.inc.php");
if (!$_SESSION['authenticated']) { echo("unauthenticated"); exit; }
if ($_GET['query'] && $_GET['cmd']) {
if ($_GET['query'] && $_GET['cmd'])
{
$host = $_GET['query'];
if (Net_IPv6::checkIPv6($host)||Net_IPv4::validateip($host)||preg_match("/^[a-zA-Z0-9.-]*$/", $host)) {
switch ($_GET['cmd']) {
if (Net_IPv6::checkIPv6($host)||Net_IPv4::validateip($host)||preg_match("/^[a-zA-Z0-9.-]*$/", $host))
{
switch ($_GET['cmd'])
{
case 'whois':
$cmd = $config['whois'] . " $host | grep -v \%";
break;

View File

@@ -92,7 +92,9 @@ include("overview/sensors/frequencies.inc.php");
include("overview/sensors/current.inc.php");
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
echo("<p style='padding: 0px 5px 5px;' class=sectionhead><img align='absmiddle' src='".$config['base_url']."/images/16/report.png'> Recent Events</p>");
echo("<p style='padding: 0px 5px 5px;' class=sectionhead>");
echo('<a class="sectionhead" href="device/'.$device['device_id'].'/events/">');
echo("<img align='absmiddle' src='".$config['base_url']."/images/16/report.png'> Recent Events</a></p>");
$query = "SELECT *,DATE_FORMAT(datetime, '%d/%b/%y %T') as humandate FROM `eventlog` WHERE `host` = '$_GET[id]' ORDER BY `datetime` DESC LIMIT 0,10";
$data = mysql_query($query);

View File

@@ -1,6 +1,5 @@
<?php
## Common Functions
function get_port_by_id($port_id)