snmpwalk.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/auth.php");
  3. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/languages/" . HTML_LANG . ".php");
  4. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/idfilter.php");
  5. ?>
  6. <html>
  7. <head>
  8. <title>Панель администратора</title>
  9. <link rel="stylesheet" type="text/css" href="/<?php echo HTML_STYLE.".css"; ?>">
  10. <meta http-equiv="content-type" content="application/xhtml+xml">
  11. <meta charset="UTF-8">
  12. </head>
  13. <body>
  14. <div id="cont">
  15. <?php
  16. $dev_info = get_record($db_link,'devices','id='.$id);
  17. $interfaces = get_snmp_interfaces($dev_info['ip'], $dev_info['community'], $dev_info['snmp_version']);
  18. $dev_info = walk_snmp($dev_info['ip'], $dev_info['community'], $dev_info['snmp_version'],SYSINFO_MIB);
  19. foreach ($dev_info as $key => $value) {
  20. list ($v_type,$v_data)=explode(':',$value);
  21. $v_clean = preg_replace('/\s/', '', $v_data);
  22. if (empty($v_clean)) { continue; }
  23. print "$v_data<br>";
  24. }
  25. print "<table class=\"data\" cellspacing=\"1\" cellpadding=\"4\">\n";
  26. print "<tr><td><b>Interface index</b></td><td><b>Interface name</b></td></tr>\n";
  27. foreach ($interfaces as $key => $int) {
  28. list ($v_type,$v_data)=explode(':',$int);
  29. print "<tr><td class=\"data\">$key</td><td class=\"data\"> $v_data</td></tr>";
  30. }
  31. print "</table>\n";
  32. ?>
  33. </div>
  34. </body>
  35. </html>