Commits

stingh711 committed 0c19302

update current session

Comments (0)

Files changed (6)

             <fileset dir="${lib}"/>
         </copy>
         <copy file="${src}/start.bat" todir="${dist}/agent"/>
-		<copy file="config.properties" todir="${dist}/agent"/>
         <copy file="c.properties" todir="${dist}/agent"/>
         <jar jarfile="${dist}/agent/agent.jar" basedir="${build}"/>
 	</target>
-agent.ip=172.25.21.42
+agent.ip=172.25.21.16
 
 mac=00:a0:c5:00:00:11
 cpu.usage=90
 app.statistics.all.traffic.7=123452
 
 #data for current session
-session.number=5
+session.number=7
 session.application.1=1
 session.direction.1=1
 session.interface.1=wan1
 session.dst.port.1=80
 session.sent.1=3434
 session.recv.1=32434
-session.status.1=1
+session.status.1=0
+
 session.application.2=2
 session.direction.2=1
 session.interface.2=wan1
-session.protocol.2=2
+session.protocol.2=0
 session.src.ip.2=1.1.1.1
 session.src.port.2=34
 session.dst.ip.2=2.2.2.2
 session.dst.port.3=80
 session.sent.3=3434
 session.recv.3=32434
-session.status.3=1
-session.application.4=9805833
+session.status.3=2
+session.application.4=156237828
 session.direction.4=1
 session.interface.4=wan1
 session.protocol.4=0
 session.dst.port.4=80
 session.sent.4=3434
 session.recv.4=32434
-session.status.4=1
-session.application.5=9805834
+session.status.4=3
+session.application.5=157286412
 session.direction.5=1
 session.interface.5=wan1
-session.protocol.5=5
+session.protocol.5=255
 session.src.ip.5=1.1.1.1
 session.src.port.5=34
 session.dst.ip.5=2.2.2.2
 session.dst.port.5=80
 session.sent.5=3434
 session.recv.5=32434
-session.status.5=1
+session.status.5=4
+
+
+session.application.6=9805834
+session.direction.6=1
+session.interface.6=wan1
+session.protocol.6=5
+session.src.ip.6=1.1.1.1
+session.src.port.6=34
+session.dst.ip.6=2.2.2.2
+session.dst.port.6=80
+session.sent.6=3434
+session.recv.6=32434
+session.status.6=5
+session.application.7=9805834
+session.direction.7=1
+session.interface.7=wan1
+session.protocol.7=5
+session.src.ip.7=1.1.1.1
+session.src.port.7=34
+session.dst.ip.7=2.2.2.2
+session.dst.port.7=80
+session.sent.7=3434
+session.recv.7=32434
+session.status.7=6
 
 #Top arp sender table
 arp.sender.number=3

config.properties

