diff --git a/config.php.default b/config.php.default
index 8be23bdd7..7229c7c3c 100755
--- a/config.php.default
+++ b/config.php.default
@@ -67,24 +67,28 @@ $config['email_headers'] = "From: " . $config['email_from'] . "\r\n";
### Which interface sections should we show?
-$show_if_customers = 1;
-$show_if_transit = 0;
-$show_if_peering = 0;
-$show_if_core = 0;
-$show_if_l2tp =0;
-$show_locations = 1;
+$config['show_if_customers'] = 1;
+$config['show_if_transit'] = 0;
+$config['show_if_peering'] = 0;
+$config['show_if_core'] = 0;
+$config['show_if_l2tp'] = 0;
+$config['show_locations'] = 1;
-$enable_syslog = 1;
+$config['enable_syslog'] = 1;
### Interface name strings to ignore
-$bif = array("null", "virtual-", "unrouted", "eobc", "mpls", "sl0", "lp0", "faith0",
+$config['bif'] = array("null", "virtual-", "unrouted", "eobc", "mpls", "sl0", "lp0", "faith0",
"-atm layer", "-atm subif", "-shdsl", "-adsl", "-aal5", "-atm",
"async", "plip", "-physical", "-signalling", "control plane",
"bri", "-bearer", "ng", "bluetooth", "isatap", "ras", "qos", "miniport");
+$bif = $config['bif']
+
### Mountpoints to ignore
-$ignore_mount = array("/kern", "/mnt/cdrom", "/dev", "/dev/pts");
+$config['ignore_mount'] = array("/kern", "/mnt/cdrom", "/dev", "/dev/pts");
+$ignore_mount = $config['ignore_mount']
+
### Valis OSes
$valid_os = array("IOS", "Linux", "OpenBSD", "FreeBSD", "NetBSD", "ProCurve", "m0n0wall", "pfSense", "Snom", "Voswall", "DragonFly");
diff --git a/discover-bgp_peers.php b/discover-bgp_peers.php
index 3280cffb4..aafe630d0 100755
--- a/discover-bgp_peers.php
+++ b/discover-bgp_peers.php
@@ -3,10 +3,10 @@
include("config.php");
include("includes/functions.php");
+if(!$config['enable_bgp']) { echo("BGP Support Disabled\n"); exit; }
### Discover BGP peers on Cisco devices
-
$device_query = mysql_query("SELECT * FROM `devices` WHERE status = '1' AND os = 'IOS' ORDER BY device_id desc");
while ($device = mysql_fetch_array($device_query)) {
echo("\nPolling ". $device['hostname'] . "\n");
@@ -38,41 +38,13 @@ while ($device = mysql_fetch_array($device_query)) {
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `bgpPeers` WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '$peer_ip'"),0) < '1') {
$add = mysql_query("INSERT INTO bgpPeers (`device_id`, `bgpPeerIdentifier`, `bgpPeerRemoteAS`) VALUES ('".$device['device_id']."','$peer_ip','$peer_as')");
if($add) { echo(" Added \n"); } else { echo(" Add failed\n"); }
- } else { echo(" Exists\n"); }
+ } else {
+ #Â$peer_data = mysql_fetch_array(mysql_query("SELECT * FROM `bgpPeers``device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '$peer_ip' "));
+ echo(" Exists\n");
+ $update = mysql_query("UPDATE `bgpPeers` SET astext = '$astext' WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '$peer_ip'");
+ }
- ### Poll BGP Peer
-
-# $peer_cmd = $config['snmpget'] . " -Ovq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'] . " ";
-# $peer_cmd .= "bgpPeerState.$peer_ip bgpPeerAdminStatus.$peer_ip bgpPeerInUpdates.$peer_ip bgpPeerOutUpdates.$peer_ip bgpPeerInTotalMessages.$peer_ip ";
-# $peer_cmd .= "bgpPeerOutTotalMessages.$peer_ip bgpPeerFsmEstablishedTime.$peer_ip bgpPeerInUpdateElapsedTime.$peer_ip";
-# $peer_data = trim(shell_exec($peer_cmd));
-
-# $peerrrd = $rrd_dir . "/" . $device['hostname'] . "/bgp-$peer_ip.rrd";
-
-# if(!is_file($peerrrd)) {
-# $woo = `rrdtool create $peerrrd \
-# DS:bgpPeerOutUpdates:COUNTER:600:U:100000000000 \
-# DS:bgpPeerInUpdates:COUNTER:600:U:100000000000 \
- # DS:bgpPeerOutTotal:COUNTER:600:U:100000000000 \
- # DS:bgpPeerInTotal:COUNTER:600:U:100000000000 \
- # DS:bgpPeerEstablished:GAUGE:600:0:U \
- # RRA:AVERAGE:0.5:1:600 \
- # RRA:AVERAGE:0.5:6:700 \
- # RRA:AVERAGE:0.5:24:775 \
- # RRA:AVERAGE:0.5:288:797`;
- # }
-
-# rrdtool_update($peerrrd, "N:$bgpPeerOutUpdates:$bgpPeerInUpdates:$bgpPeerOutTotalMessages:$bgpPeerInTotalMesages:$bgpPeerFsmEstablishedTime");
-
- # list($bgpPeerState, $bgpPeerAdminStatus, $bgpPeerInUpdates, $bgpPeerOutUpdates, $bgpPeerInTotalMessages, $bgpPeerOutTotalMessages, $bgpPeerFsmEstablishedTime, $bgpPeerInUpdateElapsedTime) = explode("\n", $peer_data);
-
-# $update = "UPDATE bgpPeers SET bgpPeerState = '$bgpPeerState', bgpPeerAdminStatus = '$bgpPeerAdminStatus', ";
- # $update .= "bgpPeerFsmEstablishedTime = '$bgpPeerFsmEstablishedTime', astext = '$astext'";
- # $update .= " WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '$peer_ip'";
-
-# mysql_query($update);
-
- } # end if $peer
+ } # End if
} # End foreach
} # End BGP check
} # End While
diff --git a/html/.htaccess b/html/.htaccess
index d50cfe3ef..cc382a664 100644
--- a/html/.htaccess
+++ b/html/.htaccess
@@ -8,8 +8,15 @@ RewriteCond %{REQUEST_URI} !^(.*)\.jpg$
RewriteCond %{REQUEST_URI} !^(.*)\.gif$
RewriteCond %{REQUEST_URI} !^(.*)\.png$
-RewriteRule ^([a-z]+)$ ?page=$1
+## Rewrites for Devices
-RewriteRule ^bills/([0-9]+) ?page=bills&bill=$1
+RewriteRule ^devices/location/(.+)/ ?page=devices&location=$1
+RewriteRule ^devices/alerted/ ?page=devices&status=alerted
+RewriteRule ^devices/alerted/ ?page=devices&status=alerted
+RewriteRule ^devices/(.+)/ ?page=devices&type=$1
+
+RewriteRule ^bill/([0-9]+) ?page=bills&bill=$1
RewriteRule ^device/([0-9]+) ?page=device&id=$1
+RewriteRule ^([a-z]+)/$ ?page=$1
+
diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php
index 84d95c6d7..f0e3fb462 100644
--- a/html/includes/print-menubar.php
+++ b/html/includes/print-menubar.php
@@ -28,12 +28,12 @@
@@ -45,23 +45,23 @@
- All Devices
+ All Devices
- Servers
- Network
- Firewalls ");
+ Servers
+ Network
+ Firewalls ");
echo("
- Alerts ($device_alerts) ");
+ Alerts ($device_alerts) ");
if($_SESSION['userlevel'] >= '10') {
echo("
- Add Device
- Delete Device ");
+ Add Device
+ Delete Device ");
}
?>
@@ -73,7 +73,7 @@ if($_SESSION['userlevel'] >= '10') {
-
+
+"); }
+?>
+
Ports
@@ -101,22 +106,18 @@ if($_SESSION['userlevel'] >= '10') {
- All Ports
+ All Ports
= '5') {
echo("
");
- if($show_if_customers) { echo(" Customers "); $ifbreak = 1;}
-
- if($show_if_bills) { echo(" Traffic Bills "); $ifbreak = 1;}
-
- if($show_if_l2tp) { echo(" L2TP "); $ifbreak = 1; }
-
- if($show_if_transit) { echo(" Transit "); $ifbreak = 1; }
- if($show_if_peering) { echo(" Peering "); $ifbreak = 1; }
-
- if($show_if_core) { echo(" Core "); $ifbreak = 1;}
+ if($config['int_customers']) { echo(" Customers "); $ifbreak = 1;}
+ if($config['int_bills']) { echo(" Traffic Bills "); $ifbreak = 1;}
+ if($config['int_l2tp']) { echo(" L2TP "); $ifbreak = 1; }
+ if($config['int_transit']) { echo(" Transit "); $ifbreak = 1; }
+ if($config['int_peering']) { echo(" Peering "); $ifbreak = 1; }
+ if($config['int_core']) { echo(" Core "); $ifbreak = 1;}
}
if($ifbreak && $interface_alerts) { echo("
"); }
diff --git a/html/pages/device.php b/html/pages/device.php
index b4c98257c..591aeffb5 100644
--- a/html/pages/device.php
+++ b/html/pages/device.php
@@ -36,7 +36,7 @@ if(@mysql_result(mysql_query("select count(vlan_id) from vlans WHERE device_id =
");
}
-if($device['bgpLocalAs']) {
+if($config['enable_bgp'] && $device['bgpLocalAs']) {
echo("
-
diff --git a/html/pages/device/dev-bgp.inc b/html/pages/device/dev-bgp.inc
index d7f8e0154..e981e43a4 100644
--- a/html/pages/device/dev-bgp.inc
+++ b/html/pages/device/dev-bgp.inc
@@ -1,22 +1,36 @@
");
+
+ echo("Local AS : " . $device['bgpLocalAs'] . " | ");
+
$i = "1";
$peer_query = mysql_query("select * from bgpPeers WHERE device_id = '".$device['device_id']."' ORDER BY bgpPeerRemoteAs, bgpPeerIdentifier");
while($peer = mysql_fetch_array($peer_query)) {
if(!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
- if($peer['bgpPeerAdminStatus'] == "start") { $img = "images/16/accept.png"; } else { $img = "images/16/delete.png"; }
+ #if($peer['bgpPeerAdminStatus'] == "start") { $img = "images/16/accept.png"; } else { $img = "images/16/delete.png"; }
if($peer['bgpPeerState'] == "established") { $col = "green"; } else { $col = "red"; $bg_colour = "#fcc"; }
+ if($peer['bgpPeerAdminStatus'] == "start") { $admin_col = "green"; } else { $admin_col = "red"; $bg_colour = "#ccc"; }
+
+ if($peer['bgpPeerRemoteAs'] == $device['bgpLocalAs']) { $peer_type = "iBGP"; } else { $peer_type = "eBGP"; }
$peerhost = mysql_fetch_array(mysql_query("SELECT * FROM ipaddr AS A, interfaces AS I, devices AS D WHERE A.addr = '".$peer['bgpPeerIdentifier']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
if($peerhost) { $peername = generatedevicelink($peerhost); } else { unset($peername); }
- echo("| $i | " . $peer['bgpPeerIdentifier'] . " ".$peername." | AS" . $peer['bgpPeerRemoteAs'] . " " . $peer['astext'] . " |  | " . $peer['bgpPeerState'] . " | " .formatUptime($peer['bgpPeerFsmEstablishedTime']). " | ");
+ echo("
+ $i |
+ " . $peer['bgpPeerIdentifier'] . " ".$peername." |
+ $peer_type |
+ AS" . $peer['bgpPeerRemoteAs'] . " " . $peer['astext'] . " |
+ " . $peer['bgpPeerAdminStatus'] . " " . $peer['bgpPeerState'] . " |
+ " .formatUptime($peer['bgpPeerFsmEstablishedTime']). "
+ Updates " . $peer['bgpPeerInUpdates'] . "
+ " . $peer['bgpPeerOutUpdates'] . " | ");
-# if($graphs) {
+ if($graphs) {
$graph_type = "bgpupdates";
@@ -47,7 +61,7 @@
echo("");
- # }
+ }
$i++;
}
diff --git a/includes/polling/bgpPeer.inc.php b/includes/polling/bgpPeer.inc.php
index 5b71c968d..ca8124ea9 100755
--- a/includes/polling/bgpPeer.inc.php
+++ b/includes/polling/bgpPeer.inc.php
@@ -2,6 +2,8 @@
echo("Polling BGP peers\n");
+if(!$config['enable_bgp']) { echo("BGP Support Disabled\n"); } else {
+
$query = "SELECT * FROM bgpPeers WHERE device_id = '" . $device['device_id'] . "'";
$peers = mysql_query($query);
while($peer = mysql_fetch_array($peers)) {
@@ -37,11 +39,12 @@ while($peer = mysql_fetch_array($peers)) {
echo("$peerrrd N:$bgpPeerOutUpdates:$bgpPeerInUpdates:$bgpPeerOutTotalMessages:$bgpPeerInTotalMesages:$bgpPeerFsmEstablishedTime");
$update = "UPDATE bgpPeers SET bgpPeerState = '$bgpPeerState', bgpPeerAdminStatus = '$bgpPeerAdminStatus', ";
- $update .= "bgpPeerFsmEstablishedTime = '$bgpPeerFsmEstablishedTime'";
+ $update .= "bgpPeerFsmEstablishedTime = '$bgpPeerFsmEstablishedTime', bgpPeerInUpdates = '$bgpPeerInUpdates' , bgpPeerOutUpdates = '$bgpPeerOutUpdates'";
$update .= " WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '" . $peer['bgpPeerIdentifier'] . "'";
mysql_query($update);
-}
+} ## End While loop on peers
+} ## End check for BGP support
?>
diff --git a/map.php b/map.php
index 874bf348f..9e001a1a9 100755
--- a/map.php
+++ b/map.php
@@ -104,10 +104,13 @@ echo("\n}\n");
}
+echo("\"thnlon-pe01\" -> \"thelon-cs01\" [ arrowhead=none arrowtail=none color=navyblue weight=5 style=\"setlinewidth(8)\"];\n");
+echo("\"thnlon-pe01\" -> \"thelon-cs02\" [ arrowhead=none arrowtail=none color=navyblue weight=5 style=\"setlinewidth(8)\"];\n");
-echo("\"Internet\" -> \"thlon-pe01\" [ arrowhead=none arrowtail=none color=navyblue weight=5 style=\"setlinewidth(8)\"];\n");
-echo("\"Internet\" -> \"thlon-lns01\" [ arrowhead=none arrowtail=none color=navyblue weight=5 style=\"setlinewidth(8)\"];\n");
-echo("\"ADSL\" -> \"thlon-lns01\" [ arrowhead=none arrowtail=none color=navyblue weight=5 style=\"setlinewidth(8)\"];\n");
+echo("\"Internet\" -> \"thelon-pe01\" [ arrowhead=none arrowtail=none color=navyblue weight=5 style=\"setlinewidth(8)\"];\n");
+echo("\"Internet\" -> \"thelon-pe02\" [ arrowhead=none arrowtail=none color=navyblue weight=5 style=\"setlinewidth(8)\"];\n");
+echo("\"Internet\" -> \"thnlon-pe01\" [ arrowhead=none arrowtail=none color=navyblue weight=5 style=\"setlinewidth(8)\"];\n");
+echo("\"ADSL\" -> \"thnlon-pe01\" [ arrowhead=none arrowtail=none color=navyblue weight=5 style=\"setlinewidth(8)\"];\n");
$links_sql = "SELECT *, X.ifDescr AS sif, I.ifDescr AS dif FROM links AS L, interfaces AS I, interfaces AS X, devices as D, devices as Y WHERE D.hostname LIKE '%vostron.net' AND I.device_id = D.device_id AND X.device_id = Y.device_id AND D.hostname NOT LIKE '%cust%' AND L.src_if = I.interface_id AND X.interface_id = L.dst_if AND D.location != Y.location AND D.hostname NOT LIKE '%cust.vostron.net' AND Y.hostname NOT LIKE '%cust.vostron.net' ORDER BY D.location DESC";
$links_result = mysql_query($links_sql);
@@ -153,8 +156,8 @@ while($link_data = mysql_fetch_array($links_result)) {
$dif = makeshortif($link_data[dif]);
if(!$die){
-# echo("\"$src\" -> \"$dst\" [taillabel=\"$dif\" headlabel=\"$sif\" arrowhead=none arrowtail=none $info];\n");
- echo("\"$src\" -> \"$dst\" [ arrowhead=none arrowtail=none $info];\n");
+ echo("\"$src\" -> \"$dst\" [taillabel=\"$dif\" headlabel=\"$sif\" arrowhead=none arrowtail=none $info];\n");
+# echo("\"$src\" -> \"$dst\" [ arrowhead=none arrowtail=none $info];\n");
$linkdone[] = "$src $link_data[sif] $dst $link_data[dif]";
$x++;
}
diff --git a/poll-os.php b/poll-os.php
index 361de1ee0..177e6af67 100755
--- a/poll-os.php
+++ b/poll-os.php
@@ -7,15 +7,11 @@ include("includes/functions.php");
$device_query = mysql_query("SELECT device_id,hostname,os,community,snmpver FROM `devices` WHERE `device_id` LIKE '%" . $argv[1] . "' AND status = '1' ORDER BY device_id DESC");
while ($device = mysql_fetch_array($device_query)) {
- $id = $device['device_id'];
- $hostname = $device['hostname'];
- $old_os = $device['os'];
- $community = $device['community'];
- $host = trim(strtolower($hostname));
- $host_os = getHostOS($host, $community, $device[snmpver]);
- if($old_os != $host_os) {
- $sql = mysql_query("UPDATE `devices` SET `os` = '$host_os' WHERE `device_id` = '$id'");
- echo("Updated host : $host ($host_os)\n");
- } else echo("Not Updated host : $host ($host_os)\n");
+ $os = getHostOS($device['hostname'], $device['community'], $device[snmpver]);
+
+ if($os != $device['os']) {
+ $sql = mysql_query("UPDATE `devices` SET `os` = '$os' WHERE `device_id` = '".$device['device_id']."'");
+ echo("Updated host : ".$device['hostname']." ($os)\n");
+ }
}
?>
|