sid3windr updates!

git-svn-id: http://www.observium.org/svn/observer/trunk@588 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2010-01-03 20:13:10 +00:00
parent 5877e94093
commit ce9ddb4ae5
8 changed files with 98 additions and 75 deletions

View File

@@ -69,3 +69,5 @@ ALTER TABLE `entPhysical` ADD `entPhysicalHardwareRev` VARCHAR( 16 ) NULL AFTER
ALTER TABLE `devices` ADD `last_discovered` timestamp NULL DEFAULT NULL AFTER `last_polled`;
ALTER TABLE `devices` CHANGE `lastchange` `uptime` BIGINT NULL DEFAULT NULL;
ALTER TABLE `storage` ADD `hrStorageType` VARCHAR( 32 ) NULL DEFAULT NULL AFTER `hrStorageIndex`
ALTER TABLE `devices` MODIFY `type` varchar(8) DEFAULT "unknown";

View File

@@ -1,7 +1,7 @@
<div style='margin:auto; text-align: center; margin-top: 0px; margin-bottom: 10px;'>
<b class='rounded'>
<b class='rounded1'><b></b></b>
<b class='rounded2'><b></b></b>
<b class='rounded1'></b>
<b class='rounded2'></b>
<b class='rounded3'></b>
<b class='rounded4'></b>
<b class='rounded5'></b></b>
@@ -46,8 +46,8 @@
<b class='rounded5'></b>
<b class='rounded4'></b>
<b class='rounded3'></b>
<b class='rounded2'><b></b></b>
<b class='rounded1'><b></b></b></b>
<b class='rounded2'></b>
<b class='rounded1'></b></b>
</div>
@@ -90,11 +90,11 @@ while($interface = mysql_fetch_array($query)) {
if( interfacepermitted($interface['interface_id']) )
{
echo("<tr bgcolor=$row_colour>
<td class=list-bold>" . generatedevicelink($interface) . "</td>
<td class=list-bold>" . generateiflink($interface, makeshortif(fixifname($interface['ifDescr']))) . " $error_img</td>
<td>" . $interface['ipv4_address'] . "/".$length."</td>
<td>" . $interface['ifAlias'] . "</td>
echo('<tr bgcolor="' . $row_colour . '">
<td class="list-bold">' . generatedevicelink($interface) . '</td>
<td class="list-bold">' . generateiflink($interface, makeshortif(fixifname($interface['ifDescr']))) . ' ' . $error_img . '</td>
<td>' . $interface['ipv4_address'] . '/'.$length.'</td>
<td>' . $interface['ifAlias'] . "</td>
</tr>\n");
$row++;

View File

@@ -1,59 +1,60 @@
<?php
echo("
<div style='margin:auto; text-align: center; margin-top: 20px; max-width:420px'>
<b class='rounded'>
<b class='rounded1'><b></b></b>
<b class='rounded2'><b></b></b>
<b class='rounded3'></b>
<b class='rounded4'></b>
<b class='rounded5'></b></b>
<div class='roundedfg' style='padding-left:10px;'>
<div style='margin: auto; width:350px; padding:5px;'>
<table border='0' cellpadding='0' cellspacing='0'>
<tr>
<td width=128><img src='images/password.png'></td>
<td>
<form action='". $_SERVER['REQUEST_URI'] ."' method=post>
<h3>Please log in:</h3>
<div style='height: 0px;'></div>
<table border=0 align=left>
<tr>
<td>Username</td>
<td><input type='text' name='username'></td>
</tr>
<tr>
<td>Password</td>
<td><input type='password' name='password'></td>
</tr>
<tr>
<td colspan='2' align='right'><input type='checkbox' name='remember'>
<font size='2'>Remember Me</td>
<tr>
<td colspan=2 align='right'><input name='submit' type='submit' value='Login'></td>
</tr>");
if($auth_message) {
echo("<tr><td colspan=2><span style='font-weight: bold; color: #cc0000;'>$auth_message</span></td></tr>");
}
echo(" </table>
</form></td>
</tr>
</table>
</div>
</div>
<b class='rounded'>
<b class='rounded5'></b>
<b class='unded4'></b>
<b class='rounded3'></b>
<b class='rounded2'><b></b></b>
<b class='rounded1'><b></b></b></b>
</div>");
if($config['login_message']) {
echo("<div style='margin: auto; text-align: center; font-weight: bold; color: #cc0000; width: 470px;'>".$config['login_message']."</div>");
}
?>
<div style="margin:auto; text-align: center; margin-top: 20px; max-width:420px">
<b class='rounded'>
<b class='rounded1'><b></b></b>
<b class='rounded2'><b></b></b>
<b class='rounded3'></b>
<b class='rounded4'></b>
<b class='rounded5'></b></b>
<div class="roundedfg" style="padding-left:10px;">
<div style="margin: auto; width:350px; padding:5px;">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width=128><img src="images/password.png"></td>
<td>
<form action="<?php echo $_SERVER['REQUEST_URI'] ?>" method="post" name="logonform">
<h3>Please log in:</h3>
<div style="height: 0px;"></div>
<table border="0" align="left">
<tr>
<td>Username</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="password"></td>
</tr>
<tr>
<td colspan="2" align="right"><input type="checkbox" name="remember">
<font size="2">Remember Me</td>
<tr>
<td colspan=2 align="right"><input name="submit" type="submit" value="Login"></td>
</tr>
<?php
if($auth_message) {
echo('<tr><td colspan="2" style="font-weight: bold; color: #cc0000;">' . $auth_message . '</td></tr>');
}
?>
</table>
</form></td>
</tr>
</table>
</div>
</div>
<b class='rounded'>
<b class='rounded5'></b>
<b class='unded4'></b>
<b class='rounded3'></b>
<b class='rounded2'><b></b></b>
<b class='rounded1'><b></b></b></b>
</div>
<?php
if($config['login_message']) {
echo('<div style="margin: auto; margin-top: 10px;text-align: center; font-weight: bold; color: #cc0000; width: 470px;">'.$config['login_message'].'</div>');
}
?>
<script type="text/javascript">
<!--
document.logonform.username.focus();
// -->
</script>

View File

@@ -35,15 +35,22 @@ while($temp = mysql_fetch_array($query)) {
$temp_perc = $temp['temp_current'] / $temp['temp_limit'] * 100;
$temp_colour = percent_colour($temp_perc);
$temp_minigraph = "<img src='graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$day&to=$now&width=100&height=20'>";
$temp_day = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$day&to=$now&width=300&height=100";
$temp_week = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$week&to=$now&width=300&height=100";
$temp_month = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$month&to=$now&width=300&height=100";
$temp_year = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$year&to=$now&width=300&height=100";
$temp_minigraph = "<img src='graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$day&to=$now&width=100&height=20'";
$temp_minigraph .= " onmouseover=\"return overlib('<div class=list-large>".$temp['hostname']." - ".$temp['temp_descr'];
$temp_minigraph .= "</div><div style=\'width: 750px\'><img src=\'$temp_day\'><img src=\'$temp_week\'><img src=\'$temp_month\'><img src=\'$temp_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
echo("<tr bgcolor=$row_colour>
<td class=list-bold>" . generatedevicelink($temp) . "</td>
<td>$temp_popup</td>
<td>$temp_minigraph</td>
<td style='color: $temp_colour; font-weight: bold;'>" . $temp['temp_current'] . "</td>
<td>" . $temp['temp_limit'] . "</td>
<td style='color: $temp_colour; text-align: center; font-weight: bold;'>" . $temp['temp_current'] . " &deg;C</td>
<td style='text-align: center'>" . $temp['temp_limit'] . " &deg;C</td>
<td>" . $temp['temp_notes'] . "</td>
</tr>\n");

View File

@@ -24,7 +24,7 @@
$peerlist[] = $device['device_id'] ." $peer_ip";
$astext = trim(str_replace("\"", "", shell_exec("/usr/bin/dig +short AS$peer_as.asn.cymru.com TXT | cut -d '|' -f 5 | sed s/\\\"//g")));
$astext = get_astext($peer_pas);
# echo(str_pad($peer_ip, 40) . " AS$peer_as ");
@@ -81,7 +81,7 @@
$peerlist[] = $device['device_id'] ." $peer_ip";
$astext = trim(str_replace("\"", "", shell_exec("/usr/bin/dig +short AS$peer_as.asn.cymru.com TXT | cut -d '|' -f 5 | sed s/\\\"//g")));
$astext = get_astext($peer_as);
#echo("$peer_ip AS$peer_as ");
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `bgpPeers` WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '$peer_ip'"),0) < '1') {

View File

@@ -11,7 +11,7 @@
if($data) {
$data = trim($data);
list($oid,$hrStorageIndex) = explode(" ", $data);
$temp = shell_exec($config['snmpget'] . " -m HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " hrStorageDescr.$oid hrStorageAllocationUnits.$oid hrStorageSize.$oid hrStorageType.$oid");
$temp = shell_exec($config['snmpget'] . " -m HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES -O sqv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " hrStorageDescr.$oid hrStorageAllocationUnits.$oid hrStorageSize.$oid hrStorageType.$oid");
$temp = trim($temp);
list($descr, $units, $size, $fstype) = explode("\n", $temp);
list($units) = explode(" ", $units);

View File

@@ -696,6 +696,10 @@ function discover_process_ipv6($ifIndex,$ipv6_address,$ipv6_prefixlen,$ipv6_orig
$ipv6_network = trim(shell_exec($config['sipcalc']." $ipv6_address/$ipv6_prefixlen | grep Subnet | cut -f 2 -d '-'"));
$ipv6_compressed = trim(shell_exec($config['sipcalc']." $ipv6_address/$ipv6_prefixlen | grep Compressed | cut -f 2 -d '-'"));
$ipv6_type = trim(shell_exec($config['sipcalc']." $ipv6_address/$ipv6_prefixlen | grep \"Address type\" | cut -f 2- -d '-'"));
if ($ipv6_type == "Link-Local Unicast Addresses") return; # ignore link-locals (coming from IPV6-MIB)
if (mysql_result(mysql_query("SELECT count(*) FROM `interfaces`
WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) != '0' && $ipv6_prefixlen > '0' && $ipv6_prefixlen < '129' && $ipv6_compressed != '::1') {
@@ -746,4 +750,11 @@ function duration($seconds, $max_periods = 6)
return implode(' ', $duration);
}
function get_astext($asn)
{
$result = dns_get_record("AS$asn.asn.cymru.com",DNS_TXT);
$txt = explode('|',$result[0]['txt']);
return trim(str_replace('"', '', $txt[4]));
}
?>

View File

@@ -24,7 +24,9 @@
} elseif ($device['os'] == "linux") {
list(,,$version) = explode (" ", $sysDescr);
if(strstr($sysDescr, "386")|| strstr($sysDescr, "486")||strstr($sysDescr, "586")||strstr($sysDescr, "686")) { $hardware = "Generic x86"; }
if(strstr($sysDescr, "x86_64")) { $hardware = "Generic x86 64-bit"; }
else if(strstr($sysDescr, "x86_64")) { $hardware = "Generic x86 64-bit"; }
else if(strstr($sysDescr, "sparc32")) { $hardware = "Generic SPARC 32-bit"; }
else if(strstr($sysDescr, "sparc64")) { $hardware = "Generic SPARC 64-bit"; }
$cmd = $config['snmpget'] . " -m UCD-SNMP-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port']. " .1.3.6.1.4.1.2021.7890.1.3.1.1.6.100.105.115.116.114.111";
$features = trim(`$cmd`);
$features = str_replace("No Such Object available on this agent at this OID", "", $features);