CollWeblogic10WithSNMP.java 21.6 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 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592
package com.sitech.ismp.coll.middleware.weblogic.impl;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Vector;

import com.sitech.util.Formater;
import org.apache.log4j.Logger;

import com.adventnet.snmp.beans.SnmpTarget;
import com.adventnet.snmp.snmp2.SnmpOID;
import com.sitech.ismp.coll.CollBase;
import com.sitech.ismp.coll.basic.TblATO_KPIDETAIL;

public class CollWeblogic10WithSNMP implements ICollWebLogic {

	static Logger logger = Logger.getLogger("LOGER");

	SnmpTarget target = null;
	private boolean DEBUG = false;
	private String servicename = "";

	/**
	 * 服务器运行状态
	 *
	 */
	/*private void collRunState() {
		String unitID = "10-12-11-11-10:"; // update by 2006-9-12 in
		// 10-12-11-11-13
		String hostName = "";
		String domainName = "";
		boolean bool = true;
		String logPath = "";
		String serverName = "";
		try {
			Vector vc_Domain = walkKPIInfo(".1.3.6.1.4.1.140.625.360.1.45",
					false); // domain name
			String[] domain = ((String) vc_Domain.elementAt(0)).split("/");
			domainName = domain[domain.length - 2]; // get Domain

			Vector vc_hostName = walkKPIInfo(".1.3.6.1.4.1.140.625.360.1.70",
					false); // host name
			hostName = (String) vc_hostName.elementAt(0);
			unitID = unitID + this.ip + "-" + this.servicename + "-RunState";
			// hostName + "-" + domainName + "-" + "RunState";

			Vector stateRun = walkKPIInfo(".1.3.6.1.4.1.140.625.360.1.60", bool);// logPath
			// and
			// logFileName

			String state = (String) stateRun.elementAt(0);
			if (state != null && state.length() > 0
					&& state.toUpperCase().equals("RUNNING")) {
				state = "UP";
			} else {
				state = "DOWN";
			}
			if (stateRun.size() > 0) {
				setResult(state, unitID, "FM-00-04-001-01");
			}

		} catch (Exception e) {
			logger.error(e);
		}
	}*/

	public Vector<TblATO_KPIDETAIL> getStatus(HashMap<String, String> params) {
		return null;
	}

