CollFGTFireWall.java
2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package com.sitech.ismp.coll;
import java.util.HashMap;
import java.util.Vector;
import com.sitech.ismp.coll.basic.TblATO_KPIDETAIL;
import com.sitech.util.DES3;
public class CollFGTFireWall implements CollFGTFireWallMBean {
public Vector getPort(HashMap params) {
String IP;
int PORT;
String COMMUNITY;
String HOST_NAME;
IP = (String) params.get("IP");
PORT = Integer.parseInt((String) params.get("PORT"));
COMMUNITY = DES3.decrypt((String) params.get("COMMUNITY"));
HOST_NAME = (String) params.get("HOST_NAME");
CollFGTFireWallWithSNMP brocade = new CollFGTFireWallWithSNMP(IP, PORT,
COMMUNITY, HOST_NAME);
return brocade.getPortKpi();
}
public Vector getSys(HashMap params) {
String IP;
int PORT;
String COMMUNITY;
String HOST_NAME;
IP = (String) params.get("IP");
PORT = Integer.parseInt((String) params.get("PORT"));
COMMUNITY = DES3.decrypt((String) params.get("COMMUNITY"));
HOST_NAME = (String) params.get("HOST_NAME");
CollFGTFireWallWithSNMP brocade = new CollFGTFireWallWithSNMP(IP, PORT,
COMMUNITY, HOST_NAME);
Vector kpiVector = new Vector();
kpiVector.add(brocade.getDeviceState());
kpiVector.add(brocade.getPortNum());
kpiVector.add(brocade.getSoftVersion());
kpiVector.add(brocade.getHostName());
kpiVector.add(brocade.getIpAddr());
kpiVector.addAll(brocade.getConfig());
kpiVector.addAll(brocade.getCpuTemperatrue());
kpiVector.addAll(brocade.getSupply());
return kpiVector;
}
public static void main(String[] args){
if (args.length < 4) {
System.out
.println("please input params <IpAddress> <Port> <Community> <HostName>");
System.exit(0);
}
String ip = args[0];
String port = args[1];
String communit = args[2];
String hostName = args[3];
CollFGTFireWall coll = new CollFGTFireWall();
HashMap params = new HashMap();
params.put("IP", ip);
params.put("PORT", port);
params.put("HOST_NAME", hostName);
communit = DES3.encrypt(communit);
params.put("COMMUNITY", communit);
Vector ifVector = coll.getPort(params);
System.out.println("interface info");
for (int i = 0; i < ifVector.size(); i++) {
TblATO_KPIDETAIL kpidetail = (TblATO_KPIDETAIL) ifVector.get(i);
System.out.println(kpidetail.UNIT_ID + " | " + kpidetail.KPI_ID
+ " | " + kpidetail.KPI_VALUE + " | " + kpidetail.CLL_TIME);
}
Vector sysVector = coll.getSys(params);
System.out.println("sys info");
for (int i = 0; i < sysVector.size(); i++) {
TblATO_KPIDETAIL kpidetail = (TblATO_KPIDETAIL) sysVector.get(i);
System.out.println(kpidetail.UNIT_ID + " | " + kpidetail.KPI_ID
+ " | " + kpidetail.KPI_VALUE + " | " + kpidetail.CLL_TIME);
}
}
}