CollFile.java
2.17 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
package com.sitech.ismp.coll.centercoll;
import com.sitech.ismp.coll.basic.TblATO_KPIDETAIL;
import java.util.HashMap;
import java.util.Scanner;
import java.util.Vector;
/**
* 主机文件采集
*/
public class CollFile implements CollFileMBean {
/**
* 采集全部指标
*/
public Vector<TblATO_KPIDETAIL> getAll(HashMap<String, String> params) {
Vector<TblATO_KPIDETAIL> result = new Vector<TblATO_KPIDETAIL>();
result.addAll(getFileChange(params));
return result;
}
/**
* 采集文件变更指标
*/
@Override
public Vector<TblATO_KPIDETAIL> getFileChange(HashMap<String, String> params) {
CollFileWithCMD cmd = new CollFileWithCMD();
return cmd.getFileChange(params);
}
/**
*采集大目录
* */
@Override
public Vector<TblATO_KPIDETAIL> getCatalog(HashMap<String, String> params) {
CollFileWithCMD cmd = new CollFileWithCMD();
return cmd.getCatalog(params);
}
private static String read(String prompt) {
Scanner scanner = new Scanner(System.in);
System.out.print(prompt);
return scanner.nextLine();
}
public static void main(String[] args) {
System.out
.println("***************file Center Collect Test Begin*********************");
HashMap<String, String> params = new HashMap<String, String>();
params.put("IP_ADDR", "172.21.0.203");
params.put("PASSWORD", "a1a50f36f1303ba3ed36f2b019e508f97628ee3c065f0984");
params.put("PROTOCOL", "ssh");
params.put("USERNAME", "ssdbomc");
params.put("FILE_PATHS", "/ssdbomc/csdppd_mysql/cs/web_env/apache-tomcat-6.0,/ssdbomc/test,1");
params.put("UNIT_ID", "10-10-24:172_21_0_203");
params.put("HOSTNAME", "172_21_0_203");
params.put("DEVICE_ID", "172_21_0_203");
params.put("KBP_CLASS", "10-10-24");
Vector<TblATO_KPIDETAIL> result = new Vector<TblATO_KPIDETAIL>();
CollFile collector = new CollFile();
result =collector.getFileChange(params);
System.out.println("***************file Center Collect Test End*********************");
for (int i = 0; i < result.size(); i++) {
TblATO_KPIDETAIL record = (TblATO_KPIDETAIL) result.get(i);
System.out.println(record.UNIT_ID + "\t" + record.KPI_ID + "\t"
+ record.KPI_VALUE);
}
}
}