	/**
	 * @author pc103
	 * @date 2006-07-21
	 * @param oid
	 * @param bool
	 * @return vector 参数说明书: oid-----对应weblogic控制台监控的性能指标id(关键) bool----无多大用处
	 *         功能:储存各采集结果 返回类型:vector
	 *
	 */
	public Vector<String> walkKPIInfo(String oid, boolean bool) {
		Vector<String> tmp_result = new Vector<String>();
		try {
			Vector<String> tmp_oid = new Vector<String>();
			target.setObjectID(oid);
			target.oidList[0] = new SnmpOID(oid);
			int maxtry = 0;
			SnmpOID[] oidList = target.getSnmpOIDList();
			if (oidList == null) {
				System.out.println("oidList is null");
				return null;
			} else {
				SnmpOID rootoid = oidList[0];
				SnmpOID curroid = null;
				while (maxtry++ < 3000) {
					String result1[] = target.snmpGetNextList();
					if (result1 == null) {
						target.oidList[0] = curroid;
						continue;
					}
					if (!SnmpTarget.isInSubTree(rootoid, target.getSnmpOID()))
						break;
					for (int i = 0; i < result1.length; i++) {
						tmp_result.add(result1[i]);
						tmp_oid.add(target.getObjectID(i));
					}
					if (result1[0].compareTo("NULL") == 0)
						break;
				}
				if (maxtry == 1) {
					System.err
							.println("Request failed, timed out or no available data("
									+ oid + "). \n " + target.getErrorString());
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return tmp_result;
	}

	/**
	 * @exception
	 * @express 建立与weblogic8.0的初始连接,特别注意port指的是weblogic的snmp的port,并非weblogic所开服务监听的port
	 */
	private void init(HashMap<String, String> params) {
		try {
			String serverip = (String) params.get("SERVERIP");
			int port = Integer.parseInt((String) params.get("PORT"));
			String snmp_version = (String) params.get("SNMPV");
			String community = (String) params.get("COMMUNITY");
			servicename = (String) params.get("SERVERNAME");

			target = new SnmpTarget();
			// target.setLoadFromCompiledMibs(true);
			target.setDebug(DEBUG);
			if (snmp_version.equals("1")) {
				target.setSnmpVersion(SnmpTarget.VERSION1);
			} else if (snmp_version.equals("2")) {
				target.setSnmpVersion(SnmpTarget.VERSION2C);
			} else if (snmp_version.equals("3")) {
				target.setSnmpVersion(SnmpTarget.VERSION3);
			}
			target.setTargetHost(serverip); // set the agent hostname
			target.setCommunity(community.trim());
			/**
			 * 关于weblogic多服务器情况下,如何采集不同的server的值的方法,主要就是设置COMMUNITY的值
			 * 在这个我以admin server with clustered servers的情况来说明
			 * domain name = mydomain2,administrtation server = myserver, managed server = server1
			 * 1.如果取myserver的相关的OID的值,COMMUNITY = "public"
			 * 2.如果取server1的相关的OID的值,COMMUNITY = "public@server1"
			 * 3.如果取整个domain的所有server的相关的OID的值,COMMUNITY = "public@mydomain2"
			 */
			target.setTargetPort(port);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * 释放initWeblogic(String weblogicip,String servername,int port, String hostname,String community)申请的资源
	 */
	public void release() {
		target.releaseResources();
	}

	@Override
	public Vector<TblATO_KPIDETAIL> getExecuteQueue(HashMap<String, String> params) {
		logger.info("Begin getExecteuQueue...");
		init(params);
		// 消息队列
		String unitId = "10-12-11-15:" + this.servicename + "-";
		CollBase collResult = new CollBase();
		try {
			Vector<String> vc_Execute_Queue = walkKPIInfo(".1.3.6.1.4.1.140.625.180", false);
			int index = getVectorIndexs(vc_Execute_Queue, "Type=ExecuteQueueRuntime");
			for (int i = 0; i < index; i++) {
				String execqueuename = vc_Execute_Queue.get(3 * index + i);
				String executethreadcurrentidlecount = vc_Execute_Queue.get(5 * index + i);
				String servicedrequesttotalcount = vc_Execute_Queue.get(8 * index + i);
				String pendingrequestcurrentcount = vc_Execute_Queue.get(6 * index + i);
				if(pendingrequestcurrentcount.startsWith("0x")){
					Long peco = Long.valueOf(pendingrequestcurrentcount.substring(2, pendingrequestcurrentcount.length() - 1), 16);
					pendingrequestcurrentcount = peco.toString();
				}
				if(pendingrequestcurrentcount.startsWith("0x")){
					Long peco = Long.valueOf(pendingrequestcurrentcount.substring(2, pendingrequestcurrentcount.length() - 1), 16);
					pendingrequestcurrentcount = peco.toString();
				}
				String _unitId = unitId + execqueuename;
				collResult.addKPI(_unitId, "CM-00-04-009-17", execqueuename);
				collResult.addKPI(_unitId, "PM-00-05-009-27", executethreadcurrentidlecount);
				collResult.addKPI(_unitId, "PM-00-05-009-28", servicedrequesttotalcount);
				collResult.addKPI(_unitId, "PM-00-05-009-29", pendingrequestcurrentcount);
			}
		} catch (Exception e) {
			logger.error(e);
		} finally {
			release();
		}
		return collResult.KPISet;
	}

	@Override
	public Vector<TblATO_KPIDETAIL> getJDBC(HashMap<String, String> params) {
		logger.info("Begin getJDBC...");
		CollBase collResult = new CollBase();
		collResult.addKPISet(getjdbcConnectionPoolMaxCapacity(params));
		return collResult.KPISet;
	}

	/**
	 * JDBC连接池的最大容量: 1.3.6.1.4.1.140.625.190.1.15
	 * CM-00-04-003-04 配置的数据库连接池大小
	 * @return
	 */
	private Vector<TblATO_KPIDETAIL> getjdbcConnectionPoolMaxCapacity(HashMap<String, String> params) {
		logger.info("Begin getjdbcConnectionPoolMaxCapacity...");
		init(params);
		// JDBC连接池
		String unitId = "10-12-11-13:" + this.servicename + "-";
		CollBase collResult = new CollBase();

		try {
			Vector<String> vc_Jdbc_Pool = walkKPIInfo(".1.3.6.1.4.1.140.625.190", false);
			int index = getVectorIndexs(vc_Jdbc_Pool, "Type=JDBCConnectionPoolRuntime");
			for (int i = 0; i < index; i++) {
				String jdbcPoolName = vc_Jdbc_Pool.get(3 * index + i);
				String jdbcPoolMaxCapacity = vc_Jdbc_Pool.get(12 * index + i);
				String jdbcPoolActiveCount = vc_Jdbc_Pool.get(5 * index + i);
				String jdbcPoolUsedRate = "";
				if("0".equals(jdbcPoolActiveCount)){
					jdbcPoolUsedRate = "0";
				}else {
					jdbcPoolUsedRate = Formater.formatDecimalByScale(String.valueOf(Float.parseFloat(jdbcPoolActiveCount) / Float.parseFloat(jdbcPoolMaxCapacity)), 2);;
				}

				String _unitId = unitId + jdbcPoolName;
				collResult.addKPI(_unitId, "CM-00-04-001-17", jdbcPoolName);
				collResult.addKPI(_unitId, "CM-00-04-003-04", jdbcPoolMaxCapacity);
				collResult.addKPI(_unitId, "PM-00-04-003-03", jdbcPoolActiveCount);
				collResult.addKPI(_unitId, "PM-00-04-003-02", jdbcPoolUsedRate);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			release();
		}
		return collResult.KPISet;
	}


	@Override
	public Vector<TblATO_KPIDETAIL> getJMS(HashMap<String, String> params) {
		logger.info("Begin getJMS...");
		init(params);
		// JMS消息队列
		String unitId = "10-12-11-16:" + this.servicename + "-";
		CollBase collResult = new CollBase();
		try {
			Vector<String> vc_Domain = walkKPIInfo(".1.3.6.1.4.1.140.625.360.1.95", false); // domain name
			String dir = (String) vc_Domain.elementAt(0);
			String[] domain = null;
			if(dir.indexOf("/") != -1){
				domain = dir.split("/");
			}else{
				domain = dir.split("\\\\");
			}
			String domainName = domain[domain.length - 2]; // get Domain
			unitId += domainName + "-";
			Vector<String> vc_Jms = walkKPIInfo(".1.3.6.1.4.1.140.625.660.1", false); // JMS name
			int index = getVectorIndexs(vc_Jms, "Type=JMSServer");
			for (int i = 0; i < index; i++) {
				String jmsname = vc_Jms.get(3 * index + i);
				String maximummessagesize = vc_Jms.get(19 * index + i);
				String blockingsendpolicy = vc_Jms.get(22 * index + i);
				String _unitId = unitId + jmsname;
				collResult.addKPI(_unitId, "CM-00-05-009-22", jmsname);
				collResult.addKPI(_unitId, "CM-00-05-009-33", maximummessagesize);
				collResult.addKPI(_unitId, "CM-00-05-009-32", blockingsendpolicy);
			}
		} catch (Exception e) {
			logger.error("JMS exception",e);
		} finally {
			release();
		}
		return collResult.KPISet;
	}

	@Override
	public Vector<TblATO_KPIDETAIL> getJVM(HashMap<String, String> params) {
		logger.info("Begin getJVM...");
		CollBase collResult = new CollBase();
		collResult.addKPISet(getJVMMEM(params));
		return collResult.KPISet;
	}

	/**
	 * 当前JVM中的堆内存值: .1.3.6.1.4.1.140.625.340.1.30
	 */
	private Vector<TblATO_KPIDETAIL> getJVMMEM(HashMap<String, String> params) {
		logger.info("Begin getJVMMEM...");
		init(params);
		// JVM内存堆
		String unitId = "10-12-11-12:" + this.servicename + "-";
		CollBase collResult = new CollBase();
		try {
			Vector<String> vc_Domain = walkKPIInfo(".1.3.6.1.4.1.140.625.360.1.95", false); // domain name
			String dir = (String) vc_Domain.elementAt(0);
			String[] domain = null;
			if(dir.indexOf("/") != -1){
				domain = dir.split("/");
			}else{
				domain = dir.split("\\\\");
			}
			String domainName = domain[domain.length - 2]; // get Domain
			unitId += domainName + "-HeapSize";
			Vector<String> vm_jvm = walkKPIInfo(".1.3.6.1.4.1.140.625.340", false);
			int index = getVectorIndexs(vm_jvm, "Type=JVMRuntime");
			for (int i = 0; i < index; i++) {
				String sizeCurrent = vm_jvm.get(6 * index + i);
				String freeCurrent = vm_jvm.get(5 * index + i);
				String usedCurrent = String.valueOf(Integer.parseInt(sizeCurrent) - Integer.parseInt(freeCurrent));
				String usedRate = Formater.formatDecimalByScale(String.valueOf(Float.parseFloat(usedCurrent) / Float.parseFloat(sizeCurrent)), 2);
				String freeRate = Formater.formatDecimalByScale(String.valueOf(Float.parseFloat(freeCurrent) / Float.parseFloat(sizeCurrent)), 2);
				collResult.addKPI(unitId, "PM-00-05-009-03", sizeCurrent);
				collResult.addKPI(unitId, "PM-00-05-009-02", freeCurrent);
				collResult.addKPI(unitId, "PM-00-05-009-22", usedCurrent);
				collResult.addKPI(unitId, "PM-00-04-003-01", String.valueOf(usedRate));
				collResult.addKPI(unitId, "PM-00-05-009-04", String.valueOf(freeRate));
			}
		} catch (Exception e) {
			logger.error(e);
		} finally {
			release();
		}
		return collResult.KPISet;
	}


	@Override
	public Vector<TblATO_KPIDETAIL> getServers(HashMap<String, String> params) {
		logger.info("Begin getServers...");
		init(params);
		// SERVER
		String unitId = "10-12-11-10:" + this.servicename + "-";
		CollBase collResult = new CollBase();
		try {
			// server name
			Vector<String> vc_Servers = walkKPIInfo(".1.3.6.1.4.1.140.625.730", false);
			int index = getVectorIndexs(vc_Servers, "Type=Server");
			logger.info("..." + vc_Servers.size() + "..." + index + "...");
			for (int i = 0; i < index; i++) {
				String servername = vc_Servers.get(3 * index + i);
				String listenport = vc_Servers.get(18 * index + i);
				String servercluster = vc_Servers.get(20 * index + i);
				String listenAddress = vc_Servers.get(32 * index + i);
				String _unitId = unitId + servername + "-server";
				collResult.addKPI(_unitId, "CM-00-04-001-10", servername);
				collResult.addKPI(_unitId, "CM-00-04-009-05", listenAddress);
				collResult.addKPI(_unitId, "CM-00-04-009-06", listenport);
				collResult.addKPI(_unitId, "CM-00-05-009-16", servercluster);
			}
		} catch (Exception e) {
			logger.error(e);
		} finally {
			release();
		}
		return collResult.KPISet;
	}

	@Override
	public Vector<TblATO_KPIDETAIL> getCluster(HashMap<String, String> params) {
		logger.info("Begin getCluser...");
		init(params);
		// 集群
		String unitId = "10-12-11-14:" + this.servicename + "-";
		CollBase collResult = new CollBase();
		try {
			Vector<String> vc_Domain = walkKPIInfo(".1.3.6.1.4.1.140.625.360.1.95", false); // domain name
			String dir = (String) vc_Domain.elementAt(0);
			String[] domain = null;
			if(dir.indexOf("/") != -1){
				domain = dir.split("/");
			}else{
				domain = dir.split("\\\\");
			}

			String domainName = domain[domain.length - 2]; // get Domain
			unitId += domainName + "-";
			Vector<String> vc_Cluster = walkKPIInfo(".1.3.6.1.4.1.140.625.510", false);
			int index = getVectorIndexs(vc_Cluster, "Type=Cluster");
			for (int i = 0; i < index; i++) {
				String clustername = vc_Cluster.get(3 * index + i);
				String serversip = vc_Cluster.get(6 * index + i);
				String serversconf = vc_Cluster.get(5 * index + i);
				String multicastaddress = vc_Cluster.get(7 * index + i);
				String loadalgorithm = vc_Cluster.get(10 * index + i);
				String multicastport = vc_Cluster.get(13 * index + i);
				String _unitId = unitId + clustername;
				collResult.addKPI(_unitId, "CM-00-05-009-16", clustername);
				collResult.addKPI(_unitId, "CM-00-05-009-17", serversip);
				collResult.addKPI(_unitId, "CM-00-05-009-30", serversconf);
				collResult.addKPI(_unitId, "CM-00-05-009-19", multicastaddress);
				collResult.addKPI(_unitId, "CM-00-05-009-31", loadalgorithm);
				collResult.addKPI(_unitId, "CM-00-05-009-18", multicastport);
			}
		} catch (Exception e) {
			logger.error(e);
		} finally {
			release();
		}
		return collResult.KPISet;
	}

	@Override
	public Vector<TblATO_KPIDETAIL> getWebApps(HashMap<String, String> params) {
		logger.info("Begin getWebApps...");
		init(params);
		// WEBAPPS
		String unitId = "10-12-11-11:" + this.servicename + "-";
		CollBase collResult = new CollBase();
		try {
			Vector<String> vc_Domain = walkKPIInfo(".1.3.6.1.4.1.140.625.360.1.95", false); // domain name
			String dir = (String) vc_Domain.elementAt(0);
			String[] domain = null;
			if(dir.indexOf("/") != -1){
				domain = dir.split("/");
			}else{
				domain = dir.split("\\\\");
			}
			String domainName = domain[domain.length - 2]; // get Domain
			unitId += domainName + "-";
			Vector<String> vc_Webapps = walkKPIInfo(".1.3.6.1.4.1.140.625.430", false);
			int index = getVectorIndexs(vc_Webapps, "Type=WebAppComponentRuntime");
			for (int i = 0; i < index; i++) {
				String webappsname = vc_Webapps.get(3 * index + i);
				String contextroot = vc_Webapps.get(27 * index + i);
				String sourceinfo = vc_Webapps.get(7 * index + i);
				String status = vc_Webapps.get(6 * index + i);
				String opensessionscurrentcount = vc_Webapps.get(10 * index + i);
				String sessionsopenedtotalcount = vc_Webapps.get(12 * index + i);
				String opensessionshighcount = vc_Webapps.get(11 * index + i);
				String _unitId = unitId + webappsname;
				collResult.addKPI(_unitId, "CM-00-05-009-01", webappsname);
				collResult.addKPI(_unitId, "CM-00-05-009-06", contextroot);
				collResult.addKPI(_unitId, "CM-00-05-009-07", sourceinfo);
				collResult.addKPI(_unitId, "CM-00-05-009-08", status);
				collResult.addKPI(_unitId, "PM-00-05-009-40", opensessionscurrentcount);
				collResult.addKPI(_unitId, "PM-00-05-009-41", sessionsopenedtotalcount);
				collResult.addKPI(_unitId, "PM-00-05-009-42", opensessionshighcount);
			}
		} catch (Exception e) {
			logger.error(e);
		} finally {
			release();
		}
		return collResult.KPISet;
	}

	@Override
	public Vector<TblATO_KPIDETAIL> getChannel(HashMap<String, String> params) {
		logger.info("Begin getCannel...");
		init(params);
		// 协议队列
		String unitId = "10-12-11-18:" + this.servicename + "-";
		CollBase collResult = new CollBase();
		try {
			Vector<String> vc_Domain = walkKPIInfo(".1.3.6.1.4.1.140.625.360.1.95", false); // domain name
			String dir = (String) vc_Domain.elementAt(0);
			String[] domain = null;
			if(dir.indexOf("/") != -1){
				domain = dir.split("/");
			}else{
				domain = dir.split("\\\\");
			}
			String domainName = domain[domain.length - 2]; // get Domain
			unitId += domainName + "-";
			Vector<String> vc_Channel = walkKPIInfo(".1.3.6.1.4.1.140.625.366", false);
			int index = getVectorIndexs(vc_Channel, "Type=ServerChannelRuntime");
			for (int i = 0; i < index; i++) {
				String channelname = vc_Channel.get(3 * index + i);
				String acceptcount = vc_Channel.get(9 * index + i);
				String bytesreceivedcount = vc_Channel.get(5 * index + i);
				String bytessentcount = vc_Channel.get(6 * index + i);
				String connectionscount = vc_Channel.get(8 * index + i);
				String messagesreceivedcount = vc_Channel.get(10 * index + i);
				String messagessentcount = vc_Channel.get(11 * index + i);
				String _unitId = unitId + channelname;
				collResult.addKPI(_unitId, "CM-00-05-009-27", channelname);
				collResult.addKPI(_unitId, "PM-00-05-009-34", acceptcount);
				collResult.addKPI(_unitId, "PM-00-05-009-35", bytesreceivedcount);
				collResult.addKPI(_unitId, "PM-00-05-009-36", bytessentcount);
				collResult.addKPI(_unitId, "PM-00-05-009-37", connectionscount);
				collResult.addKPI(_unitId, "PM-00-05-009-38", messagesreceivedcount);
				collResult.addKPI(_unitId, "PM-00-05-009-39", messagessentcount);
			}
		} catch (Exception e) {
			logger.error(e);
		} finally {
			release();
		}
		return collResult.KPISet;
	}

	@Override
	public Vector<TblATO_KPIDETAIL> getThreads(HashMap<String, String> params) {
		logger.info("Begin getThreads...");
		init(params);
		// 线程池
		String unitId = "10-12-11-17:" + this.servicename + "-";
		CollBase collResult = new CollBase();
		try {
			Vector<String> vc_Domain = walkKPIInfo(".1.3.6.1.4.1.140.625.360.1.95", false); // domain name
			String dir = (String) vc_Domain.elementAt(0);
			String[] domain = null;
			if(dir.indexOf("/") != -1){
				domain = dir.split("/");
			}else{
				domain = dir.split("\\\\");
			}
			String domainName = domain[domain.length - 2]; // get Domain
			unitId += domainName + "-";
			Vector<String> vc_Thread_Pool = walkKPIInfo(".1.3.6.1.4.1.140.625.367", false);
			int index = getVectorIndexs(vc_Thread_Pool, "Type=ThreadPoolRuntime");
			for (int i = 0; i < index; i++) {
				String tpname = vc_Thread_Pool.get(3 * index + i);
				String compreqcount = vc_Thread_Pool.get(10 * index + i);
				String execthreadidle = vc_Thread_Pool.get(6 * index + i);
				String execthreadtotal = vc_Thread_Pool.get(5 * index + i);
				String penduserreqcount = vc_Thread_Pool.get(8 * index + i);
				String standbythreadcount = vc_Thread_Pool.get(12 * index + i);
				String throughput = vc_Thread_Pool.get(13 * index + i);
				String queuelength = vc_Thread_Pool.get(7 * index + i);
				String hogthreadcount = vc_Thread_Pool.get(11 * index + i);
				String _unitId = unitId + tpname;
				collResult.addKPI(_unitId, "CM-00-05-009-25", tpname);
				collResult.addKPI(_unitId, "PM-00-05-009-26", compreqcount);
				collResult.addKPI(_unitId, "PM-00-05-009-27", execthreadidle);
				collResult.addKPI(_unitId, "PM-00-05-009-28", execthreadtotal);
				collResult.addKPI(_unitId, "PM-00-05-009-29", penduserreqcount);
				collResult.addKPI(_unitId, "PM-00-05-009-30", standbythreadcount);
				collResult.addKPI(_unitId, "PM-00-05-009-31", throughput);
				collResult.addKPI(_unitId, "PM-00-05-009-32", queuelength);
				collResult.addKPI(_unitId, "PM-00-05-009-33", hogthreadcount);
			}
		} catch (Exception e) {
			logger.error(e);
		} finally {
			release();
		}
		return collResult.KPISet;
	}

	@Override
	public void collWeblogic10WithJMX(HashMap<String, String> map) {
	}

	@Override
	public Vector<TblATO_KPIDETAIL> collWeblogic10ForSX(HashMap<String, String> params) {
		return null;
	}

	public int getVectorIndexs(Vector<String> vc, String keyStr) {
		String arrayStr = "";
		for (int i = 0; i < vc.size(); i++) {
			String serverFlag = vc.get(i);
			if (serverFlag.contains(keyStr)) {
				arrayStr += "1";
			} else {
				arrayStr += "0";
			}
		}
		int startOne = arrayStr.indexOf("1");
		return arrayStr.substring(startOne).indexOf("0");
	}

	public static void main(String[] argv) {
		CollWeblogic10WithSNMP web = new CollWeblogic10WithSNMP();
		HashMap<String, String> params = new HashMap<String, String>();
		params.put("SERVERIP", "10.70.205.102");
		params.put("PORT", "161");
		params.put("SNMPV", "2");
		params.put("SERVERNAME", "10_70_205_102");
		params.put("COMMUNITY", "public");
		Vector<TblATO_KPIDETAIL> vector_ds = web.getJVM(params);
		for (int i = 0; i < vector_ds.size(); i++) {
			TblATO_KPIDETAIL ato = (TblATO_KPIDETAIL) vector_ds.get(i);
			System.out.println(ato.UNIT_ID + " | " + ato.KPI_ID + " | " + ato.KPI_VALUE + " | " + ato.CLL_TIME);
		}
		System.out.println(Math.abs(-3289343));
	}
}