Authored by 王凤

合并分支 'master_zmm' 到 'master'

修改getping方法,添加isPing参数。

修改getping方法,添加isPing参数。

查看合并请求 !9
@@ -253,35 +253,36 @@ public class CollMySQLBySql { @@ -253,35 +253,36 @@ public class CollMySQLBySql {
253 * @return 253 * @return
254 */ 254 */
255 public Vector<TblATO_KPIDETAIL> getPingStatus(HashMap<String,String> params) { 255 public Vector<TblATO_KPIDETAIL> getPingStatus(HashMap<String,String> params) {
256 - String url = params.get("DB_URL");  
257 - String deviceId = params.get("DEVICE_ID");  
258 - log.info(" ***//////url="+url+"///////////// deviceId="+deviceId+"//////////////////");  
259 - int start=url.indexOf("/");  
260 - int end=url.lastIndexOf(":");  
261 - String ipAddr=url.substring(start+2,end);  
262 - log.info(" ***/////////////////// ipAddr="+ipAddr+"//////////////////");  
263 -  
264 - String kpiId="FM-00-10-001-999"; // mysql 主机连接状态  
265 -  
266 - CheckConnectionState server=new CheckConnectionState();  
267 - String unitId = KBP_CLASS + "-10" + ":" + deviceId + "-SYS";  
268 - ParamterBean bean=new ParamterBean();  
269 - bean.setType("mysql");  
270 - bean.setDEVICE_IP(ipAddr);  
271 - String stat=server.getPingState(bean);  
272 - log.info(" **** getPingStatus ****UNIT_ID ="+unitId+"****stat="+stat+"**");  
273 - TblATO_KPIDETAIL kpidetail=new TblATO_KPIDETAIL();  
274 - try {  
275 - kpidetail.setUNIT_ID(unitId);  
276 - kpidetail.setKPI_ID(kpiId);  
277 - kpidetail.setCLL_TIME(new Date());  
278 - kpidetail.setKPI_VALUE(stat);  
279 - } catch (ParseException e) {  
280 - log.error(" ****** kpidetail.setUNIT_ID(unitId) has error!");  
281 - e.printStackTrace();  
282 - } 256 + String isPing = params.get("isPing"); // frank 2017-05-19 添加。Y进行ping操作,N不执行
283 Vector<TblATO_KPIDETAIL> vector=new Vector<TblATO_KPIDETAIL>(); 257 Vector<TblATO_KPIDETAIL> vector=new Vector<TblATO_KPIDETAIL>();
284 - vector.add(kpidetail); 258 + if("Y".equals(isPing)){
  259 + String url = params.get("DB_URL");
  260 + String deviceId = params.get("DEVICE_ID");
  261 + log.info(" ***//////url="+url+"///////////// deviceId="+deviceId+"//////////////////");
  262 + int start=url.indexOf("/");
  263 + int end=url.lastIndexOf(":");
  264 + String ipAddr=url.substring(start+2,end);
  265 + log.info(" ***/////////////////// ipAddr="+ipAddr+"//////////////////");
  266 + String kpiId="FM-00-10-001-999"; // mysql 主机连接状态
  267 + CheckConnectionState server=new CheckConnectionState();
  268 + String unitId = KBP_CLASS + "-10" + ":" + deviceId + "-SYS";
  269 + ParamterBean bean=new ParamterBean();
  270 + bean.setType("mysql");
  271 + bean.setDEVICE_IP(ipAddr);
  272 + String stat=server.getPingState(bean);
  273 + log.info(" **** getPingStatus ****UNIT_ID ="+unitId+"****stat="+stat+"**");
  274 + TblATO_KPIDETAIL kpidetail=new TblATO_KPIDETAIL();
  275 + try {
  276 + kpidetail.setUNIT_ID(unitId);
  277 + kpidetail.setKPI_ID(kpiId);
  278 + kpidetail.setCLL_TIME(new Date());
  279 + kpidetail.setKPI_VALUE(stat);
  280 + } catch (ParseException e) {
  281 + log.error(" ****** kpidetail.setUNIT_ID(unitId) has error!");
  282 + e.printStackTrace();
  283 + }
  284 + vector.add(kpidetail);
  285 + }
285 return vector; 286 return vector;
286 } 287 }
287 288
@@ -332,17 +332,22 @@ public class CollOracleBySql { @@ -332,17 +332,22 @@ public class CollOracleBySql {
332 * @return 332 * @return
333 */ 333 */
334 public Vector getPingStatus(HashMap params)throws Exception { 334 public Vector getPingStatus(HashMap params)throws Exception {
335 - getParams(params);  
336 - CheckConnectionState server=new CheckConnectionState();  
337 - String KBP_ID = "10-11-30-10:" + this.NEATENSID + "-SYS";  
338 - SQLTarget collectiondbbase = new SQLTarget();  
339 - ParamterBean bean=new ParamterBean();  
340 - bean.setType("oracle");  
341 - bean.setDEVICE_IP(hostip);  
342 - String stat=server.getPingState(bean);  
343 - collectiondbbase.addKPI(KBP_ID, "FM-00-11-001-999", stat);  
344 - log.info(" ************************* getPingStatus ****UNIT_ID ="+KBP_ID+"****stat="+stat+"**");  
345 - return collectiondbbase.getKPISet(); 335 + String isPing = params.get("isPing")+""; // frank 2017-05-19 添加。Y进行ping操作,N不执行
  336 + Vector<TblATO_KPIDETAIL> vector=new Vector<TblATO_KPIDETAIL>();
  337 + if("Y".equals(isPing)){
  338 + getParams(params);
  339 + CheckConnectionState server=new CheckConnectionState();
  340 + String KBP_ID = "10-11-30-10:" + this.NEATENSID + "-SYS";
  341 + SQLTarget collectiondbbase = new SQLTarget();
  342 + ParamterBean bean=new ParamterBean();
  343 + bean.setType("oracle");
  344 + bean.setDEVICE_IP(hostip);
  345 + String stat=server.getPingState(bean);
  346 + collectiondbbase.addKPI(KBP_ID, "FM-00-11-001-999", stat);
  347 + log.info(" ************************* getPingStatus ****UNIT_ID ="+KBP_ID+"****stat="+stat+"**");
  348 + vector=collectiondbbase.getKPISet();
  349 + }
  350 + return vector;
346 } 351 }
347 352
348 353
@@ -108,36 +108,39 @@ public class CollLinuxHost implements CollLinuxHostMBean { @@ -108,36 +108,39 @@ public class CollLinuxHost implements CollLinuxHostMBean {
108 */ 108 */
109 public Vector getPing(HashMap params) { 109 public Vector getPing(HashMap params) {
110 Vector<TblATO_KPIDETAIL> v=new Vector<TblATO_KPIDETAIL>(); 110 Vector<TblATO_KPIDETAIL> v=new Vector<TblATO_KPIDETAIL>();
111 - String ip=params.get("IP_ADDR")+"";  
112 - if(!StringUtils.isEmpty(ip)){  
113 - String connectStatCode="FM-00-10-001-999"; // linux 主机连接状态  
114 - String hostName=params.get("HOSTNAME")+""; // 资源标识  
115 - String unitId = kbpClass+":" + hostName + "-total";  
116 - ParamterBean bean =new ParamterBean();  
117 - bean.setDEVICE_IP(ip);  
118 - bean.setType("linux");  
119 - log.info("*** execute linux getPing ** ip=["+ip+"]** unitId=["+unitId+"]*********");  
120 -  
121 - /**  
122 - * getPingState 方法执行后会将状态插入到表中,然后取当前时间  
123 - * 根基IP查询失败的次数,如果失败次数为3次,则确定为宕机,发送告警。  
124 - */  
125 - CheckConnectionState server=new CheckConnectionState();  
126 - server.getPingState(bean);  
127 -  
128 - // 根据IP获取ping的错误次数。如果是 DOWN 的话,发送告警信息。  
129 - String state=server.getPingErrorState(ip);  
130 - TblATO_KPIDETAIL kpidetail= new TblATO_KPIDETAIL();  
131 - log.info("***** unitId**"+unitId+"** state **"+state+"*******");  
132 - try {  
133 - kpidetail.setKPI_ID(connectStatCode);  
134 - kpidetail.setUNIT_ID(unitId);  
135 - kpidetail.setKPI_VALUE(state);  
136 - kpidetail.setCLL_TIME(new Date());  
137 - } catch (ParseException e) {  
138 - e.printStackTrace(); 111 + String isPing = params.get("isPing")+""; // frank 2017-05-19 添加。Y进行ping操作,N不执行
  112 + if("Y".equals(isPing)){
  113 + String ip=params.get("IP_ADDR")+"";
  114 + if(!StringUtils.isEmpty(ip)){
  115 + String connectStatCode="FM-00-10-001-999"; // linux 主机连接状态
  116 + String hostName=params.get("HOSTNAME")+""; // 资源标识
  117 + String unitId = kbpClass+":" + hostName + "-total";
  118 + ParamterBean bean =new ParamterBean();
  119 + bean.setDEVICE_IP(ip);
  120 + bean.setType("linux");
  121 + log.info("*** execute linux getPing ** ip=["+ip+"]** unitId=["+unitId+"]*********");
  122 +
  123 + /**
  124 + * getPingState 方法执行后会将状态插入到表中,然后取当前时间
  125 + * 根基IP查询失败的次数,如果失败次数为3次,则确定为宕机,发送告警。
  126 + */
  127 + CheckConnectionState server=new CheckConnectionState();
  128 + server.getPingState(bean);
  129 +
  130 + // 根据IP获取ping的错误次数。如果是 DOWN 的话,发送告警信息。
  131 + String state=server.getPingErrorState(ip);
  132 + TblATO_KPIDETAIL kpidetail= new TblATO_KPIDETAIL();
  133 + log.info("***** unitId**"+unitId+"** state **"+state+"*******");
  134 + try {
  135 + kpidetail.setKPI_ID(connectStatCode);
  136 + kpidetail.setUNIT_ID(unitId);
  137 + kpidetail.setKPI_VALUE(state);
  138 + kpidetail.setCLL_TIME(new Date());
  139 + } catch (ParseException e) {
  140 + e.printStackTrace();
  141 + }
  142 + v.add(kpidetail);
139 } 143 }
140 - v.add(kpidetail);  
141 } 144 }
142 return v; 145 return v;
143 146
@@ -153,42 +156,39 @@ public class CollLinuxHost implements CollLinuxHostMBean { @@ -153,42 +156,39 @@ public class CollLinuxHost implements CollLinuxHostMBean {
153 public Vector getSSH(HashMap params) { 156 public Vector getSSH(HashMap params) {
154 Vector<TblATO_KPIDETAIL> v=new Vector<TblATO_KPIDETAIL>(); 157 Vector<TblATO_KPIDETAIL> v=new Vector<TblATO_KPIDETAIL>();
155 String ip=params.get("IP_ADDR")+""; 158 String ip=params.get("IP_ADDR")+"";
156 - String result=server.getPingResultByIp(ip);  
157 - if(!StringUtils.isEmpty(result) && "UP".equals(result)){  
158 - String loginStatCode="FM-00-10-001-998"; // linux 主机登录状态  
159 - ParamterBean bean =new ParamterBean();  
160 - String tempPort=params.get("PROTOCOL_PORT")+"";  
161 - int port=0;  
162 - if(!StringUtils.isEmpty(tempPort)){  
163 - port=Integer.parseInt(tempPort);  
164 - }  
165 - String hostName=params.get("HOSTNAME")+"";  
166 - String username=params.get("USERNAME")+"";  
167 - String protocol=params.get("PROTOCOL")+"";  
168 - String password=params.get("PASSWORD")+"";  
169 - password=DES3.decrypt(password);  
170 -  
171 - String unitId = kbpClass+":" + hostName + "-total";  
172 - log.info("*** execute linux getPing ** ip=["+ip+"]** unitId=["+unitId+"]**port="+port+"***hostName="+hostName+"****");  
173 -  
174 - bean.setDEVICE_IP(ip);  
175 - bean.setPROTOCOL_PORT(port);  
176 - bean.setUSER_NAME(username);  
177 - bean.setPASSWORD(password);  
178 - bean.setPROTOCOL(protocol);  
179 - String state=server.getConnectionState4SshOrTelnet(bean);  
180 -  
181 - TblATO_KPIDETAIL kpidetail=new TblATO_KPIDETAIL();  
182 - try {  
183 - kpidetail.setKPI_ID(loginStatCode);  
184 - kpidetail.setUNIT_ID(unitId);  
185 - kpidetail.setKPI_VALUE(state);  
186 - kpidetail.setCLL_TIME(new Date());  
187 - } catch (ParseException e) {  
188 - e.printStackTrace();  
189 - }  
190 - v.add(kpidetail); 159 + String loginStatCode="FM-00-10-001-998"; // linux 主机登录状态
  160 + ParamterBean bean =new ParamterBean();
  161 + String tempPort=params.get("PROTOCOL_PORT")+"";
  162 + int port=0;
  163 + if(!StringUtils.isEmpty(tempPort)){
  164 + port=Integer.parseInt(tempPort);
  165 + }
  166 + String hostName=params.get("HOSTNAME")+"";
  167 + String username=params.get("USERNAME")+"";
  168 + String protocol=params.get("PROTOCOL")+"";
  169 + String password=params.get("PASSWORD")+"";
  170 + password=DES3.decrypt(password);
  171 +
  172 + String unitId = kbpClass+":" + hostName + "-total";
  173 + log.info("*** execute linux getPing ** ip=["+ip+"]** unitId=["+unitId+"]**port="+port+"***hostName="+hostName+"****");
  174 +
  175 + bean.setDEVICE_IP(ip);
  176 + bean.setPROTOCOL_PORT(port);
  177 + bean.setUSER_NAME(username);
  178 + bean.setPASSWORD(password);
  179 + bean.setPROTOCOL(protocol);
  180 + String state=server.getConnectionState4SshOrTelnet(bean);
  181 +
  182 + TblATO_KPIDETAIL kpidetail=new TblATO_KPIDETAIL();
  183 + try {
  184 + kpidetail.setKPI_ID(loginStatCode);
  185 + kpidetail.setUNIT_ID(unitId);
  186 + kpidetail.setKPI_VALUE(state);
  187 + kpidetail.setCLL_TIME(new Date());
  188 + } catch (ParseException e) {
  189 + e.printStackTrace();
191 } 190 }
  191 + v.add(kpidetail);
192 return v; 192 return v;
193 } 193 }
194 194
@@ -30,35 +30,38 @@ public class CollWindows implements CollWindowsMBean { @@ -30,35 +30,38 @@ public class CollWindows implements CollWindowsMBean {
30 */ 30 */
31 public Vector<TblATO_KPIDETAIL> getPingState(HashMap<String, String> params){ 31 public Vector<TblATO_KPIDETAIL> getPingState(HashMap<String, String> params){
32 Vector<TblATO_KPIDETAIL> v=new Vector<TblATO_KPIDETAIL>(); 32 Vector<TblATO_KPIDETAIL> v=new Vector<TblATO_KPIDETAIL>();
33 - String ip=params.get("IP");  
34 - if(!StringUtils.isEmpty(ip)){  
35 - String kpiId="FM-00-10-001-999"; // Windows 主机连接状态  
36 - String hostName=params.get("HOST_NAME");  
37 - String unitId = kbpClass+":" + hostName + "-total";  
38 - ParamterBean bean =new ParamterBean();  
39 - bean.setDEVICE_IP(ip);  
40 - bean.setType("windows");  
41 - log.info("*** execute getPingState ** ip=["+ip+"]** unitId=["+unitId+"]*********");  
42 - /**  
43 - * getPingState 方法执行后会将状态插入到表中,然后取当前时间  
44 - * 根基IP查询失败的次数,如果失败次数为3次,则确定为宕机,发送告警。  
45 - */  
46 - CheckConnectionState server=new CheckConnectionState();  
47 - server.getPingState(bean);  
48 -  
49 - // 根据IP获取ping的错误次数。如果是 DOWN 的话,发送告警信息。  
50 - String state=server.getPingErrorState(ip);  
51 - TblATO_KPIDETAIL kpidetail= new TblATO_KPIDETAIL();  
52 - log.info("***** unitId**"+unitId+"** state **"+state+"*******");  
53 - try {  
54 - kpidetail.setKPI_ID(kpiId);  
55 - kpidetail.setUNIT_ID(unitId);  
56 - kpidetail.setKPI_VALUE(state);  
57 - kpidetail.setCLL_TIME(new Date());  
58 - } catch (ParseException e) {  
59 - e.printStackTrace(); 33 + String isPing = params.get("isPing")+""; // frank 2017-05-19 添加。Y进行ping操作,N不执行
  34 + if("Y".equals(isPing)){
  35 + String ip=params.get("IP");
  36 + if(!StringUtils.isEmpty(ip)){
  37 + String kpiId="FM-00-10-001-999"; // Windows 主机连接状态
  38 + String hostName=params.get("HOST_NAME");
  39 + String unitId = kbpClass+":" + hostName + "-total";
  40 + ParamterBean bean =new ParamterBean();
  41 + bean.setDEVICE_IP(ip);
  42 + bean.setType("windows");
  43 + log.info("*** execute getPingState ** ip=["+ip+"]** unitId=["+unitId+"]*********");
  44 + /**
  45 + * getPingState 方法执行后会将状态插入到表中,然后取当前时间
  46 + * 根基IP查询失败的次数,如果失败次数为3次,则确定为宕机,发送告警。
  47 + */
  48 + CheckConnectionState server=new CheckConnectionState();
  49 + server.getPingState(bean);
  50 +
  51 + // 根据IP获取ping的错误次数。如果是 DOWN 的话,发送告警信息。
  52 + String state=server.getPingErrorState(ip);
  53 + TblATO_KPIDETAIL kpidetail= new TblATO_KPIDETAIL();
  54 + log.info("***** unitId**"+unitId+"** state **"+state+"*******");
  55 + try {
  56 + kpidetail.setKPI_ID(kpiId);
  57 + kpidetail.setUNIT_ID(unitId);
  58 + kpidetail.setKPI_VALUE(state);
  59 + kpidetail.setCLL_TIME(new Date());
  60 + } catch (ParseException e) {
  61 + e.printStackTrace();
  62 + }
  63 + v.add(kpidetail);
60 } 64 }
61 - v.add(kpidetail);  
62 } 65 }
63 return v; 66 return v;
64 } 67 }
@@ -74,32 +77,28 @@ public class CollWindows implements CollWindowsMBean { @@ -74,32 +77,28 @@ public class CollWindows implements CollWindowsMBean {
74 Vector<TblATO_KPIDETAIL> v=new Vector<TblATO_KPIDETAIL>(); 77 Vector<TblATO_KPIDETAIL> v=new Vector<TblATO_KPIDETAIL>();
75 String ip=params.get("IP"); 78 String ip=params.get("IP");
76 if(!StringUtils.isEmpty(ip)){ 79 if(!StringUtils.isEmpty(ip)){
77 - String result=server.getPingResultByIp(ip);  
78 - log.info("@@@@@###### getSnmpState ping result="+ result +"###$$$$$$$$$$%%%%%%%%%%");  
79 - if(!StringUtils.isEmpty(result) && "UP".equals(result)){  
80 - String kpiId="FM-00-10-001-998"; // Windows 设备登录状态  
81 - ParamterBean bean =new ParamterBean();  
82 - String tempPort=params.get("PORT");  
83 - String community=params.get("COMMUNITY");  
84 - int port=Integer.parseInt(tempPort);  
85 - String hostName=params.get("HOST_NAME");  
86 - log.info("******ip "+ip+"**port "+tempPort+"****hostName "+hostName+"*****");  
87 - bean.setDEVICE_IP(ip);  
88 - bean.setPROTOCOL_PORT(port);  
89 - bean.setCOMMUNITY(community);  
90 - String state=server.getConnectionState4Snmp(bean);  
91 - String unitId = kbpClass+":" + hostName + "-total";  
92 - TblATO_KPIDETAIL kpidetail=new TblATO_KPIDETAIL();  
93 - try {  
94 - kpidetail.setKPI_ID(kpiId);  
95 - kpidetail.setUNIT_ID(unitId);  
96 - kpidetail.setKPI_VALUE(state);  
97 - kpidetail.setCLL_TIME(new Date());  
98 - } catch (ParseException e) {  
99 - e.printStackTrace();  
100 - }  
101 - v.add(kpidetail); 80 + String kpiId="FM-00-10-001-998"; // Windows 设备登录状态
  81 + ParamterBean bean =new ParamterBean();
  82 + String tempPort=params.get("PORT");
  83 + String community=params.get("COMMUNITY");
  84 + int port=Integer.parseInt(tempPort);
  85 + String hostName=params.get("HOST_NAME");
  86 + log.info("******ip "+ip+"**port "+tempPort+"****hostName "+hostName+"*****");
  87 + bean.setDEVICE_IP(ip);
  88 + bean.setPROTOCOL_PORT(port);
  89 + bean.setCOMMUNITY(community);
  90 + String state=server.getConnectionState4Snmp(bean);
  91 + String unitId = kbpClass+":" + hostName + "-total";
  92 + TblATO_KPIDETAIL kpidetail=new TblATO_KPIDETAIL();
  93 + try {
  94 + kpidetail.setKPI_ID(kpiId);
  95 + kpidetail.setUNIT_ID(unitId);
  96 + kpidetail.setKPI_VALUE(state);
  97 + kpidetail.setCLL_TIME(new Date());
  98 + } catch (ParseException e) {
  99 + e.printStackTrace();
102 } 100 }
  101 + v.add(kpidetail);
103 } 102 }
104 return v; 103 return v;
105 } 104 }
@@ -70,31 +70,31 @@ public class CollTomcat implements CollTomcatMBean { @@ -70,31 +70,31 @@ public class CollTomcat implements CollTomcatMBean {
70 */ 70 */
71 @Override 71 @Override
72 public Vector<TblATO_KPIDETAIL> getPingStatus(HashMap<String, String> params) { 72 public Vector<TblATO_KPIDETAIL> getPingStatus(HashMap<String, String> params) {
73 - /**  
74 - * 该 kbp_class kpiId 如果不存在,需要在页面添加。  
75 - */  
76 - String kbp_class="10-12-13-20";  
77 - String kpiId="FM-00-12-001-999"; 73 + String isPing = params.get("isPing")+""; // frank 2017-05-19 添加。Y进行ping操作,N不执行
78 Vector<TblATO_KPIDETAIL> vector=new Vector<TblATO_KPIDETAIL>(); 74 Vector<TblATO_KPIDETAIL> vector=new Vector<TblATO_KPIDETAIL>();
79 - String jmx_url=params.get("JMX_URL");  
80 - int start=jmx_url.indexOf("/rmi://");  
81 - int end=jmx_url.lastIndexOf(":");  
82 - String ip=jmx_url.substring(start+7,end);  
83 - /**  
84 - * domain_name 实际就是 资源标识。  
85 - */  
86 - String domain_name = params.get("DOMAIN_NAME");  
87 - String unitId = kbp_class +":"+ Formater.neatenunitid(domain_name) + "-RUNTIME";  
88 - CheckConnectionState server=new CheckConnectionState();  
89 - TblATO_KPIDETAIL kpidetail=new TblATO_KPIDETAIL();  
90 - try {  
91 - kpidetail.setUNIT_ID(unitId);  
92 - kpidetail.setKPI_ID(kpiId);  
93 - kpidetail.setKPI_VALUE(server.getPingState(new ParamterBean(ip)));  
94 - kpidetail.setCLL_TIME(new Date());  
95 - vector.add(kpidetail);  
96 - } catch (ParseException e){  
97 - e.printStackTrace(); 75 + if("Y".equals(isPing)){
  76 + String kbp_class="10-12-13-20";
  77 + String kpiId="FM-00-12-001-999";
  78 + String jmx_url=params.get("JMX_URL");
  79 + int start=jmx_url.indexOf("/rmi://");
  80 + int end=jmx_url.lastIndexOf(":");
  81 + String ip=jmx_url.substring(start+7,end);
  82 + /**
  83 + * domain_name 实际就是 资源标识。
  84 + */
  85 + String domain_name = params.get("DOMAIN_NAME");
  86 + String unitId = kbp_class +":"+ Formater.neatenunitid(domain_name) + "-RUNTIME";
  87 + CheckConnectionState server=new CheckConnectionState();
  88 + TblATO_KPIDETAIL kpidetail=new TblATO_KPIDETAIL();
  89 + try {
  90 + kpidetail.setUNIT_ID(unitId);
  91 + kpidetail.setKPI_ID(kpiId);
  92 + kpidetail.setKPI_VALUE(server.getPingState(new ParamterBean(ip)));
  93 + kpidetail.setCLL_TIME(new Date());
  94 + vector.add(kpidetail);
  95 + } catch (ParseException e){
  96 + e.printStackTrace();
  97 + }
98 } 98 }
99 return vector; 99 return vector;
100 } 100 }
@@ -136,29 +136,25 @@ public class CollWebLogic implements CollWebLogicMBean{ @@ -136,29 +136,25 @@ public class CollWebLogic implements CollWebLogicMBean{
136 136
137 @Override 137 @Override
138 public Vector<TblATO_KPIDETAIL> getPingStatus(HashMap<String, String> params) { 138 public Vector<TblATO_KPIDETAIL> getPingStatus(HashMap<String, String> params) {
139 - /**  
140 - * 该 kbp_class kpiId 如果不存在,需要在页面添加。  
141 - */  
142 - String kbp_class="10-12-11-20";  
143 - String kpiId="FM-00-12-001-999"; 139 + String isPing = params.get("isPing"); // frank 2017-05-19 添加。Y进行ping操作,N不执行
144 Vector<TblATO_KPIDETAIL> vector=new Vector<TblATO_KPIDETAIL>(); 140 Vector<TblATO_KPIDETAIL> vector=new Vector<TblATO_KPIDETAIL>();
145 - String serverip=params.get("SERVERIP");  
146 -  
147 - /**  
148 - * SERVERNAME 实际就是 资源标识。  
149 - */  
150 - String servername = params.get("SERVERNAME");  
151 - String unitId = kbp_class +":"+ Formater.neatenunitid(servername) + "-CONFIG";  
152 - CheckConnectionState server=new CheckConnectionState();  
153 - TblATO_KPIDETAIL kpidetail=new TblATO_KPIDETAIL();  
154 - try {  
155 - kpidetail.setUNIT_ID(unitId);  
156 - kpidetail.setKPI_ID(kpiId);  
157 - kpidetail.setKPI_VALUE(server.getPingState(new ParamterBean(serverip)));  
158 - kpidetail.setCLL_TIME(new Date());  
159 - vector.add(kpidetail);  
160 - } catch (ParseException e){  
161 - e.printStackTrace(); 141 + if("Y".equals(isPing)){
  142 + String kbp_class="10-12-11-20";
  143 + String kpiId="FM-00-12-001-999";
  144 + String serverip=params.get("SERVERIP");
  145 + String servername = params.get("SERVERNAME");
  146 + String unitId = kbp_class +":"+ Formater.neatenunitid(servername) + "-CONFIG";
  147 + CheckConnectionState server=new CheckConnectionState();
  148 + TblATO_KPIDETAIL kpidetail=new TblATO_KPIDETAIL();
  149 + try {
  150 + kpidetail.setUNIT_ID(unitId);
  151 + kpidetail.setKPI_ID(kpiId);
  152 + kpidetail.setKPI_VALUE(server.getPingState(new ParamterBean(serverip)));
  153 + kpidetail.setCLL_TIME(new Date());
  154 + vector.add(kpidetail);
  155 + } catch (ParseException e){
  156 + e.printStackTrace();
  157 + }
162 } 158 }
163 return vector; 159 return vector;
164 } 160 }