-agent.ip=172.25.21.47/161
-
-hostname=NR Router
-mac=00:a0:c5:00:00:11
-type=NR Router
-model=NR-3000
-vender=zyxel
-firmware.version=1.10
-hardware.version=1.111
-serial=123456
-
-cpu.usage=60
-mem.usage=60
-session.active=1000
-session.max=10000
-cpu.temperature=80
-host.active=100
-
-topology.device.number=3
-topology.device.hostname.1=192.168.1.1
-topology.device.ip.1=192.168.1.1
-topology.device.mac.1=00:a0:c5:00:00:01
-topology.device.type.1=Switch
-topology.device.model.1=GS2200-24
-topology.device.vender.1=zyxel
-topology.device.firmware.1=3.40
-topology.device.hardware.1=2.1
-topology.device.portnumber.1=24
-topology.device.hostname.2=192.168.2.1
-topology.device.ip.2=192.168.2.1
-topology.device.mac.2=00:a0:c5:00:00:02
-topology.device.type.2=Switch
-topology.device.model.2=GS2200-48
-topology.device.vender.2=zyxel
-topology.device.firmware.2=3.90
-topology.device.hardware.2=2.1
-topology.device.portnumber.2=48
-topology.device.hostname.3=192.168.1.33
-topology.device.ip.3=192.168.1.33
-topology.device.mac.3=00:a0:c5:00:01:33
-topology.device.type.3=Host
-topology.device.model.3=
-topology.device.vender.3=dell
-topology.device.firmware.3=
-topology.device.hardware.3=
-topology.device.portnumber.3=0
-
-topology.link.number=1
-topology.link.src.ip.1=172.25.21.47
-topology.link.src.port.1=3
-topology.link.dst.ip.1=172.25.21.70
-topology.link.dst.port.1=1
-topology.link.type.1=2
-
-app.statistics.10mins.number=7
-app.statistics.10mins.name.1=qq
-app.statistics.10mins.traffic.1=1000
-app.statistics.10mins.name.2=msn
-app.statistics.10mins.traffic.2=200
-app.statistics.10mins.name.3=http
-app.statistics.10mins.traffic.3=10000
-app.statistics.10mins.name.4=skype
-app.statistics.10mins.traffic.4=10
-app.statistics.10mins.name.5=pplive
-app.statistics.10mins.traffic.5=245670
-app.statistics.10mins.name.6=gtalk
-app.statistics.10mins.traffic.6=123456
-app.statistics.10mins.name.7=bt
-app.statistics.10mins.traffic.7=123452
-
-app.statistics.3hours.number=7
-app.statistics.3hours.name.1=qq
-app.statistics.3hours.traffic.1=1000
-app.statistics.3hours.name.2=msn
-app.statistics.3hours.traffic.2=200
-app.statistics.3hours.name.3=http
-app.statistics.3hours.traffic.3=10000
-app.statistics.3hours.name.4=skype
-app.statistics.3hours.traffic.4=10
-app.statistics.3hours.name.5=pplive
-app.statistics.3hours.traffic.5=245670
-app.statistics.3hours.name.6=gtalk
-app.statistics.3hours.traffic.6=123456
-app.statistics.3hours.name.7=bt
-app.statistics.3hours.traffic.7=123452
-
-app.statistics.24hours.number=7
-app.statistics.24hours.name.1=qq
-app.statistics.24hours.traffic.1=1000
-app.statistics.24hours.name.2=msn
-app.statistics.24hours.traffic.2=200
-app.statistics.24hours.name.3=http
-app.statistics.24hours.traffic.3=10000
-app.statistics.24hours.name.4=skype
-app.statistics.24hours.traffic.4=10
-app.statistics.24hours.name.5=pplive
-app.statistics.24hours.traffic.5=245670
-app.statistics.24hours.name.6=gtalk
-app.statistics.24hours.traffic.6=123456
-app.statistics.24hours.name.7=bt
-app.statistics.24hours.traffic.7=123452
-
-app.statistics.all.number=7
-app.statistics.all.name.1=qq
-app.statistics.all.traffic.1=1000
-app.statistics.all.name.2=msn
-app.statistics.all.traffic.2=200
-app.statistics.all.name.3=http
-app.statistics.all.traffic.3=10000
-app.statistics.all.name.4=skype
-app.statistics.all.traffic.4=10
-app.statistics.all.name.5=pplive
-app.statistics.all.traffic.5=245670
-app.statistics.all.name.6=gtalk
-app.statistics.all.traffic.6=123456
-app.statistics.all.name.7=bt
-app.statistics.all.traffic.7=123452
-
-wan.interface.table.number=2
-wan.interface.table.name.1=wan1
-wan.interface.table.status.1=1
-wan.interface.table.type.1=1
-wan.interface.table.ipmask.1=255.255.255.0
-wan.interface.table.gateway.1=1.1.1.1
-wan.interface.table.dns.1=8.8.8.8
-wan.interface.table.recv.1=123456
-wan.interface.table.sent.1=331234
-wan.interface.table.name.2=wan2
-wan.interface.table.status.2=1
-wan.interface.table.type.2=1
-wan.interface.table.ipmask.2=255.255.255.0
-wan.interface.table.gateway.2=2.1.1.1
-wan.interface.table.dns.2=8.8.8.8
-wan.interface.table.recv.2=123456
-wan.interface.table.sent.2=3431234
-
-interface.table.number=8
-interface.table.index.1=1
-interface.table.name.1=wan1
-interface.table.description.1=wan1
-interface.table.type.1=2
-interface.table.iswan.1=1
-
-interface.table.index.2=2
-interface.table.name.2=wan2
-interface.table.description.2=wan2
-interface.table.type.2=2
-interface.table.iswan.2=1
-
-interface.table.index.3=3
-interface.table.name.3=wan3
-interface.table.description.3=wan3
-interface.table.type.3=2
-interface.table.iswan.3=1
-
-interface.table.index.3=3
-interface.table.name.3=wan3
-interface.table.description.3=wan3
-interface.table.type.3=2
-interface.table.iswan.3=1
-
-interface.table.index.4=4
-interface.table.name.4=wan4
-interface.table.description.4=wan4
-interface.table.type.4=2
-interface.table.iswan.4=1
-
-interface.table.index.5=5
-interface.table.name.5=lan1
-interface.table.description.5=lan1
-interface.table.type.5=2
-interface.table.iswan.5=2
-
-interface.table.index.6=6
-interface.table.name.6=lan2
-interface.table.description.6=lan2
-interface.table.type.6=2
-interface.table.iswan.6=2
-
-interface.table.index.7=7
-interface.table.name.7=lan3
-interface.table.description.7=lan3
-interface.table.type.7=2
-interface.table.iswan.7=2
-
-interface.table.index.8=8
-interface.table.name.8=lan4
-interface.table.description.8=lan4
-interface.table.type.8=2
-interface.table.iswan.8=2
-#data for current session
-session.number=5
-session.application.1=qq
-session.direction.1=1
-session.interface.1=wan1
-session.protocol.1=qq
-session.src.ip.1=1.1.1.1
-session.src.port.1=34
-session.dst.ip.1=2.2.2.2
-session.dst.port.1=80
-session.sent.1=3434
-session.recv.1=32434
-session.status.1=1
-session.application.2=qq
-session.direction.2=1
-session.interface.2=wan1
-session.protocol.2=qq
-session.src.ip.2=1.1.1.1
-session.src.port.2=34
-session.dst.ip.2=2.2.2.2
-session.dst.port.2=80
-session.sent.2=3434
-session.recv.2=32434
-session.status.2=1
-session.application.3=qq
-session.direction.3=1
-session.interface.3=wan1
-session.protocol.3=qq
-session.src.ip.3=1.1.1.1
-session.src.port.3=34
-session.dst.ip.3=2.2.2.2
-session.dst.port.3=80
-session.sent.3=3434
-session.recv.3=32434
-session.status.3=1
-session.application.4=qq
-session.direction.4=1
-session.interface.4=wan1
-session.protocol.4=qq
-session.src.ip.4=1.1.1.1
-session.src.port.4=34
-session.dst.ip.4=2.2.2.2
-session.dst.port.4=80
-session.sent.4=3434
-session.recv.4=32434
-session.status.4=1
-session.application.5=qq
-session.direction.5=1
-session.interface.5=wan1
-session.protocol.5=qq
-session.src.ip.5=1.1.1.1
-session.src.port.5=34
-session.dst.ip.5=2.2.2.2
-session.dst.port.5=80
-session.sent.5=3434
-session.recv.5=32434
-session.status.5=1
-
-#data for nsFlowEntry
-flow.number=3
-flow.interface.index.1=1
-flow.sent.1=4324
-flow.recv.1=432123
-flow.interface.index.2=2
-flow.sent.2=4324
-flow.recv.2=432123
-flow.interface.index.3=3
-flow.sent.3=4324
-flow.recv.3=432123
-#flow.interface.index.4=2
-#flow.sent.4=4324
-#flow.recv.4=432123
-
-#data for lan interfaces
-lan.interface.number=2
-lan.interface.index.1=1
-lan.interface.ip.1=192.168.1.1
-lan.interface.mask.1=255.255.255.0
-lan.interface.enable.nat.1=1
-lan.interface.recv.1=3431234
-lan.interface.sent.1=3451
-lan.interface.mac.1=00:a0:c5:11:12:34
-lan.interface.mtu.1=1000
-lan.interface.index.2=2
-lan.interface.ip.2=192.168.1.2
-lan.interface.mask.2=255.255.255.0
-lan.interface.enable.nat.2=1
-lan.interface.recv.2=3431234
-lan.interface.sent.2=3451
-lan.interface.mac.2=00:a0:c5:13:12:34
-lan.interface.mtu.2=1000
-
-#Top arp sender table
-arp.sender.number=3
-arp.sender.index.1=1
-arp.sender.ip.1=192.168.1.1
-arp.sender.index.2=2
-arp.sender.ip.2=192.168.1.2
-arp.sender.index.3=3
-arp.sender.ip.3=192.168.1.3
-
-switch.number=1
-#switch QS info data
-switch.ip.1=172.25.21.70
-switch.cpu.usage.1=10
-switch.mem.usage.1=30
-switch.broadcast.rate.1=10
-switch.voltage.1=15
-switch.cpu.temperature.1=70
-switch.ip.2=192.168.2.2
-switch.cpu.usage.2=10
-switch.mem.usage.2=30
-switch.broadcast.rate.2=10
-switch.voltage.2=15
-switch.cpu.temperature.2=70
-
-#switch interface table data
-switch.1.ip=172.25.21.70
-switch.1.interface.table.number=2
-switch.1.interface.table.index.1=1
-switch.1.interface.table.desc.1=port1
-switch.1.interface.table.status.1=1
-switch.1.interface.table.speed.1=2
-switch.1.interface.table.mac.1=00:13:49:11:11:11
-switch.1.interface.table.in.1=9859485
-switch.1.interface.table.out.1=934
-switch.1.interface.table.index.2=2
-switch.1.interface.table.desc.2=port2
-switch.1.interface.table.status.2=1
-switch.1.interface.table.speed.2=2
-switch.1.interface.table.mac.2=00:13:49:11:11:12
-switch.1.interface.table.in.2=9859485
-switch.1.interface.table.out.2=934
-switch.2.ip=192.168.2.2
-switch.2.interface.table.number=2
-switch.2.interface.table.index.1=1
-switch.2.interface.table.desc.1=port1
-switch.2.interface.table.status.1=1
-switch.2.interface.table.speed.1=2
-switch.2.interface.table.mac.1=00:13:49:11:11:11
-switch.2.interface.table.in.1=9859485
-switch.2.interface.table.out.1=934
-switch.2.interface.table.index.2=2
-switch.2.interface.table.desc.2=port2
-switch.2.interface.table.status.2=1
-switch.2.interface.table.speed.2=2
-switch.2.interface.table.mac.2=00:13:49:11:11:12
-switch.2.interface.table.in.2=9859485
-switch.2.interface.table.out.2=934
-
-#data for tools
-ping.ip=192.168.1.1
-ping.result=PING 172.25.21.254 (172.25.21.254): 56 octets data\n64 octets from 172.25.21.254: icmp_seq=0 ttl=64 time=4.5 ms\n64 octets from 172.25.21.254: icmp_seq=1 ttl=64 time=0.3 ms\n64 octets from 172.25.21.254: icmp_seq=2 ttl=64 time=0.3 ms\n--- 172.25.21.254 ping statistics ---\n3 packets transmitted, 3 packets received, 0% packet loss\nround-trip min/avg/max = 0.3/1.7/4.5 ms
-tracert.ip=192.168.1.1
-tracert.result=1  172.25.21.254 (172.25.21.254)  0.496 ms  0.403 ms  0.370 ms\n2  172.25.6.251 (172.25.6.251)  1.422 ms  0.461 ms  0.944 ms\n3  172.25.6.253 (172.25.6.253)  1.983 ms  2.199 ms  1.941 ms
-
-#traps parameters
-server.ip=172.25.21.47
-nsTrapVarAdmin=sting
-nsTrapVarPort=10
-nsTrapVarBandwidth=134234
-nsTrapVarHostname=172.25.21.1
-nsTrapVarMac=00:a0:c5:11:11:11
-nsTrapVarPacketRate=123343
-nsTrapVarAttackCount=1000
-nsTrapVarAttackRate=212/s
-nsTrapVarAttackTime=3333
-

