snmpwalk.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/auth.php");
  3. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/languages/" . $language . ".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 "\"/$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. global $sysinfo_mib;
  19. $dev_info = walk_snmp($dev_info['ip'], $dev_info['community'], $dev_info['snmp_version'],$sysinfo_mib);
  20. foreach ($dev_info as $key => $value) {
  21. list ($v_type,$v_data)=explode(':',$value);
  22. $v_clean = preg_replace('/\s/', '', $v_data);
  23. if (empty($v_clean)) { continue; }
  24. print "$v_data<br>";
  25. }
  26. print "<table class=\"data\" cellspacing=\"1\" cellpadding=\"4\">\n";
  27. print "<tr><td><b>Interface index</b></td><td><b>Interface name</b></td></tr>\n";
  28. foreach ($interfaces as $key => $int) {
  29. list ($v_type,$v_data)=explode(':',$int);
  30. print "<tr><td class=\"data\">$key</td><td class=\"data\"> $v_data</td></tr>";
  31. }
  32. print "</table>\n";
  33. ?>
  34. </div>
  35. </body>
  36. </html>