diff --git a/html/.htaccess b/html/.htaccess index fb8cc5b038..3a854028f2 100644 --- a/html/.htaccess +++ b/html/.htaccess @@ -19,8 +19,8 @@ RewriteRule ^interfaces/(.+)/ ?page=interfaces&type=$1 RewriteRule ^bill/([0-9]+) ?page=bills&bill=$1 -RewriteRule ^device/([0-9]+)/([a-z]+)/([a-z]+)/([a-z|0-9]+)/ ?page=device&id=$1§ion=$2&opta=$3&optb=$4 -RewriteRule ^device/([0-9]+)/([a-z]+)/([a-z|0-9]+)/ ?page=device&id=$1§ion=$2&opta=$3 +RewriteRule ^device/([0-9]+)/([a-z]+)/(.+)/(.+)/ ?page=device&id=$1§ion=$2&opta=$3&optb=$4 +RewriteRule ^device/([0-9]+)/([a-z]+)/(.+)/ ?page=device&id=$1§ion=$2&opta=$3 RewriteRule ^device/([0-9]+)/([a-z]+)/ ?page=device&id=$1§ion=$2 RewriteRule ^device/([0-9]+) ?page=device&id=$1 diff --git a/html/css/mktree.css b/html/css/mktree.css new file mode 100644 index 0000000000..559a55f83f --- /dev/null +++ b/html/css/mktree.css @@ -0,0 +1,21 @@ +/* Put this inside a @media qualifier so Netscape 4 ignores it */ +@media screen, print { + /* Turn off list bullets */ + ul.mktree li { list-style: none; } + /* Control how "spaced out" the tree is */ + ul.mktree, ul.mktree ul , ul.mktree li { margin-left:10px; padding:0px; } + /* Provide space for our own "bullet" inside the LI */ + ul.mktree li .bullet { padding-left: 15px; } + /* Show "bullets" in the links, depending on the class of the LI that the link's in */ + ul.mktree li.liOpen .bullet { cursor: pointer; background: url(../images/minus.gif) center left no-repeat; } + ul.mktree li.liClosed .bullet { cursor: pointer; background: url(../images/plus.gif) center left no-repeat; } + ul.mktree li.liBullet .bullet { cursor: default; background: url(../images/bullet.gif) center left no-repeat; } + /* Sublists are visible or not based on class of parent LI */ + ul.mktree li.liOpen ul { display: block; } + ul.mktree li.liClosed ul { display: none; } + /* Format menu items differently depending on what level of the tree they are in */ + ul.mktree li { font-size: 12pt; } + ul.mktree li ul li { font-size: 10pt; } + ul.mktree li ul li ul li { font-size: 10pt; } + ul.mktree li ul li ul li ul li { font-size: 10pt; } +} diff --git a/html/graph.php b/html/graph.php index e1df531220..94c943b6c7 100644 --- a/html/graph.php +++ b/html/graph.php @@ -11,12 +11,10 @@ include("includes/authenticate.inc"); if(!$_SESSION['authenticated']) { echo("not authenticated"); exit; } - if($_GET['params']) { list($_GET['host'], $_GET['if'], $_GET['from'], $_GET['to'], $_GET['width'], $_GET['height'], $_GET['title'], $_GET['vertical'], $_GET['type'], $_GET['interfaces']) = explode("||", mcrypt_ecb(MCRYPT_DES, $key_value, $_GET['params'], MCRYPT_DECRYPT)); } - if($_GET['host']) { $device_id = $_GET['host']; } elseif($_GET['device']) { @@ -28,16 +26,9 @@ $device_id = getpeerhost($_GET['peer']); } - if($_GET['legend']) { - $legend = $_GET['legend']; - } - if($_GET['inverse']) { - $inverse = $_GET['inverse']; - } - - if($device_id) { - $hostname = gethostbyid($device_id); - } + if($_GET['legend']) { $legend = $_GET['legend']; } + if($_GET['inverse']) { $inverse = $_GET['inverse']; } + if($device_id) { $hostname = gethostbyid($device_id); } $from = $_GET['from']; $to = $_GET['to']; @@ -92,7 +83,7 @@ $graph = graph_mac_acc ($_GET['id'], $graphfile, $from, $to, $width, $height, $title, $vertical); break; case 'device_bits': - $graph = graph_device_bits ($device_id, $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = graph_device_bits ($device_id, $graphfile, $from, $to, $width, $height, $title, $vertical, $inverse, $legend); break; case 'bits': $graph = graph_bits ($hostname . "/". $ifIndex . ".rrd", $graphfile, $from, $to, $width, $height, $title, $vertical, $inverse, $legend); @@ -115,10 +106,14 @@ case 'unixfs': $graph = unixfsgraph ($_GET['id'], $graphfile, $from, $to, $width, $height, $title, $vertical); break; - case 'bgpupdates': + case 'bgp_updates': $bgpPeerIdentifier = mysql_result(mysql_query("SELECT bgpPeerIdentifier FROM bgpPeers WHERE bgpPeer_id = '".$_GET['peer']."'"),0); $graph = bgpupdatesgraph ($hostname . "/bgp-" . $bgpPeerIdentifier . ".rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); break; + case 'cbgp_prefixes': + $bgpPeerIdentifier = mysql_result(mysql_query("SELECT bgpPeerIdentifier FROM bgpPeers WHERE bgpPeer_id = '".$_GET['peer']."'"),0); + $graph = graph_cbgp_prefixes ($hostname . "/cbgp-" . $bgpPeerIdentifier . ".".$_GET['afi'].".".$_GET['safi'].".rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); + break; case 'calls': $graph = callsgraphSNOM ($hostname . "/data.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); break; @@ -225,7 +220,9 @@ $graph = apachebitsgraphUnix ($hostname . "/apache.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } break; - + default: + echo("INCORRECT GRAPH TYPE"); + exit; } if($graph) { @@ -233,7 +230,13 @@ echo(`cat graphs/$graphfile`); } else { header('Content-type: image/png'); - echo(`cat images/no-graph.png`); + $string = "Graph Generation Error"; + $im = imagecreate($width, $height); + $orange = imagecolorallocate($im, 255, 255, 255); + $px = (imagesx($im) - 7.5 * strlen($string)) / 2; + imagestring($im, 3, $px, $height / 2 - 8, $string, imagecolorallocate($im, 128, 0, 0)); + imagepng($im); + imagedestroy($im); } $delete = `rm graphs/$graphfile`; diff --git a/html/includes/print-interface.inc b/html/includes/print-interface.inc index 0d394423b8..dbe7de0b52 100644 --- a/html/includes/print-interface.inc +++ b/html/includes/print-interface.inc @@ -19,7 +19,8 @@ $ifHardType = $interface['ifHardType']; if($ifAlias) {$ifAlias = $ifAlias . "
";} - if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; } + #if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; } + if($bg == "#e5e5e5") { $bg = "#ffffff"; } else { $bg="#e5e5e5"; } if($interface['in_errors'] > 0 || $interface['out_errors'] > 0) { $error_img = generateiflink($interface,"Interface Errors",errors); diff --git a/html/pages/device.php b/html/pages/device.php index db230317e3..86393860b5 100644 --- a/html/pages/device.php +++ b/html/pages/device.php @@ -68,15 +68,16 @@ 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("
  • - - Ports - -
  • -
  • - - Port Graphs + + Ports
  • "); + +#
  • +# +# Port Graphs +# +#
  • "); } if($_SESSION[userlevel] >= "5") { diff --git a/html/pages/device/bgp.inc.php b/html/pages/device/bgp.inc.php index fc973b3223..eaeaa2dec7 100644 --- a/html/pages/device/bgp.inc.php +++ b/html/pages/device/bgp.inc.php @@ -9,7 +9,7 @@ echo(" Updates | Prefixes: IPv4 | VPNv4 | - IPv6 + IPv6 "); @@ -34,11 +34,11 @@ echo(" $af_query = mysql_query("SELECT * FROM `bgpPeers_cbgp` WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '".$peer['bgpPeerIdentifier']."'"); unset($peer_af); while($afisafi = mysql_fetch_array($af_query)) { - $afi = $afisafi['afi']; + $afi = $afisafi['afi']; $safi = $afisafi['safi']; - $peer_af .= $sep . $config['afi'][$afi][$safi]; + $peer_af .= $sep . $config['afi'][$afi][$safi]; ##### CLEAN ME UP, I AM MESSY AND I SMELL OF CHEESE! $sep = "
    "; - $valid_afi_safi[$afi][$safi] = 1; + $valid_afi_safi[$afi][$safi] = 1; ## Build a list of valid AFI/SAFI for this peer } unset($sep); echo(" @@ -55,11 +55,8 @@ echo(" if($_GET['opta']) { foreach(explode(" ", $_GET['opta']) as $graph_type) { - if($graph_type == "cbgp_prefixes") { list($afi, $safi) = explode(".", $_GET['optb']); $afisafi = "&afi=$afi&safi=$safi"; } - if($graph_type == "bgp_updates" || $valid_afi_safi[$afi][$safi]) { - $daily_traffic = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$day&to=$now&width=210&height=100$afisafi"; $daily_url = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150$afisafi"; $weekly_traffic = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$week&to=$now&width=210&height=100$afisafi"; @@ -68,7 +65,6 @@ echo(" $monthly_url = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150$afisafi"; $yearly_traffic = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$year&to=$now&width=210&height=100$afisafi"; $yearly_url = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150$afisafi"; - echo(""); echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> "); echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> "); diff --git a/html/pages/device/ifs.inc.php b/html/pages/device/ifs.inc.php deleted file mode 100644 index 45de68c82a..0000000000 --- a/html/pages/device/ifs.inc.php +++ /dev/null @@ -1,13 +0,0 @@ -"); - $i = "1"; - $interface_query = mysql_query("select * from interfaces WHERE device_id = '$_GET[id]' AND deleted = '0' ORDER BY `ifDescr` ASC"); - while($interface = mysql_fetch_array($interface_query)) { - include("includes/print-interface.inc"); - } - echo("
    "); - -?> diff --git a/html/pages/device/ifgraphs.inc.php b/html/pages/device/ports.inc.php similarity index 91% rename from html/pages/device/ifgraphs.inc.php rename to html/pages/device/ports.inc.php index fbc39ffe67..5cc89cedda 100644 --- a/html/pages/device/ifgraphs.inc.php +++ b/html/pages/device/ports.inc.php @@ -1,16 +1,13 @@ -Details | Graphs: - +
    +Details | Graphs: Bits | Packets | NU Packets | Errors
    "); -$dographs = 1; - if($_GET['opta'] == graphs ) { if($_GET['optb']) { $graph_type = $_GET['optb']; diff --git a/includes/discovery/bgp-peers.php b/includes/discovery/bgp-peers.php index b446a9563c..5f65690748 100755 --- a/includes/discovery/bgp-peers.php +++ b/includes/discovery/bgp-peers.php @@ -10,7 +10,7 @@ if($bgpLocalAs) { - echo("AS$bgpLocalAs "); + echo("AS$bgpLocalAs \n"); if($bgpLocalAs != $device['bgpLocalAs']) { mysql_query("UPDATE devices SET bgpLocalAs = '$bgpLocalAs' WHERE device_id = '".$device['device_id']."'"); echo("Updated AS\n"); } @@ -26,15 +26,43 @@ $astext = trim(str_replace("\"", "", shell_exec("/usr/bin/dig +short AS$peer_as.asn.cymru.com TXT | cut -d '|' -f 5 | sed s/\\\"//g"))); - #echo(str_pad($peer_ip, 32). str_pad($astext, 32) . " $peer_as "); - + echo(str_pad($peer_ip, 40) . " AS$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') { $add = mysql_query("INSERT INTO bgpPeers (`device_id`, `bgpPeerIdentifier`, `bgpPeerRemoteAS`) VALUES ('".$device['device_id']."','$peer_ip','$peer_as')"); echo("+"); } else { - echo("."); $update = mysql_query("UPDATE `bgpPeers` SET astext = '$astext' WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '$peer_ip'"); } + + ## Get afi/safi and populate cbgp on cisco IOS + if($device['os'] == "IOS") { + unset($af_list); + $af_cmd = $config['snmpwalk'] . " -CI -m CISCO-BGP4-MIB -OsQ -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'] . " "; + $af_cmd .= "cbgpPeerAddrFamilyName." . $peer_ip; + $afs = trim(str_replace("cbgpPeerAddrFamilyName.".$peer_ip.".", "", `$af_cmd`)); + foreach (explode("\n", $afs) as $af) { + list($afisafi, $text) = explode(" = ", $af); + list($afi, $safi) = explode(".", $afisafi); + if($afi && $safi) { + echo("($afi:$safi)"); + $af_list['$afi']['$safi'] = 1; + if(mysql_result(mysql_query("SELECT COUNT(*) FROM `bgpPeers_cbgp` WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '$peer_ip' AND afi = '$afi' AND safi = '$safi'"),0) == 0) { + mysql_query("INSERT INTO `bgpPeers_cbgp` (device_id,bgpPeerIdentifier, afi, safi) VALUES ('".$device['device_id']."','$peer_ip','$afi','$safi')"); + } + } + } + $af_query = mysql_query("SELECT * FROM bgpPeers_cbgp WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '$peer_ip'"); + while ($entry = mysql_fetch_array($af_query)) { + $afi = $entry['afi']; + $afi = $entry['safi']; + if (!$af_list['$afi']['$safi']) { + mysql_query("DELETE FROM `bgpPeers_cbgp` WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '$peer_ip' AND afi = '$afi' AND safi = '$safi'"); + } + } # AF list + } # if IOS + echo("\n"); } # If Peer } # Foreach } else { echo("No BGP on host"); } # End if diff --git a/includes/discovery/ipv6-addresses.php b/includes/discovery/ipv6-addresses.php index 96d5c381bb..5943fa1626 100644 --- a/includes/discovery/ipv6-addresses.php +++ b/includes/discovery/ipv6-addresses.php @@ -7,6 +7,7 @@ $ipv6interfaces = shell_exec($config['snmpget']." -Ovnq -".$device['snmpver']." if($ipv6interfaces){ $oids = trim(trim(shell_exec($config['snmpwalk']." -".$device['snmpver']." -Ln -c ".$device['community']." ".$device['hostname'].":".$device['port']." ipAddressIfIndex.ipv6 -Osq | grep -v No"))); + echo($config['snmpwalk']." -".$device['snmpver']." -Ln -c ".$device['community']." ".$device['hostname'].":".$device['port']." ipAddressIfIndex.ipv6 -Osq | grep -v No"); $oids = str_replace("ipAddressIfIndex.ipv6.", "", $oids); $oids = str_replace("\"", "", $oids); $oids = trim($oids); foreach(explode("\n", $oids) as $data) { if($data) { @@ -37,7 +38,7 @@ if($ipv6interfaces){ if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ip6addr` WHERE `addr` = '$address' AND `cidr` = '$cidr' AND `interface_id` = '$interface_id'"), 0) == '0') { mysql_query("INSERT INTO `ip6addr` (`addr`, `comp_addr`, `cidr`, `origin`, `network`, `interface_id`) VALUES ('$address', '$comp', '$cidr', '$origin', '$network', '$interface_id')"); echo("+"); - } + } else { echo("."); } if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ip6networks` WHERE `cidr` = '$network'"), 0) < '1') { mysql_query("INSERT INTO `ip6networks` (`id`, `cidr`) VALUES ('', '$network')"); echo("N"); @@ -47,7 +48,7 @@ if($ipv6interfaces){ mysql_query("INSERT INTO `ip6adjacencies` (`network_id`, `interface_id`) VALUES ('$network_id', '$interface_id')"); echo("A"); } - } else { echo("."); } + } } } } else { echo("None configured"); } diff --git a/includes/graphing.php b/includes/graphing.php index 19fe3813f3..6a2808b25d 100644 --- a/includes/graphing.php +++ b/includes/graphing.php @@ -7,7 +7,7 @@ include("graphing/unix.php"); function graph_multi_bits ($interfaces, $graph, $from, $to, $width, $height, $title, $vertical, $inverse, $legend = '0') { global $config, $installdir; - $imgfile = "graphs/" . "$graph"; + $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; $options = "--alt-autoscale-max -E --start $from --end " . ($to - 150) . " --width $width --height $height"; if($height < "33") { $options .= " --only-graph"; } $i = 1; @@ -65,7 +65,7 @@ function temp_graph ($temp, $graph, $from, $to, $width, $height, $title, $vertic $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } $hostname = gethostbyid($device); - $imgfile = "graphs/" . "$graph"; + $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; $iter = "1"; $sql = mysql_query("SELECT * FROM temperature where temp_id = '$temp'"); $opts[] = "COMMENT: Cur Max"; @@ -100,7 +100,7 @@ function temp_graph_dev ($device, $graph, $from, $to, $width, $height, $title, $ $options .= " -l 0 -E -b 1024 --title '$title' "; if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } $hostname = gethostbyid($device); - $imgfile = "graphs/" . "$graph"; + $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; $iter = "1"; $sql = mysql_query("SELECT * FROM temperature where temp_host = '$device'"); $options .= "COMMENT:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Cur\ \ \ \ Max\\\\n"; @@ -124,55 +124,27 @@ function temp_graph_dev ($device, $graph, $from, $to, $width, $height, $title, $ } function graph_device_bits ($device, $graph, $from, $to, $width, $height, $title, $vertical, $inverse, $legend = '1') { - global $config, $installdir; - $imgfile = "graphs/" . "$graph"; - $options = "--alt-autoscale-max -E --start $from --end " . ($to - 150) . " --width $width --height $height "; - if($height < "33") { $options .= " --only-graph"; } + global $config; $hostname = gethostbyid($device); - $query = mysql_query("SELECT `ifIndex` FROM `interfaces` WHERE `device_id` = '$device' AND `ifType` NOT LIKE '%oopback%' AND `ifType` NOT LIKE '%SVI%' AND `ifType` != 'l2vlan'"); + $query = mysql_query("SELECT `ifIndex`,`interface_id` FROM `interfaces` WHERE `device_id` = '$device' AND `ifType` NOT LIKE '%oopback%' AND `ifType` NOT LIKE '%SVI%' AND `ifType` != 'l2vlan'"); if($width <= "300") { $options .= "--font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } $pluses = ""; while($int = mysql_fetch_row($query)) { if(is_file($config['rrd_dir'] . "/" . $hostname . "/" . $int[0] . ".rrd")) { - $in_thing .= $seperator . "inoctets" . $int[0] . ",UN,0," . "inoctets" . $int[0] . ",IF"; - $out_thing .= $seperator . "outoctets" . $int[0] . ",UN,0," . "outoctets" . $int[0] . ",IF"; - $pluses .= $plus; - $seperator = ","; - $plus = ",+"; - $options .= "DEF:inoctets" . $int[0] . "=" . $config['rrd_dir'] . "/" . $hostname . "/" . $int[0] . ".rrd:INOCTETS:AVERAGE "; - $options .= "DEF:outoctets" . $int[0] . "=" . $config['rrd_dir'] . "/" . $hostname . "/" . $int[0] . ".rrd:OUTOCTETS:AVERAGE "; + $interfaces .= $seperator . $int[1]; + $seperator = ","; } } - $options .= " CDEF:inoctets=$in_thing$pluses "; - $options .= " CDEF:outoctets=$out_thing$pluses "; - $options .= " CDEF:doutoctets=outoctets,-1,* "; - $options .= " CDEF:inbits=inoctets,8,* "; - $options .= " CDEF:outbits=outoctets,8,* "; - $options .= " CDEF:doutbits=doutoctets,8,* "; - $options .= " AREA:inbits#CDEB8B: "; - $options .= " COMMENT:BPS\ \ \ \ Current\ \ \ Average\ \ \ \ \ \ Max\\\\n "; - $options .= " LINE1.25:inbits#006600:In\ "; - $options .= " GPRINT:inbits:LAST:%6.2lf%s "; - $options .= " GPRINT:inbits:AVERAGE:%6.2lf%s "; - $options .= " GPRINT:inbits:MAX:%6.2lf%s\\\l "; - $options .= " AREA:doutbits#C3D9FF: "; - $options .= " LINE1.25:doutbits#000099:Out "; - $options .= " GPRINT:outbits:LAST:%6.2lf%s "; - $options .= " GPRINT:outbits:AVERAGE:%6.2lf%s "; - $options .= " GPRINT:outbits:MAX:%6.2lf%s "; - $thing = shell_exec($config['rrdtool'] . " graph $imgfile $options"); + $imgfile = graph_multi_bits($interfaces, $graph, $from, $to, $width, $height, $title, $vertical, $inverse, $legend); return $imgfile; } function graph_mac_acc ($id, $graph, $from, $to, $width, $height) { global $config; - $imgfile = "graphs/" . "$graph"; + $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; $query = mysql_query("SELECT * FROM `mac_accounting` AS M, `interfaces` AS I, `devices` AS D WHERE M.ma_id = '".$id."' AND I.interface_id = M.interface_id AND I.device_id = D.device_id"); $acc = mysql_fetch_array($query); - $database = $config['rrd_dir'] . "/" . $acc['hostname'] . "/mac-accounting/" . $acc['ifIndex'] . "-" . $acc['peer_ip'] . ".rrd"; - - $options = "--alt-autoscale-max -E --start $from --end " . ($to - 150) . " --width $width --height $height "; if($height < "33") { $options .= " --only-graph"; } $period = $to - $from; @@ -210,17 +182,13 @@ function graph_mac_acc ($id, $graph, $from, $to, $width, $height) { $options .= " GPRINT:totout:Out\ %6.2lf%s\)\\\\l"; $options .= " LINE1:95thin#aa0000"; $options .= " LINE1:d95thout#aa0000"; - - #echo($config['rrdtool'] . " graph $imgfile $options"); $thing = shell_exec($config['rrdtool'] . " graph $imgfile $options"); return $imgfile; } - - function graph_mac_acc_interface ($interface, $graph, $from, $to, $width, $height) { global $config, $installdir; - $imgfile = "graphs/" . "$graph"; + $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; $options = "--alt-autoscale-max -E --start $from --end " . ($to - 150) . " --width $width --height $height "; if($height < "33") { $options .= " --only-graph"; } $hostname = gethostbyid($device); @@ -258,14 +226,13 @@ function graph_mac_acc_interface ($interface, $graph, $from, $to, $width, $heigh return $imgfile; } - function graph_bits ($rrd, $graph, $from, $to, $width, $height, $title, $vertical, $inverse = '0', $legend = '1') { - global $config, $installdir; + global $config; $database = $config['rrd_dir'] . "/" . $rrd; - $imgfile = "graphs/" . "$graph"; + $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; $period = $to - $from; $options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height "; - if($height < "33") { $options .= " --only-graph"; } + if($height < "33") { $options .= " --only-graph"; unset ($legend); } if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } if($inverse) { $options .= " DEF:inoctets=$database:OUTOCTETS:AVERAGE"; @@ -285,32 +252,32 @@ function graph_bits ($rrd, $graph, $from, $to, $width, $height, $title, $vertica $options .= " VDEF:95thin=inbits,95,PERCENT"; $options .= " VDEF:95thout=outbits,95,PERCENT"; $options .= " VDEF:d95thout=doutbits,5,PERCENT"; - if ($legend) { - $options .= " AREA:inbits#CDEB8B:"; - $options .= " COMMENT:BPS\ \ \ \ Current\ \ \ Average\ \ \ \ \ \ Max\ \ \ 95th\ %\\\\n"; - $options .= " LINE1.25:inbits#006600:In\ "; - $options .= " GPRINT:inbits:LAST:%6.2lf%s"; - $options .= " GPRINT:inbits:AVERAGE:%6.2lf%s"; - $options .= " GPRINT:inbits:MAX:%6.2lf%s"; - $options .= " GPRINT:95thin:%6.2lf%s\\\\n"; - $options .= " AREA:doutbits#C3D9FF:"; - $options .= " LINE1.25:doutbits#000099:Out"; - $options .= " GPRINT:outbits:LAST:%6.2lf%s"; - $options .= " GPRINT:outbits:AVERAGE:%6.2lf%s"; - $options .= " GPRINT:outbits:MAX:%6.2lf%s"; - $options .= " GPRINT:95thout:%6.2lf%s\\\\n"; - $options .= " GPRINT:tot:Total\ %6.2lf%s"; - $options .= " GPRINT:totin:\(In\ %6.2lf%s"; - $options .= " GPRINT:totout:Out\ %6.2lf%s\)\\\\l"; - $options .= " LINE1:95thin#aa0000"; - $options .= " LINE1:d95thout#aa0000"; + if ($legend == "no") { + $options .= " AREA:inbits#CDEB8B"; + $options .= " LINE1.25:inbits#006600"; + $options .= " AREA:doutbits#C3D9FF"; + $options .= " LINE1.25:doutbits#000099"; + $options .= " LINE1:95thin#aa0000"; + $options .= " LINE1:d95thout#aa0000"; } else { - $options .= " AREA:inbits#CDEB8B"; - $options .= " LINE1.25:inbits#006600"; - $options .= " AREA:doutbits#C3D9FF"; - $options .= " LINE1.25:doutbits#000099"; - $options .= " LINE1:95thin#aa0000"; - $options .= " LINE1:d95thout#aa0000"; + $options .= " AREA:inbits#CDEB8B:"; + $options .= " COMMENT:BPS\ \ \ \ Current\ \ \ Average\ \ \ \ \ \ Max\ \ \ 95th\ %\\\\n"; + $options .= " LINE1.25:inbits#006600:In\ "; + $options .= " GPRINT:inbits:LAST:%6.2lf%s"; + $options .= " GPRINT:inbits:AVERAGE:%6.2lf%s"; + $options .= " GPRINT:inbits:MAX:%6.2lf%s"; + $options .= " GPRINT:95thin:%6.2lf%s\\\\n"; + $options .= " AREA:doutbits#C3D9FF:"; + $options .= " LINE1.25:doutbits#000099:Out"; + $options .= " GPRINT:outbits:LAST:%6.2lf%s"; + $options .= " GPRINT:outbits:AVERAGE:%6.2lf%s"; + $options .= " GPRINT:outbits:MAX:%6.2lf%s"; + $options .= " GPRINT:95thout:%6.2lf%s\\\\n"; + $options .= " GPRINT:tot:Total\ %6.2lf%s"; + $options .= " GPRINT:totin:\(In\ %6.2lf%s"; + $options .= " GPRINT:totout:Out\ %6.2lf%s\)\\\\l"; + $options .= " LINE1:95thin#aa0000"; + $options .= " LINE1:d95thout#aa0000"; } $thing = shell_exec($config['rrdtool'] . " graph $imgfile $options"); return $imgfile; @@ -319,7 +286,7 @@ function graph_bits ($rrd, $graph, $from, $to, $width, $height, $title, $vertica function pktsgraph ($rrd, $graph, $from, $to, $width, $height) { global $config, $installdir; $database = $config['rrd_dir'] . "/" . $rrd; - $imgfile = "graphs/" . "$graph"; + $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; $options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height "; if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } $options .= " DEF:in=$database:INUCASTPKTS:AVERAGE"; @@ -343,7 +310,7 @@ function pktsgraph ($rrd, $graph, $from, $to, $width, $height) { function errorgraph ($rrd, $graph, $from, $to, $width, $height) { global $config, $installdir; $database = $config['rrd_dir'] . "/" . $rrd; - $imgfile = "graphs/" . "$graph"; + $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; $options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height "; if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } $options .= " DEF:in=$database:INERRORS:AVERAGE"; @@ -367,7 +334,7 @@ function errorgraph ($rrd, $graph, $from, $to, $width, $height) { function nucastgraph ($rrd, $graph, $from, $to, $width, $height) { global $config, $installdir; $database = $config['rrd_dir'] . "/" . $rrd; - $imgfile = "graphs/" . "$graph"; + $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; $options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height "; if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } $options .= " DEF:in=$database:INNUCASTPKTS:AVERAGE"; @@ -388,10 +355,39 @@ function nucastgraph ($rrd, $graph, $from, $to, $width, $height) { return $imgfile; } +function graph_cbgp_prefixes ($rrd, $graph, $from, $to, $width, $height) { + global $config; + $database = $config['rrd_dir'] . "/" . $rrd; + $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; + $options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height "; + if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } + $options .= " DEF:Accepted=$database:AcceptedPrefixes:AVERAGE"; + $options .= " DEF:Denied=$database:DeniedPrefixes:AVERAGE"; + $options .= " DEF:Advertised=$database:AdvertisedPrefixes:AVERAGE"; + $options .= " DEF:Suppressed=$database:SuppressedPrefixes:AVERAGE"; + $options .= " DEF:Withdrawn=$database:WithdrawnPrefixes:AVERAGE"; + $options .= " CDEF:dAdvertised=Advertised,-1,*"; + $options .= " COMMENT:Prefixes\ \ \ \ \ \ Current\ \ Minimum\ \ Maximum\\\\n"; + $options .= " AREA:Accepted#eeaaaa:"; + $options .= " LINE2:Accepted#cc0000:Accepted\ \ "; + $options .= " GPRINT:Accepted:LAST:%6.2lf%s"; + $options .= " GPRINT:Accepted:MIN:%6.2lf%s"; + $options .= " GPRINT:Accepted:MAX:%6.2lf%s\\\\l"; + $options .= " AREA:dAdvertised#aaeeaa:"; + $options .= " LINE2:dAdvertised#00cc00:Advertised"; + $options .= " GPRINT:Advertised:LAST:%6.2lf%s"; + $options .= " GPRINT:Advertised:MIN:%6.2lf%s"; + $options .= " GPRINT:Advertised:MAX:%6.2lf%s\\\\l"; + $thing = shell_exec($config['rrdtool'] . " graph $imgfile $options"); +# echo($config['rrdtool'] . " graph $imgfile $options"); + return $imgfile; +} + + function bgpupdatesgraph ($rrd, $graph , $from, $to, $width, $height) { global $config, $installdir; $database = $config['rrd_dir'] . "/" . $rrd; - $imgfile = "graphs/" . "$graph"; + $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; $options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height "; if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } $options .= " DEF:in=$database:bgpPeerInUpdates:AVERAGE"; @@ -415,7 +411,7 @@ function bgpupdatesgraph ($rrd, $graph , $from, $to, $width, $height) { function graph_cpu_generic_single ($rrd, $graph , $from, $to, $width, $height) { global $config; $database = $config['rrd_dir'] . "/" . $rrd; - $imgfile = "graphs/" . "$graph"; + $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; $options = "--alt-autoscale-max -l 0 -E --start $from --end $to --width $width --height $height "; if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } $options .= " DEF:cpu=$database:cpu:AVERAGE"; @@ -431,7 +427,7 @@ function graph_cpu_generic_single ($rrd, $graph , $from, $to, $width, $height) { function graph_adsl_rate ($rrd, $graph, $from, $to, $width, $height) { global $config, $installdir; $database = $config['rrd_dir'] . "/" . $rrd; - $imgfile = "graphs/" . "$graph"; + $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; $options = "--alt-autoscale-max -l 0 -E --start $from --end $to --width $width --height $height "; if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } $options .= " DEF:adslAtucCurrAtt=$database:adslAtucCurrAtt:AVERAGE"; @@ -452,7 +448,7 @@ function graph_adsl_rate ($rrd, $graph, $from, $to, $width, $height) { function graph_adsl_snr ($rrd, $graph, $from, $to, $width, $height) { global $config, $installdir; $database = $config['rrd_dir'] . "/" . $rrd; - $imgfile = "graphs/" . "$graph"; + $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; $options = "--alt-autoscale-max -l 0 -E --start $from --end $to --width $width --height $height "; if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } $options .= " DEF:adslAtucCurrSnr=$database:adslAtucCurrSnr:AVERAGE"; @@ -473,7 +469,7 @@ function graph_adsl_snr ($rrd, $graph, $from, $to, $width, $height) { function graph_adsl_atn ($rrd, $graph, $from, $to, $width, $height) { global $config, $installdir; $database = $config['rrd_dir'] . "/" . $rrd; - $imgfile = "graphs/" . "$graph"; + $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; $options = "--alt-autoscale-max -l 0 -E --start $from --end $to --width $width --height $height "; if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } $options .= " DEF:adslAtucCurrAtn=$database:adslAtucCurrAtn:AVERAGE"; @@ -494,7 +490,7 @@ function graph_adsl_atn ($rrd, $graph, $from, $to, $width, $height) { function cpugraph ($rrd, $graph , $from, $to, $width, $height) { global $config, $installdir; $database = $config['rrd_dir'] . "/" . $rrd; - $imgfile = "graphs/" . "$graph"; + $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; $options = "--alt-autoscale-max -l 0 -E --start $from --end $to --width $width --height $height "; if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } $options .= " DEF:5s=$database:LOAD5S:AVERAGE"; @@ -510,7 +506,7 @@ function cpugraph ($rrd, $graph , $from, $to, $width, $height) { function uptimegraph ($rrd, $graph , $from, $to, $width, $height, $title, $vertical) { global $config, $installdir; $database = $config['rrd_dir'] . "/" . $rrd; - $imgfile = "graphs/" . "$graph"; + $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; $options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height "; if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } $options .= " DEF:uptime=$database:uptime:AVERAGE"; @@ -528,7 +524,7 @@ function uptimegraph ($rrd, $graph , $from, $to, $width, $height, $title, $verti function memgraph ($rrd, $graph , $from, $to, $width, $height, $title, $vertical) { global $config, $installdir; $database = $config['rrd_dir'] . "/" . $rrd; - $imgfile = "graphs/" . "$graph"; + $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; $period = $to - $from; $options = "-l 0 --alt-autoscale-max -E --start $from --end $to --width $width --height $height "; if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } @@ -559,7 +555,7 @@ function memgraph ($rrd, $graph , $from, $to, $width, $height, $title, $vertical function ip_graph ($rrd, $graph, $from, $to, $width, $height) { global $config, $installdir; $database = $config['rrd_dir'] . "/" . $rrd; - $imgfile = "graphs/" . "$graph"; + $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; $period = $to - $from; $options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height "; if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } @@ -606,7 +602,7 @@ function ip_graph ($rrd, $graph, $from, $to, $width, $height) { function icmp_graph ($rrd, $graph, $from, $to, $width, $height) { global $config, $installdir; $database = $config['rrd_dir'] . "/" . $rrd; - $imgfile = "graphs/" . "$graph"; + $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; $period = $to - $from; $options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height "; if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } $options .= "DEF:icmpInMsgs=$database:icmpInMsgs:AVERAGE"; @@ -657,7 +653,7 @@ function icmp_graph ($rrd, $graph, $from, $to, $width, $height) { function tcp_graph ($rrd, $graph, $from, $to, $width, $height) { global $config, $installdir; $database = $config['rrd_dir'] . "/" . $rrd; - $imgfile = "graphs/" . "$graph"; + $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; $period = $to - $from; $options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height "; if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } $options .= "DEF:icmpInMsgs=$database:icmpInMsgs:AVERAGE"; @@ -704,7 +700,7 @@ function tcp_graph ($rrd, $graph, $from, $to, $width, $height) { function udp_graph ($rrd, $graph, $from, $to, $width, $height) { global $config, $installdir; $database = $config['rrd_dir'] . "/" . $rrd; - $imgfile = "graphs/" . "$graph"; + $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; $period = $to - $from; $options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height "; if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } $options .= "DEF:icmpInMsgs=$database:icmpInMsgs:AVERAGE"; diff --git a/includes/polling/bgpPeer.inc.php b/includes/polling/bgpPeer.inc.php index 560dceb48a..21477153d2 100755 --- a/includes/polling/bgpPeer.inc.php +++ b/includes/polling/bgpPeer.inc.php @@ -10,18 +10,16 @@ while($peer = mysql_fetch_array($peers)) { ### Poll BGP Peer - echo("Checking ".$peer['bgpPeerIdentifier']."\n"); + echo("Checking ".$peer['bgpPeerIdentifier']." "); $peer_cmd = $config['snmpget'] . " -m BGP4-MIB -Ovq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'] . " "; $peer_cmd .= "bgpPeerState." . $peer['bgpPeerIdentifier'] . " bgpPeerAdminStatus." . $peer['bgpPeerIdentifier'] . " bgpPeerInUpdates." . $peer['bgpPeerIdentifier'] . " bgpPeerOutUpdates." . $peer['bgpPeerIdentifier'] . " bgpPeerInTotalMessages." . $peer['bgpPeerIdentifier'] . " "; $peer_cmd .= "bgpPeerOutTotalMessages." . $peer['bgpPeerIdentifier'] . " bgpPeerFsmEstablishedTime." . $peer['bgpPeerIdentifier'] . " bgpPeerInUpdateElapsedTime." . $peer['bgpPeerIdentifier'] . " "; $peer_cmd .= "bgpPeerLocalAddr." . $peer['bgpPeerIdentifier'] . ""; $peer_data = trim(`$peer_cmd`); - list($bgpPeerState, $bgpPeerAdminStatus, $bgpPeerInUpdates, $bgpPeerOutUpdates, $bgpPeerInTotalMessages, $bgpPeerOutTotalMessages, $bgpPeerFsmEstablishedTime, $bgpPeerInUpdateElapsedTime, $bgpLocalAddr) = explode("\n", $peer_data); $peerrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/bgp-" . $peer['bgpPeerIdentifier'] . ".rrd"; - if(!is_file($peerrrd)) { $woo = shell_exec($config['rrdtool'] . " create $peerrrd \ DS:bgpPeerOutUpdates:COUNTER:600:U:100000000000 \ @@ -34,15 +32,68 @@ while($peer = mysql_fetch_array($peers)) { RRA:AVERAGE:0.5:24:775 \ RRA:AVERAGE:0.5:288:797"); } - rrdtool_update("$peerrrd", "N:$bgpPeerOutUpdates:$bgpPeerInUpdates:$bgpPeerOutTotalMessages:$bgpPeerInTotalMesages:$bgpPeerFsmEstablishedTime"); - $update = "UPDATE bgpPeers SET bgpPeerState = '$bgpPeerState', bgpPeerAdminStatus = '$bgpPeerAdminStatus', "; $update .= "bgpPeerFsmEstablishedTime = '$bgpPeerFsmEstablishedTime', bgpPeerInUpdates = '$bgpPeerInUpdates' , bgpLocalAddr = '$bgpLocalAddr' , bgpPeerOutUpdates = '$bgpPeerOutUpdates'"; $update .= " WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '" . $peer['bgpPeerIdentifier'] . "'"; mysql_query($update); + if($device['os'] == "IOS") { + + ## Poll each AFI/SAFI for this peer (using CISCO-BGP4-MIB) + $afi_query = mysql_query("SELECT * FROM bgpPeers_cbgp WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '" . $peer['bgpPeerIdentifier'] . "'"); + while($peer_afi = mysql_fetch_array($afi_query)) { + + $afi = $peer_afi['afi']; + $safi = $peer_afi['safi']; + echo($config['afi'][$afi][$safi]. " "); + + $cbgp_cmd = $config['snmpget'] . " -m CISCO-BGP4-MIB -Ovq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port']; + $cbgp_cmd .= " cbgpPeerAcceptedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi"; + $cbgp_cmd .= " cbgpPeerDeniedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi"; + $cbgp_cmd .= " cbgpPeerPrefixAdminLimit." . $peer['bgpPeerIdentifier'] . ".$afi.$safi"; + $cbgp_cmd .= " cbgpPeerPrefixThreshold." . $peer['bgpPeerIdentifier'] . ".$afi.$safi"; + $cbgp_cmd .= " cbgpPeerPrefixClearThreshold." . $peer['bgpPeerIdentifier'] . ".$afi.$safi"; + $cbgp_cmd .= " cbgpPeerAdvertisedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi"; + $cbgp_cmd .= " cbgpPeerSuppressedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi"; + $cbgp_cmd .= " cbgpPeerWithdrawnPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi"; + echo("\n$cbgp_cmd\n"); + $cbgp_data = preg_replace("/^OID.*$/", "", trim(`$cbgp_cmd`)); + + list($cbgpPeerAcceptedPrefixes,$cbgpPeerDeniedPrefixes,$cbgpPeerPrefixAdminLimit,$cbgpPeerPrefixThreshold,$cbgpPeerPrefixClearThreshold,$cbgpPeerAdvertisedPrefixes,$cbgpPeerSuppressedPrefixes,$cbgpPeerWithdrawnPrefixes) = explode("\n", $cbgp_data); + + $update = "UPDATE bgpPeers_cbgp SET"; + $update .= " `cbgpPeerAcceptedPrefixes` = '$cbgpPeerAcceptedPrefixes'"; + $update .= ", `cbgpPeerDeniedPrefixes` = '$cbgpPeerDeniedPrefixes'"; + $update .= ", `cbgpPeerPrefixAdminLimit` = '$cbgpPeerAdminLimit'"; + $update .= ", `cbgpPeerPrefixThreshold` = '$cbgpPeerPrefixThreshold'"; + $update .= ", `cbgpPeerPrefixClearThreshold` = '$cbgpPeerPrefixClearThreshold'"; + $update .= ", `cbgpPeerAdvertisedPrefixes` = '$cbgpPeerAdvertisedPrefixes'"; + $update .= ", `cbgpPeerSuppressedPrefixes` = '$cbgpPeerSuppressedPrefixes'"; + $update .= ", `cbgpPeerWithdrawnPrefixes` = '$cbgpPeerWithdrawnPrefixes'"; + $update .= " WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '" . $peer['bgpPeerIdentifier'] . "' AND afi = '$afi' AND safi = '$safi'"; + + mysql_query($update); + + $cbgp_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/cbgp-" . $peer['bgpPeerIdentifier'] . ".$afi.$safi.rrd"; + if(!is_file($cbgp_rrd)) { + $woo = shell_exec($config['rrdtool'] . " create $cbgp_rrd \ + DS:AcceptedPrefixes:GAUGE:600:U:100000000000 \ + DS:DeniedPrefixes:GAUGE:600:U:100000000000 \ + DS:AdvertisedPrefixes:GAUGE:600:U:100000000000 \ + DS:SuppressedPrefixes:GAUGE:600:U:100000000000 \ + DS:WithdrawnPrefixes:GAUGE:600:U:100000000000 \ + 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("$cbgp_rrd", "N:$cbgpPeerAcceptedPrefixes:$cbgpPeerDeniedPrefixes:$cbgpPeerAdvertisedPrefixes:$cbgpPeerSuppressedPrefixes:$cbgpPeerWithdrawnPrefixes"); + } + } + echo("\n"); + } ## End While loop on peers } ## End check for BGP support diff --git a/includes/static-config.php b/includes/static-config.php index b667003bad..4769184347 100644 --- a/includes/static-config.php +++ b/includes/static-config.php @@ -5,6 +5,14 @@ $config['ifdescr']['IOS'] = true; $config['ifdescr']['IOS XE'] = true; +## AFI / SAFI pairs for BGP (and other stuff, perhaps) +$config['afi']['ipv4']['unicast'] = "IPv4"; +$config['afi']['ipv4']['multiicast'] = "IPv4 Multicast"; +$config['afi']['ipv4']['vpn'] = "VPNv4"; +$config['afi']['ipv6']['unicast'] = "IPv6"; +$config['afi']['ipv6']['multicast'] = "IPv6 Multicast"; + + ############################## # No changes below this line # ############################## diff --git a/mibs/CISCO-BGP4-MIB.my b/mibs/CISCO-BGP4-MIB.my new file mode 100644 index 0000000000..683e4dc8df --- /dev/null +++ b/mibs/CISCO-BGP4-MIB.my @@ -0,0 +1,1169 @@ +-- ***************************************************************** +-- CISCO-BGP4-MIB.my +-- +-- June 2001, Ravindra Rathi +-- +-- Copyright (c) 2001, 2003 by Cisco Systems, Inc. +-- All rights reserved. +-- +-- ***************************************************************** + +CISCO-BGP4-MIB DEFINITIONS ::=BEGIN + +IMPORTS + MODULE-IDENTITY, + OBJECT-TYPE, + NOTIFICATION-TYPE, + Unsigned32, Gauge32, Counter32 + FROM SNMPv2-SMI + TruthValue, + TEXTUAL-CONVENTION + FROM SNMPv2-TC + MODULE-COMPLIANCE, + OBJECT-GROUP, + NOTIFICATION-GROUP + FROM SNMPv2-CONF + ciscoMgmt + FROM CISCO-SMI + InetAddressType, + InetAddress + FROM INET-ADDRESS-MIB + SnmpAdminString + FROM SNMP-FRAMEWORK-MIB + bgpPeerEntry, + bgpPeerRemoteAddr, + bgpPeerLastError, + bgpPeerState + FROM BGP4-MIB; + +ciscoBgp4MIB MODULE-IDENTITY + LAST-UPDATED "200302240000Z" + ORGANIZATION "Cisco Systems, Inc." + CONTACT-INFO + " Cisco Systems + Customer Service + + Postal: 170 W Tasman Drive + San Jose, CA 95134 + USA + + Tel: +1 800 553-NETS + + E-mail: cs-iprouting-bgp@cisco.com" + DESCRIPTION + "An extension to the IETF BGP4 MIB module defined in + RFC 1657. + + Following is the terminology associated with Border + Gateway Protocol(BGP). + + UPDATE message + UPDATE messages are used to transfer routing + information between BGP peers. An UPDATE message + is used to advertise a single feasible route to a + peer, or to withdraw multiple unfeasible routes + from service. + + Adj-RIBs-In + The Adj-RIBs-In store routing information that has + been learned from inbound UPDATE messages. Their + contents represent routes that are available as an + input to the Decision Process. + + Loc-RIB(BGP table) + The Loc-RIB contains the local routing information + that the BGP speaker has selected by applying its + local policies to the routing information contained + in its Adj-RIBs-In. + + Adj-RIBs-Out + The Adj-RIBs-Out store the information that the + local BGP speaker has selected for advertisement to + its peers. The routing information stored in the + Adj-RIBs-Out will be carried in the local BGP + speaker's UPDATE messages and advertised to its + peers. + + Path Attributes + A variable length sequence of path attributes is + present in every UPDATE. Each path attribute is a + triple of variable length. + + Network Layer Reachability Information(NLRI) + A variable length field present in UPDATE messages + which contains a list of Network Layer address + prefixes. + + Address Family Identifier(AFI) + Primary identifier to indicate the type of the + Network Layer Reachability Information(NLRI) being + carried. + + Subsequent Address Family Identifier(SAFI) + Secondary identifier to indicate the type of the + Network Layer Reachability Information(NLRI) being + carried." + REVISION "200302240000Z" + DESCRIPTION + "+Added cbgpPeerCapsTable + +Added cbgpPeerAddrFamilyTable + +Added cbgpPeerAddrFamilyPrefixTable + +Added notification event cbgpBackwardTransition + +Added notification event cbgpPrefixThresholdExceeded + +Added notification event cbgpPrefixThresholdClear" + REVISION "200212190000Z" + DESCRIPTION + "+Added cbgpPeerPrefixTable + +Added notification event cbgpFsmStateChange" + REVISION "200108130000Z" + DESCRIPTION + "Initial version of the MIB module." + ::= { ciscoMgmt 187 } + + ciscoBgp4MIBObjects + OBJECT IDENTIFIER ::= { ciscoBgp4MIB 1 } + cbgpRoute OBJECT IDENTIFIER ::= { ciscoBgp4MIBObjects 1 } + cbgpPeer OBJECT IDENTIFIER ::= { ciscoBgp4MIBObjects 2 } + + -- Textual convention + + CbgpSafi ::= TEXTUAL-CONVENTION + STATUS current + DESCRIPTION + "Subsequent Address Family Identifier(SAFI) is used + by BGP speaker to indicate the type of the the Network + Layer Reachability Information(NLRI) being carried. + RFC-2858 has defined the following values for SAFI. + 1 - Network Layer Reachability Information used for + unicast forwarding + 2 - Network Layer Reachability Information used for + multicast forwarding + 3 - Network Layer Reachability Information used for + both unicast and multicast forwarding. + SAFI values 128 through 255 are for private use." + REFERENCE + "RFC-2858: Multiprotocol Extensions for BGP-4, + RFC-2547: BGP/MPLS VPNs" + SYNTAX INTEGER { + unicast(1), + multicast(2), + unicastAndMulticast(3), + vpn(128) + } + + CbgpNetworkAddress ::= TEXTUAL-CONVENTION + STATUS current + DESCRIPTION + "Represents the Network Address prefix carried in the + BGP UPDATE messages. In the following table, column + 'Type' gives the kind of Network Layer address which + will be stored in the object of this type based on the + values of Address Family Identifier(AFI) and SAFI. + + AFI SAFI Type + + ipv4(1) unicast(1) IPv4 address + + ipv4(1) multicast(2) IPv4 address + + ipv4(1) vpn(128) VPN-IPv4 address + + ipv6(2) unicast(1) IPv6 address + + A VPN-IPv4 address is a 12-byte quantity, beginning + with an 8-byte 'Route Distinguisher (RD)' and ending + with a 4-byte IPv4 address." + REFERENCE + "RFC-2858: Multiprotocol Extensions for BGP-4 + RFC-2547: BGP/MPLS VPNs, section 4.1" + SYNTAX OCTET STRING (SIZE (0..255)) + + -- BGP4 Received Routes for all the supported address families + + cbgpRouteTable OBJECT-TYPE + SYNTAX SEQUENCE OF CbgpRouteEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "This table contains information about routes to + destination networks from all BGP4 peers. Since + BGP4 can carry routes for multiple Network Layer + protocols, this table has the Address Family + Identifier(AFI) of the Network Layer protocol as the + first index. Further for a given AFI, routes carried + by BGP4 are distinguished based on Subsequent Address + Family Identifiers(SAFI). Hence that is used as the + second index. Conceptually there is a separate Loc-RIB + maintained by the BGP speaker for each combination of + AFI and SAFI supported by it." + REFERENCE + "RFC-1771: A Border Gateway Protocol 4 (BGP-4), + RFC-2858: Multiprotocol Extensions for BGP-4, + RFC-2547: BGP/MPLS VPNs" + ::= { cbgpRoute 1 } + + cbgpRouteEntry OBJECT-TYPE + SYNTAX CbgpRouteEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Information about a path to a network received from + a peer." + INDEX { cbgpRouteAfi, + cbgpRouteSafi, + cbgpRoutePeerType, + cbgpRoutePeer, + cbgpRouteAddrPrefix, + cbgpRouteAddrPrefixLen } + ::= { cbgpRouteTable 1 } + + CbgpRouteEntry ::= SEQUENCE { + cbgpRouteAfi InetAddressType, + cbgpRouteSafi CbgpSafi, + cbgpRoutePeerType InetAddressType, + cbgpRoutePeer InetAddress, + cbgpRouteAddrPrefix CbgpNetworkAddress, + cbgpRouteAddrPrefixLen Unsigned32, + cbgpRouteOrigin INTEGER, + cbgpRouteASPathSegment OCTET STRING, + cbgpRouteNextHop CbgpNetworkAddress, + cbgpRouteMedPresent TruthValue, + cbgpRouteMultiExitDisc Unsigned32, + cbgpRouteLocalPrefPresent TruthValue, + cbgpRouteLocalPref Unsigned32, + cbgpRouteAtomicAggregate INTEGER, + cbgpRouteAggregatorAS Unsigned32, + cbgpRouteAggregatorAddrType InetAddressType, + cbgpRouteAggregatorAddr InetAddress, + cbgpRouteBest TruthValue, + cbgpRouteUnknownAttr OCTET STRING + } + + cbgpRouteAfi OBJECT-TYPE + SYNTAX InetAddressType + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Represents Address Family Identifier(AFI) of the + Network Layer protocol associated with the route. + An implementation is only required to support IPv4 + unicast and VPNv4 (Value - 1) address families." + ::= { cbgpRouteEntry 1 } + + cbgpRouteSafi OBJECT-TYPE + SYNTAX CbgpSafi + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Represents Subsequent Address Family Identifier(SAFI) + of the route. It gives additional information about + the type of the route. An implementation is only + required to support IPv4 unicast(Value - 1) and VPNv4( + Value - 128) address families." + ::= { cbgpRouteEntry 2 } + + cbgpRoutePeerType OBJECT-TYPE + SYNTAX InetAddressType + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Represents the type of Network Layer address stored + in cbgpRoutePeer. An implementation is only required + to support IPv4 address type(Value - 1)." + ::= { cbgpRouteEntry 3 } + + cbgpRoutePeer OBJECT-TYPE + SYNTAX InetAddress + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The Network Layer address of the peer where the route + information was learned. An implementation is only + required to support an IPv4 peer." + ::= { cbgpRouteEntry 4 } + + cbgpRouteAddrPrefix OBJECT-TYPE + SYNTAX CbgpNetworkAddress + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A Network Address prefix in the Network Layer + Reachability Information field of BGP UPDATE message. + This object is a Network Address containing the prefix + with length specified by cbgpRouteAddrPrefixLen. Any + bits beyond the length specified by + cbgpRouteAddrPrefixLen are zeroed." + ::= { cbgpRouteEntry 5 } + + cbgpRouteAddrPrefixLen OBJECT-TYPE + SYNTAX Unsigned32 (0..2040) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Length in bits of the Network Address prefix in the + Network Layer Reachability Information field." + ::= { cbgpRouteEntry 6 } + + cbgpRouteOrigin OBJECT-TYPE + SYNTAX INTEGER { + igp(1), -- networks are interior + egp(2), -- networks learned via EGP + incomplete(3) -- undetermined + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The ultimate origin of the route information." + ::= { cbgpRouteEntry 7 } + + cbgpRouteASPathSegment OBJECT-TYPE + SYNTAX OCTET STRING (SIZE (0..255)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The sequence of AS path segments. Each AS + path segment is represented by a triple + . + + The type is a 1-octet field which has two + possible values: + 1 AS_SET: unordered set of ASs a route in the + UPDATE message has traversed + 2 AS_SEQUENCE: ordered set of ASs a route in the + UPDATE message has traversed. + + The length is a 1-octet field containing the + number of ASs in the value field. + + The value field contains one or more AS + numbers, each AS is represented in the octet + string as a pair of octets according to the + following algorithm: + + first-byte-of-pair = ASNumber / 256; + second-byte-of-pair = ASNumber & 255;" + ::= { cbgpRouteEntry 8 } + + cbgpRouteNextHop OBJECT-TYPE + SYNTAX CbgpNetworkAddress + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The Network Layer address of the border router + that should be used for the destination network." + ::= { cbgpRouteEntry 9 } + + cbgpRouteMedPresent OBJECT-TYPE + SYNTAX TruthValue + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Indicates the presence/absence of MULTI_EXIT_DISC + attribute for the route." + ::= { cbgpRouteEntry 10 } + + cbgpRouteMultiExitDisc OBJECT-TYPE + SYNTAX Unsigned32 (0..4294967295) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This metric is used to discriminate between multiple + exit points to an adjacent autonomous system. The + value of this object is irrelevant if the value of + of cbgpRouteMedPresent is false(2)." + ::= { cbgpRouteEntry 11 } + + cbgpRouteLocalPrefPresent OBJECT-TYPE + SYNTAX TruthValue + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Indicates the presence/absence of LOCAL_PREF + attribute for the route." + ::= { cbgpRouteEntry 12 } + + cbgpRouteLocalPref OBJECT-TYPE + SYNTAX Unsigned32 (0..4294967295) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The degree of preference calculated by the local BGP4 + speaker for the route. The value of this object is + irrelevant if the value of cbgpRouteLocalPrefPresent + is false(2)." + ::= { cbgpRouteEntry 13 } + + cbgpRouteAtomicAggregate OBJECT-TYPE + SYNTAX INTEGER { + lessSpecificRouteNotSelected(1), + lessSpecificRouteSelected(2) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Whether or not the local system has selected a less + specific route without selecting a more specific + route." + ::= { cbgpRouteEntry 14 } + + cbgpRouteAggregatorAS OBJECT-TYPE + SYNTAX Unsigned32 (0..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The AS number of the last BGP4 speaker that performed + route aggregation. A value of zero (0) indicates the + absence of this attribute." + ::= { cbgpRouteEntry 15 } + + cbgpRouteAggregatorAddrType OBJECT-TYPE + SYNTAX InetAddressType + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Represents the type of Network Layer address stored + in cbgpRouteAggregatorAddr." + ::= { cbgpRouteEntry 16 } + + cbgpRouteAggregatorAddr OBJECT-TYPE + SYNTAX InetAddress + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The Network Layer address of the last BGP4 speaker + that performed route aggregation. A value of all zeros + indicates the absence of this attribute." + ::= { cbgpRouteEntry 17 } + + cbgpRouteBest OBJECT-TYPE + SYNTAX TruthValue + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "An indication of whether or not this route was chosen + as the best BGP4 route." + ::= { cbgpRouteEntry 18 } + + cbgpRouteUnknownAttr OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(0..255)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "One or more path attributes not understood by this + BGP4 speaker. Size zero (0) indicates the absence of + such attribute(s). Octets beyond the maximum size, if + any, are not recorded by this object. + + Each path attribute is a triple of variable length. + Attribute Type is a two-octet field that consists of + the Attribute Flags octet followed by the Attribute + Type Code octet. If the Extended Length bit of the + Attribute Flags octet is set to 0, the third octet of + the Path Attribute contains the length of the + attribute data in octets. If the Extended Length bit + of the Attribute Flags octet is set to 1, then the + third and the fourth octets of the path attribute + contain the length of the attribute data in octets. + The remaining octets of the Path Attribute represent + the attribute value and are interpreted according to + the Attribute Flags and the Attribute Type Code." + REFERENCE + "RFC-1771: A Border Gateway Protocol 4 (BGP-4), + section 4.3" + ::= { cbgpRouteEntry 19 } + + -- BGP Peer table. + + cbgpPeerTable OBJECT-TYPE + SYNTAX SEQUENCE OF CbgpPeerEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "BGP peer table. This table contains, + one entry per BGP peer, information about + the connections with BGP peers." + ::= { cbgpPeer 1 } + + cbgpPeerEntry OBJECT-TYPE + SYNTAX CbgpPeerEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Entry containing information about the + connection with a BGP peer." + AUGMENTS { bgpPeerEntry } + ::= { cbgpPeerTable 1 } + + CbgpPeerEntry ::= SEQUENCE { + cbgpPeerPrefixAccepted Counter32, + cbgpPeerPrefixDenied Counter32, + cbgpPeerPrefixLimit Unsigned32, + cbgpPeerPrefixAdvertised Counter32, + cbgpPeerPrefixSuppressed Counter32, + cbgpPeerPrefixWithdrawn Counter32, + cbgpPeerLastErrorTxt SnmpAdminString, + cbgpPeerPrevState INTEGER + } + + cbgpPeerPrefixAccepted OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS deprecated + DESCRIPTION + "Number of Route prefixes received on this connnection, + which are accepted after applying filters. Possible + filters are route maps, prefix lists, distributed + lists, etc." + ::= { cbgpPeerEntry 1 } + + + cbgpPeerPrefixDenied OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS deprecated + DESCRIPTION + "Counter which gets incremented when a route prefix + received on this connection is denied or when a route + prefix is denied during soft reset of this connection + if 'soft-reconfiguration' is on . This object is + initialized to zero when the peer is configured or + the router is rebooted" + ::= { cbgpPeerEntry 2 } + + cbgpPeerPrefixLimit OBJECT-TYPE + SYNTAX Unsigned32 (1..4294967295) + MAX-ACCESS read-write + STATUS deprecated + DESCRIPTION + "Max number of route prefixes accepted on this + connection" + ::= { cbgpPeerEntry 3 } + + cbgpPeerPrefixAdvertised OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS deprecated + DESCRIPTION + "Counter which gets incremented when a route prefix + is advertised on this connection. This object is + initialized to zero when the peer is configured or + the router is rebooted" + ::= { cbgpPeerEntry 4 } + + cbgpPeerPrefixSuppressed OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS deprecated + DESCRIPTION + "Counter which gets incremented when a route prefix + is suppressed from being sent on this connection. This + object is initialized to zero when the peer is + configured or the router is rebooted" + ::= { cbgpPeerEntry 5 } + + cbgpPeerPrefixWithdrawn OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS deprecated + DESCRIPTION + "Counter which gets incremented when a route prefix + is withdrawn on this connection. This object is + initialized to zero when the peer is configured or + the router is rebooted" + + ::= { cbgpPeerEntry 6 } + + cbgpPeerLastErrorTxt OBJECT-TYPE + SYNTAX SnmpAdminString + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Implementation specific error description for + bgpPeerLastErrorReceived." + ::= { cbgpPeerEntry 7 } + + cbgpPeerPrevState OBJECT-TYPE + SYNTAX INTEGER { + none(0), + idle(1), + connect(2), + active(3), + opensent(4), + openconfirm(5), + established(6) + } + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The BGP peer connection previous state." + REFERENCE + "Section 8, RFC 1771, A Border Gateway Protocol 4 + (BGP-4)." + ::= { cbgpPeerEntry 8 } + + -- + -- Peer capabilities + -- + cbgpPeerCapsTable OBJECT-TYPE + SYNTAX SEQUENCE OF CbgpPeerCapsEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "This table contains the capabilities that are + supported by a peer. Capabilities of a peer are + received during BGP connection establishment. + Values corresponding to each received capability + are stored in this table. When a new capability + is received, this table is updated with a new + entry. When an existing capability is not received + during the latest connection establishment, the + corresponding entry is deleted from the table." + REFERENCE + "RFC 2842, Capabilities Advertisement with + BGP-4. + + RFC2818, Route Refresh Capability for BGP-4. + + RFC2858, Multiprotocol Extensions for BGP-4. + + draft-ietf-idr-restart-05.txt, Graceful Restart + Mechanism for BGP" + ::= { cbgpPeer 2 } + + cbgpPeerCapsEntry OBJECT-TYPE + SYNTAX CbgpPeerCapsEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Each entry represents a capability received from a + peer with a particular code and an index. When a + capability is received multiple times with different + values during a BGP connection establishment, + corresponding entries are differentiated with indices." + INDEX { + bgpPeerRemoteAddr, + cbgpPeerCapCode, + cbgpPeerCapIndex + } + ::= { cbgpPeerCapsTable 1 } + + + CbgpPeerCapsEntry ::= SEQUENCE { + cbgpPeerCapCode INTEGER, + cbgpPeerCapIndex Unsigned32, + cbgpPeerCapValue OCTET STRING + } + + cbgpPeerCapCode OBJECT-TYPE + SYNTAX INTEGER { + multiProtocol(1), + routeRefresh(2), + gracefulRestart(64), + routeRefreshOld(128) + } + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The BGP Capability Advertisement Capability Code." + REFERENCE + "RFC 2842, Capabilities Advertisement with + BGP-4. + + RFC2818, Route Refresh Capability for BGP-4. + + RFC2858, Multiprotocol Extensions for BGP-4. + + draft-ietf-idr-restart-05.txt, Graceful Restart + Mechanism for BGP" + ::= { cbgpPeerCapsEntry 1 } + + cbgpPeerCapIndex OBJECT-TYPE + SYNTAX Unsigned32 (1..128) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Multiple instances of a given capability may be + sent by a BGP speaker. This variable is used + to index them." + ::= { cbgpPeerCapsEntry 2 } + + cbgpPeerCapValue OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(0..255)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value of the announced capability. This + MIB object value is organized as given below, + Capability : Route Refresh Capability + Null string + Capability : Multiprotocol Extensions + +----------------------------------+ + | AFI(16 bits) | + +----------------------------------+ + | SAFI (8 bits) | + +----------------------------------+ + Capability : Graceful Restart + +----------------------------------+ + | Restart Flags (4 bits) | + +----------------------------------+ + | Restart Time in seconds (12 bits)| + +----------------------------------+ + | AFI(16 bits) | + +----------------------------------+ + | SAFI (8 bits) | + +----------------------------------+ + | Flags for Address Family (8 bits)| + +----------------------------------+ + | ... | + +----------------------------------+ + | AFI(16 bits) | + +----------------------------------+ + | SAFI (8 bits) | + +----------------------------------+ + | Flags for Address Family (8 bits)| + +----------------------------------+" + REFERENCE + "RFC 2842, Capabilities Advertisement with + BGP-4. + + RFC2818, Route Refresh Capability for BGP-4. + + RFC2858, Multiprotocol Extensions for BGP-4. + + draft-ietf-idr-restart-05.txt, Graceful Restart + Mechanism for BGP" + ::= { cbgpPeerCapsEntry 3 } + + -- + -- BGP Peer Address Family table + -- + cbgpPeerAddrFamilyTable OBJECT-TYPE + SYNTAX SEQUENCE OF CbgpPeerAddrFamilyEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "This table contains information related to + address families supported by a peer. Supported + address families of a peer are known during BGP + connection establishment. When a new supported + address family is known, this table is updated + with a new entry. When an address family is not + supported any more, corresponding entry is deleted + from the table." + ::= { cbgpPeer 3 } + + cbgpPeerAddrFamilyEntry OBJECT-TYPE + SYNTAX CbgpPeerAddrFamilyEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry is identified by an AFI/SAFI pair and + peer address. It contains names associated with + an address family." + INDEX { + bgpPeerRemoteAddr, + cbgpPeerAddrFamilyAfi, + cbgpPeerAddrFamilySafi + } + ::= { cbgpPeerAddrFamilyTable 1 } + + CbgpPeerAddrFamilyEntry ::= SEQUENCE { + cbgpPeerAddrFamilyAfi InetAddressType, + cbgpPeerAddrFamilySafi CbgpSafi, + cbgpPeerAddrFamilyName SnmpAdminString + } + + cbgpPeerAddrFamilyAfi OBJECT-TYPE + SYNTAX InetAddressType + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The AFI index of the entry. An implementation + is only required to support IPv4 unicast and + VPNv4 (Value - 1) address families." + ::= { cbgpPeerAddrFamilyEntry 1 } + + cbgpPeerAddrFamilySafi OBJECT-TYPE + SYNTAX CbgpSafi + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The SAFI index of the entry. An implementation + is only required to support IPv4 unicast(Value + - 1) and VPNv4( Value - 128) address families." + REFERENCE + "RFC-2858: Multiprotocol Extensions for BGP-4, + RFC-2547: BGP/MPLS VPNs" + ::= { cbgpPeerAddrFamilyEntry 2 } + + cbgpPeerAddrFamilyName OBJECT-TYPE + SYNTAX SnmpAdminString + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Implementation specific Address Family name." + ::= { cbgpPeerAddrFamilyEntry 3 } + + -- + -- BGP Address Family Peer Prefix table + -- + + cbgpPeerAddrFamilyPrefixTable OBJECT-TYPE + SYNTAX SEQUENCE OF CbgpPeerAddrFamilyPrefixEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "This table contains prefix related information + related to address families supported by a peer. + Supported address families of a peer are known + during BGP connection establishment. When a new + supported address family is known, this table + is updated with a new entry. When an address + family is not supported any more, corresponding + entry is deleted from the table." + ::= { cbgpPeer 4 } + + cbgpPeerAddrFamilyPrefixEntry OBJECT-TYPE + SYNTAX CbgpPeerAddrFamilyPrefixEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry is identified by an AFI/SAFI pair and + peer address. It contains information associated + with route prefixes belonging to an address family." + INDEX { + bgpPeerRemoteAddr, + cbgpPeerAddrFamilyAfi, + cbgpPeerAddrFamilySafi + } + ::= { cbgpPeerAddrFamilyPrefixTable 1 } + + CbgpPeerAddrFamilyPrefixEntry ::= SEQUENCE { + cbgpPeerAcceptedPrefixes Counter32, + cbgpPeerDeniedPrefixes Gauge32, + cbgpPeerPrefixAdminLimit Unsigned32, + cbgpPeerPrefixThreshold Unsigned32, + cbgpPeerPrefixClearThreshold Unsigned32, + cbgpPeerAdvertisedPrefixes Gauge32, + cbgpPeerSuppressedPrefixes Gauge32, + cbgpPeerWithdrawnPrefixes Gauge32 + } + + cbgpPeerAcceptedPrefixes OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of accepted route prefixes on this connection, + which belong to an address family." + ::= { cbgpPeerAddrFamilyPrefixEntry 1 } + + cbgpPeerDeniedPrefixes OBJECT-TYPE + SYNTAX Gauge32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This counter is incremented when a route prefix, which + belongs to an address family, received on this + connection is denied. It is initialized to zero when + the connection is undergone a hard reset." + ::= { cbgpPeerAddrFamilyPrefixEntry 2 } + + cbgpPeerPrefixAdminLimit OBJECT-TYPE + SYNTAX Unsigned32 (1..4294967295) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Max number of route prefixes accepted for an address + family on this connection." + ::= { cbgpPeerAddrFamilyPrefixEntry 3 } + + cbgpPeerPrefixThreshold OBJECT-TYPE + SYNTAX Unsigned32 (1..100) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Prefix threshold value (%) for an address family + on this connection at which warning message stating + the prefix count is crossed the threshold or + corresponding SNMP notification is generated." + ::= { cbgpPeerAddrFamilyPrefixEntry 4 } + + cbgpPeerPrefixClearThreshold OBJECT-TYPE + SYNTAX Unsigned32 (1..100) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Prefix threshold value (%) for an address family + on this connection at which SNMP clear notification + is generated if prefix threshold notification is + already generated." + ::= { cbgpPeerAddrFamilyPrefixEntry 5 } + + cbgpPeerAdvertisedPrefixes OBJECT-TYPE + SYNTAX Gauge32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This counter is incremented when a route prefix, + which belongs to an address family is advertised + on this connection. It is initialized to zero when + the connection is undergone a hard reset." + ::= { cbgpPeerAddrFamilyPrefixEntry 6 } + + cbgpPeerSuppressedPrefixes OBJECT-TYPE + SYNTAX Gauge32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This counter is incremented when a route prefix, + which belongs to an address family is suppressed + from being sent on this connection. It is + initialized to zero when the connection is undergone + a hard reset." + ::= { cbgpPeerAddrFamilyPrefixEntry 7 } + + cbgpPeerWithdrawnPrefixes OBJECT-TYPE + SYNTAX Gauge32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This counter is incremented when a route prefix, + which belongs to an address family, is withdrawn on + this connection. It is initialized to zero when the + connection is undergone a hard reset." + ::= { cbgpPeerAddrFamilyPrefixEntry 8 } + + -- Notifications + + ciscoBgp4NotifyPrefix OBJECT IDENTIFIER ::= { ciscoBgp4MIB 0 } + + cbgpFsmStateChange NOTIFICATION-TYPE + OBJECTS { bgpPeerLastError, + bgpPeerState, + cbgpPeerLastErrorTxt, + cbgpPeerPrevState + } + STATUS current + DESCRIPTION + "The BGP cbgpFsmStateChange notification is generated + for every BGP FSM state change. The bgpPeerRemoteAddr + value is attached to the notification object ID." + ::= { ciscoBgp4NotifyPrefix 1 } + + cbgpBackwardTransition NOTIFICATION-TYPE + OBJECTS { bgpPeerLastError, + bgpPeerState, + cbgpPeerLastErrorTxt, + cbgpPeerPrevState + } + STATUS current + DESCRIPTION + "The cbgpBackwardTransition Event is generated when the + BGP FSM moves from a higher numbered state to a lower + numbered state. The bgpPeerRemoteAddr value is attached + to the notification object ID." + ::= { ciscoBgp4NotifyPrefix 2 } + + cbgpPrefixThresholdExceeded NOTIFICATION-TYPE + OBJECTS { cbgpPeerPrefixAdminLimit, + cbgpPeerPrefixThreshold + } + STATUS current + DESCRIPTION + "The cbgpPrfefixMaxThresholdExceeded notification is + generated when prefix count exceeds the configured + warning threshold on a session for an address + family. The bgpPeerRemoteAddr, cbgpPeerAddrFamilyAfi + and cbgpPeerAddrFamilySafi values are attached to the + notification object ID." + ::= { ciscoBgp4NotifyPrefix 3 } + + cbgpPrefixThresholdClear NOTIFICATION-TYPE + OBJECTS { cbgpPeerPrefixAdminLimit, + cbgpPeerPrefixClearThreshold + } + STATUS current + DESCRIPTION + "The cbgpPrefixThresholdClear notification is + generated when prefix count drops below the configured + clear threshold on a session for an address family once + cbgpPrefixThresholdExceeded is generated. This won't + be generated if the peer session goes down after the + generation of cbgpPrefixThresholdExceeded. + The bgpPeerRemoteAddr, cbgpPeerAddrFamilyAfi and + cbgpPeerAddrFamilySafi values are attached to the + notification object ID." + ::= { ciscoBgp4NotifyPrefix 4 } + + + -- ciscoBgp4NotificationPrefix is deprecated. + -- Do not define any objects and/or notifications + -- under this OID. + ciscoBgp4NotificationPrefix + OBJECT IDENTIFIER ::= { ciscoBgp4MIB 2 } + + -- conformance information + + ciscoBgp4MIBConformance + OBJECT IDENTIFIER ::= { ciscoBgp4MIB 3 } + ciscoBgp4MIBCompliances + OBJECT IDENTIFIER ::= { ciscoBgp4MIBConformance 1 } + ciscoBgp4MIBGroups + OBJECT IDENTIFIER ::= { ciscoBgp4MIBConformance 2 } + + -- compliance statements + + ciscoBgp4MIBCompliance MODULE-COMPLIANCE + STATUS deprecated + DESCRIPTION + "The compliance statement for entities which implement + the Cisco BGP4 MIB" + MODULE -- this module + MANDATORY-GROUPS { ciscoBgp4RouteGroup } + ::= { ciscoBgp4MIBCompliances 1 } + + ciscoBgp4MIBComplianceRev1 MODULE-COMPLIANCE + STATUS deprecated + DESCRIPTION + "The compliance statement for entities which implement + the Cisco BGP4 MIB" + MODULE -- this module + MANDATORY-GROUPS { ciscoBgp4RouteGroup, + ciscoBgp4PeerGroup, + ciscoBgp4NotificationsGroup } + + OBJECT cbgpRouteAggregatorAddrType + SYNTAX INTEGER { ipv4(1) } + DESCRIPTION + "An implementation is only required to support + IPv4 address type for aggregator address." + + OBJECT cbgpRouteAggregatorAddr + SYNTAX InetAddress (SIZE (4)) + DESCRIPTION + "An implementation is only required to support + IPv4 address type for aggregator address." + + OBJECT cbgpPeerPrefixLimit + SYNTAX Unsigned32 (1..4294967295) + MIN-ACCESS read-only + DESCRIPTION + "SET operation is not supported on this object" + + ::= { ciscoBgp4MIBCompliances 2 } + + ciscoBgp4MIBComplianceRev2 MODULE-COMPLIANCE + STATUS current + DESCRIPTION + "The compliance statement for entities which implement + the Cisco BGP4 MIB" + MODULE -- this module + MANDATORY-GROUPS { ciscoBgp4RouteGroup, + ciscoBgp4PeerGroup1, + ciscoBgp4NotificationsGroup1 } + + OBJECT cbgpRouteAggregatorAddrType + SYNTAX INTEGER { ipv4(1) } + DESCRIPTION + "An implementation is only required to support + IPv4 address type." + + OBJECT cbgpRouteAggregatorAddr + SYNTAX OCTET STRING (SIZE (0..4)) + DESCRIPTION + "An implementation is only required to support + IPv4 address type." + + OBJECT cbgpPeerPrefixAdminLimit + MIN-ACCESS read-only + DESCRIPTION + "SET operation is not supported on this object" + + OBJECT cbgpPeerPrefixThreshold + MIN-ACCESS read-only + DESCRIPTION + "SET operation is not supported on this object" + + ::= { ciscoBgp4MIBCompliances 3 } + + -- Units of conformance + + ciscoBgp4RouteGroup OBJECT-GROUP + OBJECTS { cbgpRouteOrigin, + cbgpRouteASPathSegment, + cbgpRouteNextHop, + cbgpRouteMedPresent, + cbgpRouteMultiExitDisc, + cbgpRouteLocalPrefPresent, + cbgpRouteLocalPref, + cbgpRouteAtomicAggregate, + cbgpRouteAggregatorAS, + cbgpRouteAggregatorAddrType, + cbgpRouteAggregatorAddr, + cbgpRouteBest, + cbgpRouteUnknownAttr + } + STATUS current + DESCRIPTION + "A collection of objects providing information + about routes received by BGP speaker." + ::= { ciscoBgp4MIBGroups 1 } + + ciscoBgp4PeerGroup OBJECT-GROUP + OBJECTS { + cbgpPeerPrefixAccepted, + cbgpPeerPrefixDenied, + cbgpPeerPrefixLimit, + cbgpPeerPrefixAdvertised, + cbgpPeerPrefixSuppressed, + cbgpPeerPrefixWithdrawn + } + STATUS deprecated + DESCRIPTION + "A collection of objects providing information + about routes received by BGP speaker." + ::= { ciscoBgp4MIBGroups 2 } + + ciscoBgp4NotificationsGroup NOTIFICATION-GROUP + NOTIFICATIONS { cbgpFsmStateChange } + STATUS deprecated + DESCRIPTION + "The collection of notifications related to BGP." + ::= { ciscoBgp4MIBGroups 3 } + + ciscoBgp4PeerGroup1 OBJECT-GROUP + OBJECTS { + cbgpPeerPrevState, + cbgpPeerLastErrorTxt, + cbgpPeerCapValue, + cbgpPeerAddrFamilyName, + cbgpPeerAcceptedPrefixes, + cbgpPeerDeniedPrefixes, + cbgpPeerPrefixAdminLimit, + cbgpPeerPrefixThreshold, + cbgpPeerPrefixClearThreshold, + cbgpPeerAdvertisedPrefixes, + cbgpPeerSuppressedPrefixes, + cbgpPeerWithdrawnPrefixes + } + STATUS current + DESCRIPTION + "A collection of objects providing information + about a BGP peer." + ::= { ciscoBgp4MIBGroups 4 } + + ciscoBgp4NotificationsGroup1 NOTIFICATION-GROUP + NOTIFICATIONS { + cbgpFsmStateChange, + cbgpBackwardTransition, + cbgpPrefixThresholdExceeded, + cbgpPrefixThresholdClear + } + STATUS current + DESCRIPTION + "The collection of notifications related to BGP." + ::= { ciscoBgp4MIBGroups 5 } +END diff --git a/poll-device.php b/poll-device.php index 6c15ce8f95..1dbcd6760c 100755 --- a/poll-device.php +++ b/poll-device.php @@ -29,7 +29,7 @@ while ($device = mysql_fetch_array($device_query)) { echo("Polling " . $device['hostname'] . " ( device_id ".$device['device_id']." )\n\n"); unset($update); unset($update_query); unset($seperator); unset($version); unset($uptime); unset($features); - unset($sysLocation); unset($hardware); unset($sysDescr); unset($sysContact); + unset($sysLocation); unset($hardware); unset($sysDescr); unset($sysContact); unset($sysName); $pingable = isPingable($device['hostname']); diff --git a/test-discovery.php b/test-discovery.php index 438c07e191..719573c670 100755 --- a/test-discovery.php +++ b/test-discovery.php @@ -28,6 +28,14 @@ if($argv[1] == "--device" && $argv[2]) { exit; } +if ($argv[2] == "--type" && $argv[3]) { + $type = $argv[3]; +} elseif ($argv[3] == "--type" && $argv[4]) { + $type = $argv[4]; +} else { + echo("Require valid discovery type.\n"); + exit; +} $devices_polled = 0; @@ -36,12 +44,13 @@ while ($device = mysql_fetch_array($device_query)) { echo($device['hostname'] ."\n"); -# include("includes/discovery/cisco-physical.php"); -# include("includes/discovery/ipv6-addresses.php"); -# include("includes/discovery/cisco-pw.php"); + include("includes/discovery/".$type.".php"); +# include("includes/discovery/ipv6-addresses.php"); +# include("includes/discovery/cisco-pw.php"); - include("includes/discovery/host-physical.php"); +# include("includes/discovery/host-physical.php"); +# include("includes/discovery/bgp-peers.php"); echo("\n"); $devices_polled++; }