stingh711 avatar stingh711 committed 4092bce

add mib for tools

Comments (0)

Files changed (4)
+#data for tools
+ping.result=PING ( 56 octets data\n64 octets from icmp_seq=0 ttl=64 time=4.5 ms\n64 octets from icmp_seq=1 ttl=64 time=0.3 ms\n64 octets from icmp_seq=2 ttl=64 time=0.3 ms\n--- ping statistics ---\n3 packets transmitted, 3 packets received, 0% packet loss\nround-trip min/avg/max = 0.3/1.7/4.5 ms
+tracert.result=1 (  0.496 ms  0.403 ms  0.370 ms\n2 (  1.422 ms  0.461 ms  0.944 ms\n3 (  1.983 ms  2.199 ms  1.941 ms
 #traps parameters


 import com.zyxel.enc.netbar.agent.generator.WanInterfaceTableGenerator;
 import java.text.SimpleDateFormat;
 import java.util.Date;
-import java.util.List;
 import org.snmp4j.agent.DuplicateRegistrationException;
 import org.snmp4j.agent.MOGroup;
     private static final OID oidLanInterfaceTable = new OID("");
     private static final OID oidSwitchInterfaceTable = new OID("");
     private static final OID oidTopArpTable = new OID("");
+    private static final String oidToolPingPrefix = "";
+    private static final String oidToolTracertPrefix = "";
     private static long startTime = 0;
         new SwitchDataHelper(server, context).registerQsInfoData();
         server.register(new SwitchInterfaceTableGenerator().generateTable(oidSwitchInterfaceTable), context);
+        registerPingResult(server, context);
+        registerTracerouteResult(server, context);
         DefaultMOTable appTable = new AppStatisticsTableGenerator("app.statistics.all.number", "", "app.statistics.all.traffic.").generateTable(nsAppStatisticsAll);
         server.register(appTable, context);
+    private void registerPingResult(MOServer server, OctetString context) throws DuplicateRegistrationException {
+    	String ip = Config.get("ping.ip");
+    	String result = Config.get("ping.result");
+    	OID oid = new OID(oidToolPingPrefix + ip);
+    	server.register(MOCreator.createReadOnly(oid, result), context);
+    }
+    private void registerTracerouteResult(MOServer server, OctetString context) throws DuplicateRegistrationException {
+    	String ip = Config.get("tracert.ip");
+    	String result = Config.get("tracert.result");
+    	OID oid = new OID(oidToolTracertPrefix + ip);
+    	server.register(MOCreator.createReadOnly(oid, result), context);
+    }


 package com.zyxel.enc.netbar.agent;
 import java.util.HashMap;
 import java.util.Map;
 import org.apache.log4j.Logger;
 import org.snmp4j.CommunityTarget;
 import org.snmp4j.PDU;
-import org.snmp4j.PDUv1;
 import org.snmp4j.Snmp;
 import org.snmp4j.TransportMapping;
 import org.snmp4j.smi.Address;
 import org.snmp4j.smi.GenericAddress;
 import org.snmp4j.smi.Integer32;
-import org.snmp4j.smi.IpAddress;
 import org.snmp4j.smi.OID;
 import org.snmp4j.smi.OctetString;
 import org.snmp4j.smi.TimeTicks;


 package com.zyxel.enc.netbar.agent.generator;
-import com.zyxel.enc.netbar.agent.AbstractTableGenerator;
-import com.zyxel.enc.netbar.agent.Config;
-import java.util.ArrayList;
-import java.util.List;
 import org.snmp4j.smi.Counter32;
 import org.snmp4j.smi.Integer32;
 import org.snmp4j.smi.OID;
 import org.snmp4j.smi.SMIConstants;
 import org.snmp4j.smi.Variable;
+import com.zyxel.enc.netbar.agent.AbstractTableGenerator;
+import com.zyxel.enc.netbar.agent.Config;
  * @author sting
 public class SwitchInterfaceTableGenerator extends AbstractTableGenerator {
-    private static final String PREFIX = "";
     public SwitchInterfaceTableGenerator() {
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.