src/com/zyxel/enc/netbar/agent/NRrouterMib.java

     }
 
     public static TimeTicks getStartTime() {
-        long ticks = (System.currentTimeMillis() - startTime) / 100;
+        long ticks = (System.currentTimeMillis() - startTime) / 10;
         TimeTicks v = new TimeTicks(ticks & 0xFFFFFFFFL);
         return v;
     }

src/com/zyxel/enc/netbar/agent/TrapSender.java

     private static final OID nsTrapVarAttackRate = new OID("1.3.6.1.4.1.890.1.5.17.1.12.3.9");
     private static final OID nsTrapVarAttackTime = new OID("1.3.6.1.4.1.890.1.5.17.1.12.3.10");
     private static final OID nsTrapVarIp = new OID("1.3.6.1.4.1.890.1.5.17.1.12.3.11");
-    
+
     private static final OID nsTrapWanIpChange = new OID("1.3.6.1.4.1.890.1.5.17.1.12.2.28");
 
     private static final Map<OID, VariableAdder> variableAdders = new HashMap<OID, VariableAdder>();
         variableAdders.put(nsTrapWanIpChange, new VariableAdder() {
             @Override
             public void addVariableToPdu(PDU pdu) {
+                pdu.add(new VariableBinding(nsTrapVarMac, new OctetString(Config.get("mac"))));
                 pdu.add(new VariableBinding(nsTrapVarPort, new Integer32(1)));
                 pdu.add(new VariableBinding(nsTrapVarIp, new OctetString(Config.get("agent.ip"))));
             }
         }
         logger.info("All traps has been sent out");
     }
-    
+
     public void sendIpChangeTrap() {
         logger.info("Begin to send IP change trap");;
         logger.info("Agent IP is changed to " + Config.get("agent.ip"));

src/com/zyxel/enc/netbar/agent/generator/CurrentSessionTableGenerator.java

 import org.snmp4j.agent.mo.MOAccessImpl;
 import org.snmp4j.agent.mo.MOColumn;
 import org.snmp4j.agent.mo.MOMutableTableModel;import org.snmp4j.smi.Counter32;
+import org.snmp4j.smi.Counter64;
 import org.snmp4j.smi.Integer32;
 import org.snmp4j.smi.IpAddress;
 import org.snmp4j.smi.OID;
 
         for (int i = 1; i <= number; i++) {
             Variable[] v = new Variable[]{
-                new Integer32(Config.getInt("session.application." + i)),
+                new Counter64(Config.getInt("session.application." + i)),
                 new Integer32(Integer.valueOf(Config.get("session.direction." + i))),
                 new OctetString(Config.get("session.interface." + i)),
                 new Integer32(Config.getInt("session.protocol." + i)),