Browse Source

show system info by snmp for devices

rajven 4 years ago
parent
commit
7b32f6751d
2 changed files with 12 additions and 2 deletions
  1. 10 2
      html/admin/devices/snmpwalk.php
  2. 2 0
      html/inc/common.php

+ 10 - 2
html/admin/devices/snmpwalk.php

@@ -15,9 +15,17 @@ require_once ($_SERVER['DOCUMENT_ROOT']."/inc/idfilter.php");
 <?php
 <?php
 $dev_info = get_record($db_link,'devices','id='.$id);
 $dev_info = get_record($db_link,'devices','id='.$id);
 $interfaces = get_snmp_interfaces($dev_info['ip'], $dev_info['community'], $dev_info['snmp_version']);
 $interfaces = get_snmp_interfaces($dev_info['ip'], $dev_info['community'], $dev_info['snmp_version']);
-print "<table class=\"data\" cellspacing=\"1\" cellpadding=\"4\">\n";
+global $sysinfo_mib;
+$dev_info = walk_snmp($dev_info['ip'], $dev_info['community'], $dev_info['snmp_version'],$sysinfo_mib);
+foreach ($dev_info as $key => $value) {
+list ($v_type,$v_data)=explode(':',$value);
+$v_clean = preg_replace('/\s/', '', $v_data);
+if (empty($v_clean)) { continue; }
+print "$v_data<br>";
+}
+print "<table  class=\"data\" cellspacing=\"1\" cellpadding=\"4\">\n";
 print "<tr><td><b>Snmp interfaces</b></td></tr>\n";
 print "<tr><td><b>Snmp interfaces</b></td></tr>\n";
-foreach ($interfaces as $key => $int) { print "<tr><td>$key => $int</td></tr>"; }
+foreach ($interfaces as $key => $int) { print "<tr><td class=\"data\">$key => $int</td></tr>"; }
 print "</table>\n";
 print "</table>\n";
 ?>
 ?>
 </div>
 </div>

+ 2 - 0
html/inc/common.php

@@ -61,6 +61,8 @@ $mikrotik_poe_current = '.1.3.6.1.4.1.14988.1.1.15.1.1.5';
 // power usage in dW (deviwatt)
 // power usage in dW (deviwatt)
 $mikrotik_poe_usage = '.1.3.6.1.4.1.14988.1.1.15.1.1.6';
 $mikrotik_poe_usage = '.1.3.6.1.4.1.14988.1.1.15.1.1.6';
 
 
+$sysinfo_mib = '.1.3.6.1.2.1.1';
+
 $L_ERROR = 0;
 $L_ERROR = 0;
 $L_WARNING = 1;
 $L_WARNING = 1;
 $L_INFO = 2;
 $L_INFO = 2;