ShellCollParam.java
4.42 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
package com.sitech.ismp.coll.busi;
import com.sitech.base.AgentProperties;
import com.sitech.ismp.coll.busi.util.SystemUtil;
import com.sitech.util.RandomGUID;
import java.util.HashMap;
/**
* Created with IntelliJ IDEA.
* User: Administrator
* Date: 14-3-11
* Time: 上午10:50
* To change this template use File | Settings | File Templates.
*/
public class ShellCollParam {
public String noticeDir;
private String guid;
private String schId;
/**
* 采集周期
*/
private String interval;
/**
* 下次执行时间
*/
private String nextFireTime;
private String shellName;
private String ipAddr;
private String kbpClass;
private String shellContent;
private String execUser;
/**
* 为JSON字符串,例:[{varName:'KPI1',kpiId:'PM-01-01-001-01'},{varName:'KPI2',kpiId:'PM-01-01-001-02'}]
*/
private String kpis;
private String shellParams;
private String shellMacros;
/**
* 保存采集源信息
* 格式:<AGENT_ID>##<SCHEDULE_ID>##<DST_UNIT_ID>
*/
private String extInfo;
//
public ShellCollParam(HashMap<String, String> params) {
this.guid = RandomGUID.getRandomGUID();
this.schId = params.get("SCHEDULE_ID");
this.interval = params.get("COLL_INTERVAL");
this.nextFireTime = params.get("NEXT_FIRE_TIME");
this.shellName = params.get("SHELLNAME");
this.ipAddr = params.get("LOGINIP");
this.kbpClass = params.get("KBPCLASS");
this.kpis = params.get("KPIS");
this.shellParams = params.get("PARAMS");
this.shellMacros = params.get("MACROS");
this.shellContent = params.get("CONTENT");
this.extInfo = AgentProperties.AGENT_ID + "##" +
params.get("SCHEDULE_ID") + "##" + params.get("DSTUNITID");
this.execUser = params.get("EXEC_USER");
if (null == this.execUser || "".equals(this.execUser.trim())) {
this.execUser = System.getProperty("user.name");
}
// 使用指定用户执行脚本
// this.noticeDir = AgentProperties.AGENT_HOME + "/notice/" + execUser + "/";
this.noticeDir = AgentProperties.AGENT_HOME + "/notice/bnms/";
}
public String getAbsShellName() {
return SystemUtil.SHELL_SCRIPT_PATH + this.shellName;
}
public String getNoticeDir() {
return noticeDir;
}
public void setNoticeDir(String noticeDir) {
this.noticeDir = noticeDir;
}
public String getGuid() {
return guid;
}
public void setGuid(String guid) {
this.guid = guid;
}
public String getSchId() {
return schId;
}
public void setSchId(String schId) {
this.schId = schId;
}
public String getInterval() {
return interval;
}
public void setInterval(String interval) {
this.interval = interval;
}
public String getNextFireTime() {
return nextFireTime;
}
public void setNextFireTime(String nextFireTime) {
this.nextFireTime = nextFireTime;
}
public String getShellName() {
return shellName;
}
public void setShellName(String shellName) {
this.shellName = shellName;
}
public String getIpAddr() {
return ipAddr;
}
public void setIpAddr(String ipAddr) {
this.ipAddr = ipAddr;
}
public String getKbpClass() {
return kbpClass;
}
public void setKbpClass(String kbpClass) {
this.kbpClass = kbpClass;
}
public String getShellContent() {
return shellContent;
}
public void setShellContent(String shellContent) {
this.shellContent = shellContent;
}
public String getExecUser() {
return execUser;
}
public void setExecUser(String execUser) {
this.execUser = execUser;
}
public String getKpis() {
return kpis;
}
public void setKpis(String kpis) {
this.kpis = kpis;
}
public String getShellParams() {
return shellParams;
}
public void setShellParams(String shellParams) {
this.shellParams = shellParams;
}
public String getShellMacros() {
return shellMacros;
}
public void setShellMacros(String shellMacros) {
this.shellMacros = shellMacros;
}
public String getExtInfo() {
return extInfo;
}
public void setExtInfo(String extInfo) {
this.extInfo = extInfo;
}
}