lots of fixes for non-webroot installations

git-svn-id: http://www.observium.org/svn/observer/trunk@362 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2009-03-23 17:32:25 +00:00
parent 9a8c885adf
commit 44d1431f94
15 changed files with 214 additions and 182 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
./discovery.php --even &
./discovery.php --odd &
./update-interface.php
#./discover-cdp.php
./discover-cdp.php
./cleanup.php
./generate-map.sh
./check-errors.php
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash
./map.php > map.dot && unflatten -l5 -f map.dot | dot -Tpng -o html/network-big.png && convert -resize 400x500 html/network-big.png html/network.png
./map.php > map.dot && unflatten -l5 -f map.dot | fdp -Tpng -o html/network-big.png && convert -resize 400x500 html/network-big.png html/network.png
#./map.php > map.dot && unflatten -l5 -f map.dot | circo -Tpng -o html/network-screen-big.png && convert -resize 900x2000 html/network-screen-big.png html/network-screen.png
+8 -8
View File
@@ -6,17 +6,17 @@
if(!$device) { $device['device_id'] = getifhost($interface['interface_id']); }
$daily_traffic = "graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$day&to=$now&width=215&height=100";
$daily_url = "graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150";
$daily_traffic = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$day&to=$now&width=215&height=100";
$daily_url = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150";
$weekly_traffic = "graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$week&to=$now&width=215&height=100";
$weekly_url = "graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$week&to=$now&width=500&height=150";
$weekly_traffic = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$week&to=$now&width=215&height=100";
$weekly_url = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$week&to=$now&width=500&height=150";
$monthly_traffic = "graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$month&to=$now&width=215&height=100";
$monthly_url = "graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150";
$monthly_traffic = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$month&to=$now&width=215&height=100";
$monthly_url = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150";
$yearly_traffic = "graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$year&to=$now&width=215&height=100";
$yearly_url = "graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150";
$yearly_traffic = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$year&to=$now&width=215&height=100";
$yearly_url = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150";
echo("<a href='/device/".$device['device_id']."/interface/".$interface['interface_id']."/' onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">
<img src='$daily_traffic' border=0></a> ");
+1 -1
View File
@@ -39,7 +39,7 @@ if($_GET['bill']) {
echo("
<tr bgcolor='$bg'>
<td width='7'></td>
<td width='250'><a href='/bill/".$bill['bill_id']."'><span style='font-weight: bold;' class=interface>".$bill['bill_name']."</span></a></td>
<td width='250'><a href='".$config['base_url']."/bill/".$bill['bill_id']."'><span style='font-weight: bold;' class=interface>".$bill['bill_name']."</span></a></td>
<td>$notes</td>
<td>$type</td>
<td>$allowed</td>
+16 -16
View File
@@ -25,13 +25,13 @@ echo("<div class=mainpane>");
echo("
<ul id='maintab' class='shadetabs'>
<li class=" . $select['overview'] . ">
<a href='/device/" . $device['device_id'] . "/overview/'>
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/overview/'>
<img src='images/16/server_lightning.png' align=absmiddle border=0> Overview
</a>
</li>");
echo("<li class=" . $select['graphs'] . ">
<a href='/device/" . $device['device_id'] . "/graphs/'>
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/graphs/'>
<img src='images/16/server_chart.png' align=absmiddle border=0> Graphs
</a>
</li>
@@ -40,7 +40,7 @@ echo("<li class=" . $select['graphs'] . ">
if(@mysql_result(mysql_query("select count(vlan_id) from vlans WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') {
echo("
<li class=" . $select['vlans'] . ">
<a href='/device/" . $device['device_id'] . "/vlans/'>
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/vlans/'>
<img src='images/16/vlans.png' align='absmiddle' border='0'> VLANs
</a>
</li>");
@@ -49,7 +49,7 @@ if(@mysql_result(mysql_query("select count(vlan_id) from vlans WHERE device_id =
if(@mysql_result(mysql_query("select count(*) from vrfs WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') {
echo("
<li class=" . $select['vrfs'] . ">
<a href='/device/" . $device['device_id'] . "/vrfs/'>
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/vrfs/'>
<img src='images/16/layers.png' align=absmiddle border=0> VRFs
</a>
</li>");
@@ -59,7 +59,7 @@ if(@mysql_result(mysql_query("select count(*) from vrfs WHERE device_id = '" . $
if($config['enable_bgp'] && $device['bgpLocalAs']) {
echo("
<li class=" . $select['bgp'] . ">
<a href='/device/" . $device['device_id'] . "/bgp/'>
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/bgp/'>
<img src='images/16/link.png' align=absmiddle border=0> BGP
</a>
</li>");
@@ -68,12 +68,12 @@ if($config['enable_bgp'] && $device['bgpLocalAs']) {
if(@mysql_result(mysql_query("select count(interface_id) from interfaces WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') {
echo("
<li class=" . $select['ifs'] . ">
<a href='/device/" . $device['device_id'] . "/ifs/'>
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ifs/'>
<img src='images/16/server_link.png' align=absmiddle border=0> Ports
</a>
</li>
<li class=" . $select['ifgraphs'] . ">
<a href='/device/" . $device['device_id'] . "/ifgraphs/'>
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ifgraphs/'>
<img src='images/16/chart_curve_link.png' align=absmiddle border=0> Port Graphs
</a>
</li>");
@@ -82,7 +82,7 @@ if(@mysql_result(mysql_query("select count(interface_id) from interfaces WHERE d
if($_SESSION[userlevel] >= "5") {
echo("
<li class=" . $select['map'] . ">
<a href='/device/" . $device['device_id'] . "/map/'>
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/map/'>
<img src='images/16/chart_organisation.png' align=absmiddle border=0> Map
</a>
</li>
@@ -92,7 +92,7 @@ if($_SESSION[userlevel] >= "5") {
if($config['enable_inventory'] && @mysql_result(mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$_GET['id']."'"), 0) > '0') {
echo("<li class=" . $select['entphysical'] . ">
<a href='/device/" . $device['device_id'] . "/entphysical/'>
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/entphysical/'>
<img src='images/16/bricks.png' align=absmiddle border=0> Inventory
</a>
</li>
@@ -104,7 +104,7 @@ if($config['enable_inventory'] && @mysql_result(mysql_query("SELECT * FROM `entP
if(mysql_result(mysql_query("select count(temp_id) from temperature WHERE temp_host = '" . $device['device_id'] . "'"), 0) > '0') {
echo("
<li class=" . $select['temp'] . ">
<a href='/device/" . $device['device_id'] . "/temp/'>
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/temp/'>
<img src='images/16/weather_sun.png' align=absmiddle border=0> Temps
</a>
</li>
@@ -114,7 +114,7 @@ if(mysql_result(mysql_query("select count(temp_id) from temperature WHERE temp_h
if(mysql_result(mysql_query("select count(storage_id) from storage WHERE host_id = '" . $device['device_id'] . "'"), 0) > '0') {
echo("
<li class=" . $select['storage'] . ">
<a href='/device/" . $device['device_id'] . "/storage/'>
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/storage/'>
<img src='images/16/database.png' align=absmiddle border=0> Storage
</a>
</li>
@@ -125,7 +125,7 @@ if(mysql_result(mysql_query("select count(storage_id) from storage WHERE host_id
if(mysql_result(mysql_query("select count(service_id) from services WHERE service_host = '" . $device['device_id'] . "'"), 0) > '0') {
echo("
<li class=" . $select['srv'] . ">
<a href='/device/" . $device['device_id'] . "/srv/'>
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/srv/'>
<img src='images/16/server_cog.png' align=absmiddle border=0> Services
</a>
</li>
@@ -134,14 +134,14 @@ if(mysql_result(mysql_query("select count(service_id) from services WHERE servic
echo("
<li class=" . $select['events'] . ">
<a href='/device/" . $device['device_id'] . "/events/'>
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/events/'>
<img src='images/16/report_magnify.png' align=absmiddle border=0> Events
</a>
</li>");
if($config['enable_syslog']) { echo("
<li class=" . $select['syslog'] . ">
<a href='/device/" . $device['device_id'] . "/syslog/'>
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/syslog/'>
<img src='images/16/printer.png' align=absmiddle border=0> Syslog
</a>
</li>
@@ -150,7 +150,7 @@ if($config['enable_syslog']) { echo("
if($_SESSION[userlevel] >= "5" && is_file($config['rancid_configs'] . $device['hostname'])) {
echo("
<li class=" . $select['showconfig'] . ">
<a href='/device/" . $device['device_id'] . "/showconfig/'>
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/showconfig/'>
<img src='images/16/page_white_text.png' align=absmiddle border=0> Config
</a>
</li>
@@ -160,7 +160,7 @@ if($_SESSION[userlevel] >= "5" && is_file($config['rancid_configs'] . $device['h
if($_SESSION[userlevel] >= "5") {
echo("
<li class=" . $select['edit'] . ">
<a href='/device/" . $device['device_id'] . "/edit/'>
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/edit/'>
<img src='images/16/server_edit.png' align=absmiddle border=0> Settings
</a>
</li>
+2 -2
View File
@@ -10,8 +10,8 @@ echo("
<div style='padding: 5px; height: 20px; clear: both; display: block;'>
<div style='float: left; font-size: 22px; font-weight: bold;'>Local AS : " . $device['bgpLocalAs'] . "</div>
<div style='float: right; text-align: right;'>
<a href='/device/" . $_GET['id'] . "/bgp/'>No Graphs</a> |
<a href='/device/" . $_GET['id'] . "/bgp/graphs/'>Graphs</a>
<a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/'>No Graphs</a> |
<a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/graphs/'>Graphs</a>
</div>
</div>");
+1 -1
View File
@@ -178,7 +178,7 @@ while($device = mysql_fetch_array($device_query)) {
include("blocks/netstats.inc.php");
include("blocks/uptime.inc.php");
break;
case "Snom":
echo("<div class=graphhead>Calls</div>");
$graph_type = "calls"; include ("includes/print-device-graph.php");
+4 -4
View File
@@ -1,10 +1,10 @@
<?php
echo("
<div style='float: right; text-align: right;'>
<a href='/?page=device&id=" . $_GET['id'] . "&section=dev-ifgraphs&type=bits'>Bits</a> |
<a href='/?page=device&id=" . $_GET['id'] . "&section=dev-ifgraphs&type=pkts'>Packets</a> |
<a href='/?page=device&id=" . $_GET['id'] . "&section=dev-ifgraphs&type=nupkts'>NU Packets</a> |
<a href='/?page=device&id=" . $_GET['id'] . "&section=dev-ifgraphs&type=errors'>Errors</a>
<a href='".$config['base_url']."/?page=device&id=" . $_GET['id'] . "&section=dev-ifgraphs&type=bits'>Bits</a> |
<a href='".$config['base_url']."/?page=device&id=" . $_GET['id'] . "&section=dev-ifgraphs&type=pkts'>Packets</a> |
<a href='".$config['base_url']."/?page=device&id=" . $_GET['id'] . "&section=dev-ifgraphs&type=nupkts'>NU Packets</a> |
<a href='".$config['base_url']."/?page=device&id=" . $_GET['id'] . "&section=dev-ifgraphs&type=errors'>Errors</a>
</div>");
$dographs = 1;
+1 -1
View File
@@ -18,7 +18,7 @@ if($_GET['type']) {
<span class=interface-desc style='float: left;'>".generatedevicelink($interface)." ".generateiflink($interface)." </span>");
if(mysql_result(mysql_query("SELECT count(*) FROM mac_accounting WHERE interface_id = '".$interface['interface_id']."'"),0)){
echo("<span style='float: right;'><a href='/?page=mac-accounting&id=".$interface['interface_id']."'><img src='/images/16/chart_curve.png' align='absmiddle'> MAC Accounting</a></span>");
echo("<span style='float: right;'><a href='".$config['base_url']."/?page=mac-accounting&id=".$interface['interface_id']."'><img src='/images/16/chart_curve.png' align='absmiddle'> MAC Accounting</a></span>");
}
+16 -55
View File
@@ -183,24 +183,9 @@ function percent_colour($perc)
{
$r = min(255, 5 * ($perc - 25));
$b = max(0, 255 - (5 * ($perc + 25)));
return sprintf('#%02x%02x%02x', $r, $b, $b);
}
function percent_colour_old($perc)
{
$red = round(5 * $perc);
$blue = round(255 - (5 * $perc));
if($red > '255') { $red = "255"; }
if($blue < '0') { $blue = "0"; }
$red = dechex($red);
$blue = dechex($blue);
if(strlen($red) == 1) { $red = "0$red"; }
if(strlen($blue) == 1) { $blue = "0$blue"; }
$colour = "#$red" . "00" . "$blue";
return $colour;
}
function print_error($text)
{
echo("<table class=errorbox cellpadding=3><tr><td><img src='/images/15/exclamation.png' align=absmiddle> $text</td></tr></table>");
@@ -218,8 +203,7 @@ function truncate($substring, $max = 50, $rep = '...')
if(strlen($string) > $max){ return substr_replace($string, $rep, $leave); } else { return $string; }
}
function interface_rates ($interface)
function interface_rates ($interface) // Returns the last in/out value in RRD
{
global $config;
$rrdfile = $config['rrd_dir'] . "/" . $interface['hostname'] . "/" . $interface['ifIndex'] . ".rrd";
@@ -233,8 +217,7 @@ function interface_rates ($interface)
return $rate;
}
function interface_errors ($interface)
function interface_errors ($interface) // Returns the last in/out errors value in RRD
{
global $config;
$rrdfile = $config['rrd_dir'] . "/" . $interface['hostname'] . "/" . $interface['ifIndex'] . ".rrd";
@@ -268,9 +251,9 @@ function generateiflink($interface, $text=0,$type=bits)
if(!$text) { $text = fixIfName($interface['ifDescr']); }
if(!$type) { $type = 'bits'; }
$class = ifclass($interface['ifOperStatus'], $interface['ifAdminStatus']);
$graph_url = "graph.php?if=" . $interface['interface_id'] . "&from=$day&to=$now&width=400&height=120&type=" . $type;
$graph_url = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&from=$day&to=$now&width=400&height=120&type=" . $type;
$device_id = getifhost($interface['interface_id']);
$link = "<a class=$class href='/device/$device_id/interface/" . $interface['interface_id'] . "/' ";
$link = "<a class=$class href='".$config['base_url']."/device/$device_id/interface/" . $interface['interface_id'] . "/' ";
$link .= "onmouseover=\" return overlib('";
$link .= "<img src=\'$graph_url\'>', CAPTION, '<span class=list-large>" . $interface['hostname'] . " - " . fixifName($interface['ifDescr']) . "</span>";
if($interface['ifAlias']) { $link .= "<br />" . $interface['ifAlias']; }
@@ -287,8 +270,8 @@ function generatedevicelink($device, $text=0, $start=0, $end=0)
if(!$end) { $end = $now; }
$class = devclass($device);
if(!$text) { $text = $device['hostname']; }
$graph_url = "graph.php?host=" . $device['device_id'] . "&from=$start&to=$end&width=400&height=120&type=cpu";
$link = "<a class=$class href='/device/" . $device['device_id'] . "/' ";
$graph_url = $config['base_url'] . "/graph.php?host=" . $device['device_id'] . "&from=$start&to=$end&width=400&height=120&type=cpu";
$link = "<a class=$class href='".$config['base_url']."/device/" . $device['device_id'] . "/' ";
$link .= "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - CPU Load</div>";
$link .= "<img src=\'$graph_url\'>'".$config['overlib_defaults'].", LEFT);\" onmouseout=\"return nd();\">$text</a>";
return $link;
@@ -300,7 +283,8 @@ function device_traffic_image($device, $width, $height, $from, $to)
return "<img src='graph.php?device=" . $device . "&type=device_bits&from=" . $from . "&to=" . $to . "&width=" . $width . "&height=" . $height . "' />";
}
function devclass($device) {
function devclass($device)
{
if ($device['status'] == '0') { $class = "list-device-down"; } else { $class = "list-device"; }
if ($device['ignore'] == '1') {
$class = "list-device-ignored";
@@ -312,17 +296,18 @@ function devclass($device) {
function getImage($host)
{
global $config;
$sql = "SELECT * FROM `devices` WHERE `device_id` = '$host'";
$data = mysql_fetch_array(mysql_query($sql));
$type = strtolower($data['os']);
if(file_exists("images/os/$type" . ".png")){ $image = "<img src='images/os/$type.png'>";
} elseif(file_exists("images/os/$type" . ".gif")){ $image = "<img src='images/os/$type.gif'>"; }
if($device['monowall']) {$image = "<img src='images/os/m0n0wall.png'>";}
if(file_exists($config['html_dir'] . "/images/os/$type" . ".png")){ $image = "<img src='".$config['base_url']."/images/os/$type.png'>";
} elseif(file_exists($config['html_dir'] . "/images/os/$type" . ".gif")){ $image = "<img src='".$config['base_url']."/images/os/$type.gif'>"; }
if($device['monowall']) {$image = "<img src='".$config['base_url']."images/os/m0n0wall.png'>";}
if($type == "linux") {
$features = strtolower(trim($data[features]));
list($distro) = split(" ", $features);
if(file_exists("images/os/$distro" . ".png")){ $image = "<img src='images/os/$distro" . ".png'>";
} elseif(file_exists("images/os/$distro" . ".gif")){ $image = "<img src='images/os/$distro" . ".gif'>"; }
if(file_exists($config['html_dir'] . "/images/os/$distro" . ".png")){ $image = "<img src='".$config['base_url']."/images/os/$distro" . ".png'>";
} elseif(file_exists($config['html_dir'] . "/images/os/$distro" . ".gif")){ $image = "<img src='".$config['base_url']."/images/os/$distro" . ".gif'>"; }
}
return $image;
}
@@ -416,37 +401,13 @@ function humanmedia($media)
return $media;
}
function humanspeed($speed) {
# $speed = preg_replace("/^0$/", "-", $speed);
# $speed = preg_replace("/^9000$/", "9Kbps", $speed);
# $speed = preg_replace("/^48000$/", "48Kbps", $speed);
# $speed = preg_replace("/^56000$/", "56Kbps", $speed);
# $speed = preg_replace("/^64000$/", "64Kbps", $speed);
# $speed = preg_replace("/^128000$/", "128Kbps", $speed);
# $speed = preg_replace("/^256000$/", "256Kbps", $speed);
# $speed = preg_replace("/^448000$/", "448Kbps", $speed);
# $speed = preg_replace("/^512000$/", "512Kbps", $speed);
# $speed = preg_replace("/^768000$/", "768Kbps", $speed);
# $speed = preg_replace("/^1024000$/", "1Mbps", $speed);
# $speed = preg_replace("/^2048000$/", "2Mbps", $speed);
# $speed = preg_replace("/^4192000$/", "4Mbps", $speed);
# $speed = preg_replace("/^10000000$/", "10Mbps", $speed);
# $speed = preg_replace("/^34000000$/", "34Mbps", $speed);
# $speed = preg_replace("/^45000000$/", "45Mbps", $speed);
# $speed = preg_replace("/^54000000$/", "54Mbps", $speed);
# $speed = preg_replace("/^100000000$/", "100Mbps", $speed);
# $speed = preg_replace("/^155000000$/", "155Mbps", $speed);
# $speed = preg_replace("/^622000000$/", "622Mbps", $speed);
# $speed = preg_replace("/^1000000000$/", "1Gbps", $speed);
# $speed = preg_replace("/^10000000000$/", "10Gbps", $speed);
# $speed = preg_replace("/^4294967295$/", "", $speed);
function humanspeed($speed)
{
$speed = formatRates($speed);
if($speed == "") { $speed = "-"; }
return $speed;
}
function netmask2cidr($netmask)
{
list ($network, $cidr) = explode("/", trim(`ipcalc $address/$mask | grep Network | cut -d" " -f 4`));
+2 -4
View File
@@ -21,7 +21,7 @@
$version = str_replace("-M|", "|", $version);
$version = str_replace("-", "|", $version);
list($hardware, $features, $version) = explode("|", $version);
$features = fixIOSFeatures($features);
#$features = rewrite_ios_features($features);
#$hardware = fixIOSHardware($hardware);
if(strstr($ciscomodel, "OID")){ unset($ciscomodel); }
if(!strstr($ciscomodel, " ") && strlen($ciscomodel) >= '3') {
@@ -31,13 +31,11 @@
if($device['os'] == "IOS XE") {
list(,$features,$version) = explode(",", $sysDescr);
$version = str_replace(" Version ", "", $version);
$features = str_replace(" IOS-XE Software (", "", $features);
$features = str_replace("-M", "", $features);
$features = str_replace(")", "", $features);
$features = str_replace("PPC_LINUX_IOSD-", "", $features);
$features = fixIOSFeatures($features);
#$features = rewrite_ios_features($features);
}
+1 -1
View File
@@ -9,7 +9,7 @@ while($temperature = mysql_fetch_array($temp_data)) {
echo("Checking temp " . $temperature['temp_descr'] . "... ");
$temprrd = addslashes($rrd_dir . "/" . $device['hostname'] . "/temp-" . str_replace("/", "_", str_replace(" ", "_",$temperature['temp_descr'])) . ".rrd");
$temprrd = addslashes($config['rrd_dir'] . "/" . $device['hostname'] . "/temp-" . str_replace("/", "_", str_replace(" ", "_",$temperature['temp_descr'])) . ".rrd");
$temprrd = str_replace(")", "_", $temprrd);
$temprrd = str_replace("(", "_", $temprrd);
+44
View File
@@ -1,5 +1,39 @@
<?php
$rewrite_ios_features = array(
"PK9S" => "IP w/SSH LAN Only",
"LANBASEK9" => "Lan Base Crypto",
"LANBASE" => "Lan Base",
"ADVENTERPRISEK9" => "Advanced Enterprise Crypto",
"ADVSECURITYK9" => "Advanced Security Crypto",
"K91P" => "Provider Crypto",
"K4P" => "Provider Crypto",
"ADVIPSERVICESK9" => "Adv IP Services Crypto",
"ADVIPSERVICES" => "Adv IP Services",
"IK9P" => "IP Plus Crypto",
"K9O3SY7" => "IP ADSL FW IDS Plus IPSEC 3DES",
"SPSERVICESK9" => "SP Services Crypto",
"PK9SV" => "IP MPLS/IPV6 W/SSH + BGP",
"IS" => "IP Plus",
"IPSERVICESK9" => "IP Services Crypto",
"BROADBAND" => "Broadband",
"IPBASE" => "IP Base",
"IPSERVICE" => "IP Services",
"P" => "Service Provider",
"P11" => "Broadband Router",
"G4P5" => "NRP",
"JK9S" => "Enterprise Plus Crypto",
"IK9S" => "IP Plus Crypto",
"JK" => "Enterprise Plus",
"I6Q4L2" => "Layer 2",
"I6K2L2Q4" => "Layer 2 Crypto",
"C3H2S" => "Layer 2 SI/EI",
"_WAN" => " + WAN",
);
$rewrite_shortif = array (
'tengigabitethernet' => 'Te',
'gigabitethernet' => 'Gi',
@@ -57,6 +91,8 @@
'loop' => 'Loop',
);
// Specific rewrite functions
function makeshortif($if)
@@ -68,6 +104,14 @@ function makeshortif($if)
return $if;
}
function rewrite_ios_features ($features)
{
global $rewrite_ios_features;
$type = array_preg_replace($rewrite_ios_features, $features);
return ($features);
}
function fixiftype ($type)
{
global $rewrite_iftype;
+8 -5
View File
@@ -4,7 +4,7 @@
include("config.php");
include("includes/functions.php");
echo("digraph G { sep=0.1; size=\"40,20\"; pack=10; bgcolor=transparent;splines=true;
echo("digraph G { sep=0.6; size=\"40,20\"; pack=10; bgcolor=transparent;splines=true;
node [ fontname=\"helvetica\", fontsize=38, fontstyle=bold, shape=box, style=bold];
edge [ labelfontsize=10, labelfontname=\"helvetica\", overlap=false, fontstyle=bold];
graph [bgcolor=transparent, remincross=true];
@@ -35,11 +35,14 @@ while($loc_data = mysql_fetch_array($loc_result)) {
if(strpos($host, "cust." . $config['mydomain'])) { $hostinfo = "shape=egg style=filled fillcolor=pink"; }
if(strpos($host, "bas")) { $hostinfo = "shape=rectangle style=filled fillcolor=skyblue"; }
if(strpos($host, "crs")) { $hostinfo = "shape=box3d style=filled fillcolor=skyblue"; }
if(strpos($host, "ler")) { $hostinfo = "shape=tripleoctagon style=filled fillcolor=darkolivegreen3"; }
if(strpos($host, "lcr")) { $hostinfo = "shape=tripleoctagon style=filled fillcolor=darkolivegreen4"; }
if(strpos($host, "ler")) { $hostinfo = "shape=octagon style=filled fillcolor=darkolivegreen1"; }
if(strpos($host, "pbr")) { $hostinfo = "shape=ellipse style=filled fillcolor=orange"; }
if(strpos($host, "tbr")) { $hostinfo = "shape=ellipse style=filled fillcolor=red"; }
if(strstr($host, "gw")) { $hostinfo = "shape=rect style=filled fillcolor=orange"; }
if(strpos($host, "bar")) { $hostinfo = "shape=egg style=filled fillcolor=darkolivegreen4"; }
if(strpos($host, "tbr")) { $hostinfo = "shape=ellipse style=filled fillcolor=orange"; }
if(strstr($host, "gwr")) { $hostinfo = "shape=ellipse style=filled fillcolor=orange"; }
if(strpos($host, "bgw")) { $hostinfo = "shape=ellipse style=filled fillcolor=orange"; }
if(strpos($host, "vax")) { $hostinfo = "shape=rect style=filled fillcolor=skyblue"; }
if(strpos($host, "vsx")) { $hostinfo = "shape=box3d style=filled fillcolor=skyblue"; }
#} else { $hostinfo = "style=filled shape=circle fillcolor=lightgray"; }
$host = $dev_data[hostname];
+100 -74
View File
@@ -3,25 +3,12 @@
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Nov 20, 2008 at 03:39 PM
-- Generation Time: Mar 23, 2009 at 05:29 PM
-- Server version: 5.0.51
-- PHP Version: 5.2.4-2ubuntu5.3
-- PHP Version: 5.2.4-2ubuntu5.5
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Table structure for table `authlog`
--
CREATE TABLE IF NOT EXISTS `authlog` (
`id` int(11) NOT NULL auto_increment,
`datetime` timestamp NOT NULL default CURRENT_TIMESTAMP,
`user` text NOT NULL,
`address` text NOT NULL,
`result` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Database: `observer`
--
@@ -37,7 +24,7 @@ CREATE TABLE IF NOT EXISTS `adjacencies` (
`network_id` int(11) NOT NULL default '0',
`interface_id` int(11) NOT NULL default '0',
PRIMARY KEY (`adj_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -53,7 +40,22 @@ CREATE TABLE IF NOT EXISTS `alerts` (
`time_logged` timestamp NOT NULL default CURRENT_TIMESTAMP,
`alerted` smallint(6) NOT NULL default '0',
KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `authlog`
--
CREATE TABLE IF NOT EXISTS `authlog` (
`id` int(11) NOT NULL auto_increment,
`datetime` timestamp NOT NULL default CURRENT_TIMESTAMP,
`user` text NOT NULL,
`address` text NOT NULL,
`result` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -64,7 +66,7 @@ CREATE TABLE IF NOT EXISTS `alerts` (
CREATE TABLE IF NOT EXISTS `bgpPeers` (
`bgpPeer_id` int(11) NOT NULL auto_increment,
`device_id` int(11) NOT NULL,
`astext` varchar(32) NOT NULL,
`astext` varchar(64) NOT NULL,
`bgpPeerIdentifier` text NOT NULL,
`bgpPeerRemoteAs` int(11) NOT NULL,
`bgpPeerState` text NOT NULL,
@@ -79,7 +81,7 @@ CREATE TABLE IF NOT EXISTS `bgpPeers` (
`bgpPeerInUpdateElapsedTime` int(11) NOT NULL,
PRIMARY KEY (`bgpPeer_id`),
KEY `device_id` (`device_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -95,7 +97,7 @@ CREATE TABLE IF NOT EXISTS `bills` (
`bill_day` int(11) NOT NULL default '1',
`bill_gb` int(11) default NULL,
UNIQUE KEY `bill_id` (`bill_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -111,7 +113,7 @@ CREATE TABLE IF NOT EXISTS `bill_data` (
`in_delta` bigint(11) NOT NULL,
`out_delta` bigint(11) NOT NULL,
KEY `bill_id` (`bill_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -122,7 +124,7 @@ CREATE TABLE IF NOT EXISTS `bill_data` (
CREATE TABLE IF NOT EXISTS `bill_perms` (
`user_id` int(11) NOT NULL,
`bill_id` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -133,7 +135,7 @@ CREATE TABLE IF NOT EXISTS `bill_perms` (
CREATE TABLE IF NOT EXISTS `bill_ports` (
`bill_id` int(11) NOT NULL,
`port_id` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -149,7 +151,7 @@ CREATE TABLE IF NOT EXISTS `customers` (
`level` tinyint(4) NOT NULL default '0',
PRIMARY KEY (`customer_id`),
UNIQUE KEY `username` (`username`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -159,26 +161,31 @@ CREATE TABLE IF NOT EXISTS `customers` (
CREATE TABLE IF NOT EXISTS `devices` (
`device_id` int(11) NOT NULL auto_increment,
`hostname` text NOT NULL,
`hostname` varchar(128) NOT NULL,
`sysName` varchar(128) default NULL,
`community` varchar(32) NOT NULL,
`snmpver` varchar(4) NOT NULL default 'v2c',
`port` smallint(5) NOT NULL default '161',
`bgpLocalAs` varchar(16) default NULL,
`sysDescr` text,
`sysContact` text NOT NULL,
`version` text NOT NULL,
`hardware` text NOT NULL,
`features` text NOT NULL,
`sysContact` text,
`version` text,
`hardware` text,
`features` text,
`location` text,
`os` varchar(8) NOT NULL default '',
`os` varchar(8) default NULL,
`status` tinyint(4) NOT NULL default '0',
`ignore` tinyint(4) NOT NULL default '0',
`disabled` tinyint(1) NOT NULL default '0',
`lastchange` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`purpose` text NOT NULL,
`purpose` varchar(64) default NULL,
`type` varchar(8) NOT NULL default 'other',
PRIMARY KEY (`device_id`),
KEY `status` (`status`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
KEY `status` (`status`),
KEY `hostname` (`hostname`),
KEY `sysName` (`sysName`),
KEY `os` (`os`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -190,11 +197,10 @@ CREATE TABLE IF NOT EXISTS `devices_attribs` (
`attrib_id` int(11) NOT NULL auto_increment,
`device_id` int(11) NOT NULL,
`attrib_type` varchar(32) NOT NULL,
`attrib_value` int(11) NOT NULL,
`attrib_value` text NOT NULL,
`updated` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (`attrib_id`),
FULLTEXT KEY `attrib_type` (`attrib_type`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
PRIMARY KEY (`attrib_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -207,7 +213,7 @@ CREATE TABLE IF NOT EXISTS `devices_perms` (
`device_id` int(11) NOT NULL,
`access_level` int(4) NOT NULL default '0',
KEY `user_id` (`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -231,7 +237,7 @@ CREATE TABLE IF NOT EXISTS `entPhysical` (
`ifIndex` int(11) default NULL,
PRIMARY KEY (`entPhysical_id`),
KEY `device_id` (`device_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -247,7 +253,7 @@ CREATE TABLE IF NOT EXISTS `eventlog` (
`message` text NOT NULL,
`type` int(11) NOT NULL,
KEY `host` (`host`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -286,7 +292,7 @@ CREATE TABLE IF NOT EXISTS `interfaces` (
KEY `host` (`device_id`),
KEY `snmpid` (`ifIndex`),
KEY `if_2` (`ifDescr`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -298,7 +304,7 @@ CREATE TABLE IF NOT EXISTS `interfaces_perms` (
`user_id` int(11) NOT NULL,
`interface_id` int(11) NOT NULL,
`access_level` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -316,7 +322,7 @@ CREATE TABLE IF NOT EXISTS `ip6addr` (
`interface_id` int(11) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `addr` (`addr`,`cidr`,`interface_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -329,7 +335,7 @@ CREATE TABLE IF NOT EXISTS `ip6adjacencies` (
`network_id` int(11) NOT NULL default '0',
`interface_id` int(11) NOT NULL default '0',
PRIMARY KEY (`adj_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -342,7 +348,7 @@ CREATE TABLE IF NOT EXISTS `ip6networks` (
`cidr` varchar(32) NOT NULL default '',
PRIMARY KEY (`id`),
UNIQUE KEY `cidr` (`cidr`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -358,7 +364,7 @@ CREATE TABLE IF NOT EXISTS `ipaddr` (
`interface_id` int(11) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `addr` (`addr`,`cidr`,`interface_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -372,8 +378,28 @@ CREATE TABLE IF NOT EXISTS `links` (
`dst_if` int(11) default NULL,
`active` tinyint(4) NOT NULL default '1',
`cdp` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
PRIMARY KEY (`id`),
KEY `src_if` (`src_if`),
KEY `dst_if` (`dst_if`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `mac_accounting`
--
CREATE TABLE IF NOT EXISTS `mac_accounting` (
`ma_id` int(11) NOT NULL auto_increment,
`interface_id` int(11) NOT NULL,
`peer_ip` varchar(32) NOT NULL,
`peer_desc` varchar(64) NOT NULL,
`peer_asn` int(11) NOT NULL,
`peer_mac` varchar(32) NOT NULL,
`in_oid` varchar(128) NOT NULL,
`out_oid` varchar(128) NOT NULL,
PRIMARY KEY (`ma_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -386,7 +412,7 @@ CREATE TABLE IF NOT EXISTS `networks` (
`cidr` varchar(32) NOT NULL default '',
PRIMARY KEY (`id`),
UNIQUE KEY `cidr` (`cidr`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -400,7 +426,7 @@ CREATE TABLE IF NOT EXISTS `port_in_measurements` (
`counter` bigint(11) NOT NULL,
`delta` bigint(11) NOT NULL,
KEY `port_id` (`port_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -414,7 +440,7 @@ CREATE TABLE IF NOT EXISTS `port_out_measurements` (
`counter` bigint(11) NOT NULL,
`delta` bigint(11) NOT NULL,
KEY `port_id` (`port_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -430,7 +456,7 @@ CREATE TABLE IF NOT EXISTS `pseudowires` (
`cpwVcID` int(11) NOT NULL,
`cpwOid` int(11) NOT NULL,
PRIMARY KEY (`pseudowire_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -453,7 +479,7 @@ CREATE TABLE IF NOT EXISTS `services` (
`service_disabled` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`service_id`),
KEY `service_host` (`service_host`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -471,7 +497,7 @@ CREATE TABLE IF NOT EXISTS `storage` (
`hrStorageUsed` int(11) NOT NULL,
`storage_perc` text NOT NULL,
PRIMARY KEY (`storage_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -495,7 +521,7 @@ CREATE TABLE IF NOT EXISTS `syslog` (
KEY `datetime` (`datetime`),
KEY `device_id` (`device_id`),
KEY `processed` (`processed`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -513,7 +539,7 @@ CREATE TABLE IF NOT EXISTS `temperature` (
`temp_limit` tinyint(4) NOT NULL default '60',
PRIMARY KEY (`temp_id`),
KEY `temp_host` (`temp_host`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -526,10 +552,26 @@ CREATE TABLE IF NOT EXISTS `users` (
`username` char(30) NOT NULL,
`password` char(32) NOT NULL,
`realname` text NOT NULL,
`email` text NOT NULL,
`descr` char(30) NOT NULL,
`level` tinyint(4) NOT NULL default '0',
PRIMARY KEY (`user_id`),
UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `users_prefs`
--
CREATE TABLE IF NOT EXISTS `users_prefs` (
`user_id` int(16) NOT NULL,
`pref` varchar(32) NOT NULL,
`value` varchar(128) NOT NULL,
PRIMARY KEY (`user_id`),
UNIQUE KEY `user_id.pref` (`user_id`,`pref`),
KEY `pref` (`pref`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -546,7 +588,7 @@ CREATE TABLE IF NOT EXISTS `vlans` (
`vlan_descr` text,
PRIMARY KEY (`vlan_id`),
KEY `device_id` (`device_id`,`vlan_vlan`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
@@ -563,21 +605,5 @@ CREATE TABLE IF NOT EXISTS `vrfs` (
`device_id` int(11) NOT NULL,
PRIMARY KEY (`vrf_id`),
KEY `device_id` (`device_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `mac_accounting`
--
CREATE TABLE IF NOT EXISTS `mac_accounting` (
`ma_id` int(11) NOT NULL auto_increment,
`interface_id` int(11) NOT NULL,
`peer_ip` varchar(32) NOT NULL,
`peer_desc` varchar(64) NOT NULL,
`peer_asn` int(11) NOT NULL,
`peer_mac` varchar(32) NOT NULL,
`in_oid` varchar(128) NOT NULL,
`out_oid` varchar(128) NOT NULL,
PRIMARY KEY (`ma_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=703 ;
) ENGINE=InnoDB DEFAULT CHARSET=latin1;