quote:Originally posted by MithrilhallMy Suggestion...Write your own page using PHP. It has built in snmp support and it works great. I've written some custom pages for our Orion install in PHP so we can turn ports on/off on our switches.I'm also in the process of writing a custom page in PHP that will display the switches MAC table so we know what MAC address are plugged into what ports.
quote:Originally posted by MithrilhallAre you looking for the Dot3StatsTable(EtherLike-MIB:dot3StatsDuplexStatus)?BTWI installed PHPv5 on my Orion box(Windows 2000 Server) and added a custom section to our Orion pages. See image below:
quote:<?php require_once 'db_connection.php'; require_once "PHPTelnetx.php"; $tmp = ""; global $ccount; $ccount = 0; function alpha($telnet,$tmp, $ccount) { $telnet->DoCommand(' ', $result); $working = explode("\n", $result); for ($y=1;$y<count($working);$y++) { if(substr_count($working[$y], "Quit")>=1) { alpha(&$telnet,&$tmp, &$ccount); } else { $a = str_replace("", "", $working[$y]); $b = str_replace("[K", "", $a); $c = str_replace("% Unrecognized command", "", $b); beta(&$c, &$ccount); } } } function beta($c, $ccount) { $xxx = substr($c, 0, 10); $yyy = substr($c, 11, 8); $zzz = substr($c, 20, strlen($c)); if (strpos($c, ":") !== false) { if ($yyy == "00:09:5b" || $yyy == "00:0f:b5" || $yyy == "00:14:6c") { echo $xxx . " <a href='http://asm2/snmp/mac.php?MAC=" . $yyy . "' target='_blank' style='text-decoration: none; color: #ff3333;'>" . $yyy . "</a>:" . $zzz . "\n"; $test = $xxx . " <a href='http://asm2/snmp/mac.php?MAC=" . $yyy . "' target='_blank' style='text-decoration: none; color: #ff3333;'>" . $yyy . "</a>:" . $zzz . "\n"; $ccount = $ccount + 1; } else { echo $xxx . " <a href='http://asm2/snmp/mac.php?MAC=" . $yyy . "' target='_blank' style='text-decoration: none; color: #00ff00;'>" . $yyy . "</a>:" . $zzz . "\n"; } } else { echo $c; } }?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>sh bridge address-table</title><style type="text/css"><!--body{ background:000000; background-image:url("images/bg.jpg"); background-attachment:fixed; background-repeat:no-repeat; background-position:center center;}//--></style></head><body style="background-color: #000000; color: #CCCCCC;"> <pre> <?php while ($row = mssql_fetch_array($msresults)) { if (($row['SysObjectID'] == '1.3.6.1.4.1.674.10895.3003')||($row['SysObjectID'] == '1.3.6.1.4.1.674.10895.3000')||($row['SysObjectID'] == '1.3.6.1.4.1.674.10895.3007')||($row['SysObjectID'] == '1.3.6.1.4.1.674.10895.3006')) { $strIPAddress = $row['IP_Address']; $strUsername = "root"; $strPassword = $row['PWord']; $SysObjectID = $row['SysObjectID']; $telnet = new PHPTelnet(); $result = $telnet->Connect($strIPAddress,$strUsername,$strPassword); switch ($result) { case 0: $telnet->DoCommand('', $result); $a = str_replace("[K", "", $result); $b = str_replace("", "", $a); $prompt = $b; echo $prompt; $telnet->DoCommand('sh bridge address-table', $result); $working = explode("\n", $result); for ($z=0;$z<count($working);$z++) { if(substr_count($working[$z], "Quit")>=1) { alpha(&$telnet,&$tmp, &$ccount); } else { echo beta(&$working[$z], &$ccount); } } $telnet->Disconnect(); break; case 1: echo '[PHP Telnet] Connect failed: Unable to open network connection'; break; case 2: echo '[PHP Telnet] Connect failed: Unknown host'; break; case 3: echo '[PHP Telnet] Connect failed: Login failed'; break; case 4: echo '[PHP Telnet] Connect failed: Your PHP version does not support PHP Telnet'; break; } } else { echo "<br /><span style='color: blue; font-weight: bold;'>N0 +3ln3t 4 y0u!</span>"; } } if($ccount != 0) { if($ccount == 1) { echo "<br />There is <span style='color: #ff3333;;'>" . $ccount . "</span> Netgear device on this segment."; } else { echo "<br />There are <span style='color: #ff3333;;'>" . $ccount . "</span> Netgear devices on this segment."; } } ?> </pre></body></html>
<?php $myServer = "127.0.0.1"; $myUser = "Database_UserName"; $myPass = "Password"; $myDB = "NetPerfMon"; $myTable = "nodes"; if (isset($_GET['NID'])) { $NID = $_GET['NID']; } else { $NID = 0; } $s = @mssql_connect($myServer, $myUser, $myPass) or die("Couldn't connect to SQL Server on $myServer "); $msdb=mssql_select_db($myDB,$s); $msquery = "select NodeID, IP_Address, Community, Caption, SysObjectID, PWord from $myTable WHERE NodeID =" . $NID; $msresults = mssql_query($msquery);?>
<?php/*PHPTelnet 1.0by Antone Roundyadapted from code found on the PHP websitepublic domain*/class PHPTelnet { var $use_usleep=0; // change to 1 for faster execution // don't change to 1 on Windows servers unless you have PHP 5 var $sleeptime=125000; var $loginsleeptime=2000000; var $fp=NULL; var $loginprompt; /* 0 = success 1 = couldn't open network connection 2 = unknown host 3 = login failed 4 = PHP version too low */ function Connect($server,$user,$pass) { $rv=0; $vers=explode('.',PHP_VERSION); $needvers=array(4,3,0); $j=count($vers); $k=count($needvers); if ($k<$j) $j=$k; for ($i=0;$i<$j;$i++) { if (($vers[$i]+0)>$needvers[$i]) break; if (($vers[$i]+0)<$needvers[$i]) return 4; } $this->Disconnect(); if (strlen($server)) { if (preg_match('/[^0-9.]/',$server)) { $ip=gethostbyname($server); if ($ip==$server) { $ip=''; $rv=2; } } else $ip=$server; } else $ip='127.0.0.1'; if (strlen($ip)) { if ($this->fp=fsockopen($ip,23,&$errno, &$errstr, 60)) { fputs($this->fp,chr(0xFF).chr(0xFB).chr(0x1F).chr(0xFF).chr(0xFB). chr(0x20).chr(0xFF).chr(0xFB).chr(0x18).chr(0xFF).chr(0xFB). chr(0x27).chr(0xFF).chr(0xFD).chr(0x01).chr(0xFF).chr(0xFB). chr(0x03).chr(0xFF).chr(0xFD).chr(0x03).chr(0xFF).chr(0xFC). chr(0x23).chr(0xFF).chr(0xFC).chr(0x24).chr(0xFF).chr(0xFA). chr(0x1F).chr(0x00).chr(0x50).chr(0x00).chr(0x18).chr(0xFF). chr(0xF0).chr(0xFF).chr(0xFA).chr(0x20).chr(0x00).chr(0x33). chr(0x38).chr(0x34).chr(0x30).chr(0x30).chr(0x2C).chr(0x33). chr(0x38).chr(0x34).chr(0x30).chr(0x30).chr(0xFF).chr(0xF0). chr(0xFF).chr(0xFA).chr(0x27).chr(0x00).chr(0xFF).chr(0xF0). chr(0xFF).chr(0xFA).chr(0x18).chr(0x00).chr(0x58).chr(0x54). chr(0x45).chr(0x52).chr(0x4D).chr(0xFF).chr(0xF0)); if ($this->use_usleep) usleep($this->sleeptime); else sleep(1); fputs($this->fp,chr(0xFF).chr(0xFC).chr(0x01).chr(0xFF).chr(0xFC). chr(0x22).chr(0xFF).chr(0xFE).chr(0x05).chr(0xFF).chr(0xFC).chr(0x21)); if ($this->use_usleep) usleep($this->sleeptime); else sleep(1); $this->GetResponse($r); $r=explode("\n",$r); $this->loginprompt=$r[count($r)-1]; fputs($this->fp,"$user\r"); if ($this->use_usleep) usleep($this->sleeptime); else sleep(1); fputs($this->fp,"$pass\r"); if ($this->use_usleep) usleep($this->loginsleeptime); else sleep(1); $this->GetResponse($r); $r=explode("\n",$r); if (($r[count($r)-1]=='')||($this->loginprompt==$r[count($r)-1])) { $rv=3; $this->Disconnect(); } } else $rv=1; } return $rv; } function Disconnect($exit=1) { if ($this->fp) { if ($exit) $this->DoCommand('exit',$junk); fclose($this->fp); $this->fp=NULL; } } function DoCommand($c,&$r) { if ($this->fp) { fputs($this->fp,"$c\r"); if ($this->use_usleep) usleep($this->sleeptime); else sleep(1); $this->GetResponse($r); $r=preg_replace("/^.*?\n(.*)\n[^\n]*$/","$1",$r); } return $this->fp?1:0; } function GetResponse(&$r) { $r=''; do { $r.=fread($this->fp,2000); $s=socket_get_status($this->fp); } while ($s['unread_bytes']); }}?>
<script language="javascript" type="text/javascript"><!--if(document.images){ pics = new Array(); pics[1] = new Image(24,24); pics[1].src = "">asm2/.../saveu.jpg"; pics[2] = new Image(24,24); pics[2].src = "">asm2/.../saved.jpg"; pics[3] = new Image(24,24); pics[3].src = "">asm2/.../savec.jpg"; pics[4] = new Image(24,24); pics[4].src = "">asm2/.../dellu.jpg"; pics[5] = new Image(24,24); pics[5].src = "">asm2/.../delld.jpg"; pics[6] = new Image(24,24); pics[6].src = "">asm2/.../dellc.jpg"; pics[7] = new Image(24,24); pics[7].src = "">asm2/.../portu.jpg"; pics[8] = new Image(24,24); pics[8].src = "">asm2/.../porto.jpg"; pics[9] = new Image(24,24); pics[9].src = "">asm2/.../portd.jpg";}function swapIt(from,to){ if(document.images) { document.images[from].src = pics[to].src; }}//--></SCRIPT><table border="0" cellpadding="2" cellspacing="2"> <tr> <td align="center"> <a href="">asm2/.../save.php alt="Save Me!" title="Save Me!" target="_blank"><img src="">asm2/.../saveu.jpg" border="0" width="24" height="24" id="img1" name="img1" onMouseOver="swapIt('img1',2);" onMouseOut="swapIt('img1',1);" onMouseDown="swapIt('img1',3);" onMouseUp="swapIt('img1',2);"/></a> </td> <td> <span style="font-size: 9pt;">Save Running Config to Startup Config</span> </td> </tr> <tr> <td align="center"> <a href="">asm2/.../bridge.php target="_blank"><img src="">asm2/.../dellu.jpg" id="img2" name="img2" border="0" width="24" height="24" onMouseOver="swapIt('img2',5);" onMouseOut="swapIt('img2',4);" onMouseDown="swapIt('img2',6);" onMouseUp="swapIt('img2',5);"></a> </td> <td> <span style="font-size: 9pt;">Show Bridge Address-Table</span> </td> </tr> <tr> <td align="center"> <a href="">asm2/.../port2.php target="_blank"><img src="">asm2/.../portu.jpg" id="img3" name="img3" border="0" width="24" height="24" onMouseOver="swapIt('img3',8);" onMouseOut="swapIt('img3',7);" onMouseDown="swapIt('img3',9);" onMouseUp="swapIt('img3',7);"></a> </td> <td> <span style="font-size: 9pt;">Port Management (Dell Switches Only)</span> </td> </tr></table>
THE DUPLEX STATUS IS AVAILABLE IN THE REAL-TIME INTERFACE MONITOR. DOES ANYONE KNOW IF IT IS AVAILABLE UNDER NPM SO THAT ALERTS CAN BE SET ON THEM?