CollWeblogicAllWithSNMP.java 19.2 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
package com.sitech.ismp.coll;

import java.io.File;
import java.util.Date;
import java.util.HashMap;
import java.util.Vector;

import org.apache.log4j.Logger;

import bsh.This;

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

public class CollWeblogicAllWithSNMP implements CollWeblogicWithSNMPMBean {

	SnmpTarget target = null;

	String ObjectIP = null;

	private boolean DEBUG = false;

	// RPCTarget rpctarget = null;

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

	String hostname = "";

	String community = null;

	String ip = null;

	int port = 0;

	String servicename = null;

	String snmp_version = "1";

	private Vector result = new Vector();

	// ///////////////////////////性能指标/////////////////////////////////////////
	private String serverConnectorCount = "";
	private String serverSocketCount = "";
	private String averageTimeOfClientConnect = "";
	private String averageTimeOfClientQuery = "";
	private String sessionsCount = "";
	private String averageTimeOfSessionResponse = "";
	private String frequencyOfRequestSession = "";
	// JDBC连接池活动连接总数
	private String currentCountOfJdbcPool = "";
	// JDBC等待数据库连接请求数
	private String waitCountOfJdbcPool = "";
	// JDBC连接池可用连接数
	private String avaliCountOfJdbcPool = "";
	// 从连接池中获取连接的平均时间
	private String averageTimeOfWaitInJdbcPool = "";
	// JDBC连接池泄漏连接数
	private String linkedCountOfJdbcPool = "";
	// 缓冲语句被使用的次数
	private String reuseCountOfCachedSqlInJdbcPool = "";
	// 等待数据库连接的请求数
	private String waitDBCountOfJdbcPool = "";
	// 执行队列吞吐量
	private String throughputOfThreadpool = "";
	// 执行队列当前等待请求数
	private String totalCountOfThreadPool = "";
	// 执行队列当前空闲线程数
	private String ildeCountOfThreadPool = "";
	// 执行队列处理的总的请求数
	private String totalCountOfServicedRequest = "";
	// 当前队列长度百分比
	private String useRateOfThreadPool = "";
	// 当前活动服务器个数
	private String activeServerCount = "";

	// ////////////////告警指标///////////////
	// Weblogic服务器健康状态
	private String serverHealthStatus = "";
	// Weblogic服务器连接状态
	private String serverConnectStatus = "";
	// Weblogic服务器监控状态
	private String serverMonitorStatus = "";
	// JDBC连接池的状态
	private String jdbcThreadPoolStatus = "";
	// 执行队列状态
	private String ThreadPoolStatus = "";
	// Weblogic集群服务器可用性
	private String clusterStatus = "";
	// 日志文件错误报警
	private String logFalse = "";
	private String logSize="";

	// //////////////////////////////配置指标//////////////////////////

	private String serverName = "";
	private String serverType = "";
	private String serverHostName = "";
	private String serverCulsterName = "";
	private String serverIp = "";
	private String serverListenPort = "";
	private String weblogicInstallPath = "";
	private String weblogicVersion = "";
	private String jdkversion = "";
	private String jdkdir = "";
	private String maxCountOf = "";
	private String heapSize = "";
	private String maxThreadPool = "";
	private String weblogicRunMode = "";
	private String webserverName = "";
	private String webdir = "";
	private String jdbcname = "";
	private String jdbccapacity = "";
	private String jdbcurl = "";
	private String executeid = "";
	private String maxCountOfExecute = "";
	private String clustername = "";
	private String serverCountOfcluster = "";
	private String logfileName = "";
	private String logfilePath="";

	public Vector coll(HashMap params) {
		String community = "public";
		community = (String) params.get("COMMUNITY");
		String ip = (String) params.get("IP"); // 要采集的weblogic7.0 IP
		int port = Integer.parseInt((String) params.get("PORT")); // SNMP端口
		String servicename = (String) params.get("SERVICENAME"); // weblogic7.0所开的server
		String snmp_version = (String) params.get("SNMP_VERSION");
		
		String jdk_dir = (String)params.get("JDK_HOME");
		this.jdkdir=jdk_dir;
		if (snmp_version != null && !snmp_version.equals("")) {
			this.snmp_version = snmp_version;
		}
		String hostname = ip;
		this.hostname = hostname;
		this.ip = ip;
		this.port = port;
		this.community = community;
		this.servicename = servicename;

		logger.info(ip); // 记录日志
		// 与weblogic8.0建立初始化连接
		initWeblogic(ip, servicename, port, hostname, community);
		// 将采集到的数据写入文件 version 2
		// 2006-08-18
		// callCollBase();
		collKPI();
		processRawData();
		this.setKPI();
		// 返回操作
		this.release();
		return result;
	}

	public void initWeblogic(String weblogicip, String servername, int port,
			String hostname, String community) {
		try {
			this.ObjectIP = weblogicip;
			System.out.println("weblogicip=" + weblogicip);
			target = new SnmpTarget();
			target.setDebug(DEBUG);
			if (this.snmp_version.equals("1")) {
				target.setSnmpVersion(SnmpTarget.VERSION1);
			} else if (this.snmp_version.equals("2")) {
				target.setSnmpVersion(SnmpTarget.VERSION2C);
			} else if (this.snmp_version.equals("3")) {
				target.setSnmpVersion(SnmpTarget.VERSION3);
			}
			target.setTargetHost(ObjectIP); // set the agent hostname
			// target.setTargetHost(hostname); // set the agent hostname(ip or
			// hostname):ip of HP workstation
			System.out.println("hostname=" + hostname);
			target.setCommunity(community.trim());

			target.setTargetPort(port);
			// target.setRetries( RETRIES );
			// target.setTimeout( TIMEOUT );
			// if (target.getSnmpVersion() == target.VERSION3) {
			// target.create_v3_tables();
			// }
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public void release() {
		target.releaseResources();
	}

	public void collKPI() {
		serverConnectorCount = this
				.getOIDValue(".1.3.6.1.4.1.140.625.455.1.65");
		serverSocketCount = this.getOIDValue(".1.3.6.1.4.1.140.625.360.1.50");
		averageTimeOfClientConnect = this
				.getOIDValue(".1.3.6.1.4.1.140.625.455.1.110");
		// averageTimeOfClientQuery = this.getOIDValue("");
		sessionsCount = this.getOIDValue(".1.3.6.1.4.1.140.625.455.1.90");
		averageTimeOfSessionResponse = this.getOIDValue("");
		// frequencyOfRequestSession = this.getOIDValue("");

		currentCountOfJdbcPool = this
				.getOIDValue(".1.3.6.1.4.1.140.625.190.1.25");
		// JDBC等待数据库连接请求数
		waitCountOfJdbcPool = this.getOIDValue(".1.3.6.1.4.1.140.625.190.1.30");
		// JDBC连接池可用连接数
		avaliCountOfJdbcPool = this
				.getOIDValue(".1.3.6.1.4.1.140.625.190.1.64");
		// 从连接池中获取连接的平均时间
		averageTimeOfWaitInJdbcPool = this
				.getOIDValue(".1.3.6.1.4.1.140.625.190.1.62");
		// JDBC连接池泄漏连接数
		linkedCountOfJdbcPool = this
				.getOIDValue(".1.3.6.1.4.1.140.625.190.1.68");
		// 缓冲语句被使用的次数
		reuseCountOfCachedSqlInJdbcPool = this
				.getOIDValue(".1.3.6.1.4.1.140.625.191.1.70");
		// 等待数据库连接的请求数
		waitDBCountOfJdbcPool = this
				.getOIDValue(".1.3.6.1.4.1.140.625.190.1.50");
		// 执行队列吞吐量
		throughputOfThreadpool = this
				.getOIDValue(".1.3.6.1.4.1.140.625.367.1.65");
		// 执行队列当前等待请求数
		totalCountOfThreadPool = this
				.getOIDValue(".1.3.6.1.4.1.140.625.550.1.25");
		// 执行队列当前空闲线程数
		ildeCountOfThreadPool = this
				.getOIDValue(".1.3.6.1.4.1.140.625.367.1.30");
		// 执行队列处理的总的请求数
		totalCountOfServicedRequest = this
				.getOIDValue(".1.3.6.1.4.1.140.625.367.1.50");
		// 当前队列长度百分比
		// useRateOfThreadPool = this.getOIDValue("");
		// 当前活动服务器个数
		activeServerCount = this.getOIDValue(".1.3.6.1.4.1.140.625.110.1.25");

		// /////////////////////////////////////////////////////////////////////////////
		serverHealthStatus = this
				.getOIDValue(".1.3.6.1.4.1.140.625.360.1.60");
		// Weblogic服务器连接状态
		serverConnectStatus = this
				.getOIDValue(".1.3.6.1.4.1.140.625.430.1.30");
		// Weblogic服务器监控状态
		 serverMonitorStatus = this
				.getOIDValue(".1.3.6.1.4.1.140.625.360.1.60");
		// JDBC连接池的状态
		 jdbcThreadPoolStatus = this
				.getOIDValue(".1.3.6.1.4.1.140.625.191.1.35");
		// 执行队列状态
		 ThreadPoolStatus = this
				.getOIDValue(".1.3.6.1.4.1.140.625.457.1.65");
		// Weblogic集群服务器可用性
		 clusterStatus = this
				.getOIDValue(".1.3.6.1.4.1.140.625.110.1.25");
		 logFalse = this.getOIDValue(".1.3.6.1.4.1.140.625.110.1.25");
		// //////////////////////////////配置指标/////////////////////////////////////////////////
		serverName = this.getOIDValue(".1.3.6.1.4.1.140.625.360.1.15");
		//serverType = this.getOIDValue(".1.3.6.1.4.1.140.625.360.1.10");
		serverType = "Weblogic";
		serverHostName =this.getOIDValue(".1.3.6.1.4.1.140.625.360.1.70");
		serverCulsterName = this.getOIDValue(".1.3.6.1.4.1.140.625.510.1.15");
		serverIp = this.ip;
		serverListenPort = this.getOIDValue(".1.3.6.1.4.1.140.625.360.1.35");
		weblogicInstallPath = this.getOIDValue(".1.3.6.1.4.1.140.625.110.1.25");
		weblogicVersion = this.getOIDValue(".1.3.6.1.4.1.140.625.360.1.65");
		jdkversion = this.getOIDValue(".1.3.6.1.4.1.140.625.340.1.35");
		jdkdir = this.getOIDValue(".1.3.6.1.4.1.140.625.340.1.35");
		maxCountOf = this.getOIDValue(".1.3.6.1.4.1.140.625.360.1.82");
		heapSize = this.getOIDValue(".1.3.6.1.4.1.140.625.340.1.30");
		maxThreadPool = this.getOIDValue(".1.3.6.1.4.1.140.625.367.1.45");
		weblogicRunMode = this.getOIDValue(".1.3.6.1.4.1.140.625.110.1.10");
		webserverName = this.getOIDValue(".1.3.6.1.4.1.140.625.730.1.15");
		webdir = this.getOIDValue(".1.3.6.1.4.1.140.625.730.1.110");
		jdbcname = this.getOIDValue(".1.3.6.1.4.1.140.625.190.1.15");
		jdbccapacity = this.getOIDValue(".1.3.6.1.4.1.140.625.190.1.60");
		jdbcurl =this.getOIDValue(".1.3.6.1.4.1.140.625.560.1.30");
		executeid = this.getOIDValue(".1.3.6.1.4.1.140.625.180.1.1");
		maxCountOfExecute = this.getOIDValue(".1.3.6.1.4.1.140.625.550.1.26");
		clustername = this.getOIDValue(".1.3.6.1.4.1.140.625.510.1.15");
		serverCountOfcluster = this.getOIDValue(".1.3.6.1.4.1.140.625.110.1.25");
		logfileName =this.getOIDValue(".1.3.6.1.4.1.140.625.700.1.25");
		logSize = this.getOIDValue(".1.3.6.1.4.1.140.625.700.1.50");
		///////////////////////////////////////////////////////////////////////////////
	
	}
	
	public void setKPI(){
		String kbp_class="10-12-11-11-10";
		String unitID = kbp_class+":"+this.servicename+"-server";
		this.setResult(this.serverName, unitID, "CM-00-04-001-05");
		this.setResult(this.serverType, unitID, "CM-00-04-001-26");
		this.setResult(this.serverHostName, unitID, "CM-00-04-001-12");
		this.setResult(this.serverCulsterName, unitID, "CM-00-04-001-13");
		this.setResult(this.serverIp, unitID, "CM-00-01-001-02");
		this.setResult(this.serverListenPort, unitID, "CM-00-04-003-07");
		
	    kbp_class="10-12-11-10-10";
	    unitID = kbp_class+":"+this.servicename+"-total";
		this.setResult(this.weblogicInstallPath, unitID, "CM-00-04-001-14");
		this.setResult(this.weblogicVersion, unitID, "CM-00-04-001-15");
		this.setResult(this.jdkversion, unitID, "CM-00-04-001-16");
		this.setResult(this.jdkdir, unitID, "CM-00-04-001-25");
		
		kbp_class="10-12-11-11-10";
		unitID = kbp_class+":"+this.servicename+"-server";
		this.setResult(this.maxCountOf, unitID, "CM-00-04-001-02");
		this.setResult(this.heapSize, unitID, "CM-00-04-003-02");
		this.setResult(this.maxThreadPool, unitID, "CM-00-04-003-03");
		
		kbp_class="10-12-11-10-10";
		unitID = kbp_class+":"+this.servicename+"-total";
		this.setResult(this.weblogicRunMode, unitID, "CM-00-04-003-01");
		this.setResult(this.webserverName, unitID, "CM-00-04-001-05");
		this.setResult(this.webdir, unitID, "CM-00-04-001-24");
		
		
		kbp_class="10-12-11-13-10";
		unitID = kbp_class+":"+this.servicename+"-jdbc";
		this.setResult(this.jdbcname, unitID, "CM-00-04-001-17");
		this.setResult(this.jdbccapacity, unitID, "CM-00-04-001-18");
		this.setResult(this.jdbcurl, unitID, "CM-00-04-001-19");
		
		kbp_class="10-12-11-12-10";
		unitID = kbp_class+":"+this.servicename+"-executpool";
		this.setResult(this.executeid, unitID, "CM-00-04-001-20");
		this.setResult(this.maxCountOfExecute, unitID, "CM-00-04-001-21");
		
		kbp_class="10-12-11-11-10";
		unitID = kbp_class+":"+this.servicename+"-server";
		this.setResult(this.clustername, unitID, "CM-00-04-001-22");
		this.setResult(this.serverCountOfcluster, unitID, "CM-00-04-001-23");
		this.setResult(this.logfileName, unitID, "CM-00-04-003-09");
		this.setResult(this.logfilePath, unitID, "CM-00-04-001-04");
		this.setResult(this.logSize, unitID, "CM-00-04-003-08");
		
		////////////////////////////////////////////////////////////////
		kbp_class="10-12-11-11-10";
		unitID = kbp_class+":"+this.servicename+"-server";
		this.setResult(this.serverHealthStatus , unitID, "FM-00-04-001-04");
		this.setResult(this.serverConnectStatus , unitID, "FM-00-04-001-05");
		this.setResult(this.serverMonitorStatus  , unitID, "FM-00-04-001-06");
		this.setResult(this.jdbcThreadPoolStatus, unitID, "FM-00-04-001-07");
		
		kbp_class="10-12-11-11-10";
		unitID = kbp_class+":"+this.servicename+"-executpool";
		this.setResult(this.ThreadPoolStatus , unitID, "FM-00-04-001-08");
		
		kbp_class="10-12-11-10-10";
		unitID = kbp_class+":"+this.servicename+"-total";
		this.setResult(this.clusterStatus  , unitID, "FM-00-04-001-09");
		
		/////////////////////////////////////////////////////////////////////
		kbp_class="10-12-11-11-10";
		unitID = kbp_class+":"+this.servicename+"-server";
		this.setResult(this.serverConnectorCount, unitID, "PM-00-04-801-01");
		this.setResult(this.serverSocketCount , unitID, "PM-00-04-801-02");
		this.setResult(this.averageTimeOfClientConnect  , unitID, "PM-00-04-801-03");
		this.setResult(this.averageTimeOfClientQuery  , unitID, "PM-00-04-801-04");
		this.setResult(this.sessionsCount  , unitID, "PM-00-04-801-05");
		this.setResult(this.averageTimeOfSessionResponse  , unitID, "PM-00-04-801-06");
		this.setResult(this.frequencyOfRequestSession  , unitID, "PM-00-04-801-07");
		//jdbc
		kbp_class="10-12-11-13-10";
		unitID = kbp_class+":"+this.servicename+"-jdbc";
		this.setResult(this.currentCountOfJdbcPool  , unitID, "PM-00-04-801-08");
		this.setResult(this.waitCountOfJdbcPool  , unitID, "PM-00-04-801-09");
		this.setResult(this.avaliCountOfJdbcPool  , unitID, "PM-00-04-801-10");
		this.setResult(this.averageTimeOfWaitInJdbcPool  , unitID, "PM-00-04-801-11");
		this.setResult(this.linkedCountOfJdbcPool  , unitID, "PM-00-04-801-12");
		this.setResult(this.reuseCountOfCachedSqlInJdbcPool  , unitID, "PM-00-04-801-13");
		this.setResult(this.waitDBCountOfJdbcPool  , unitID, "PM-00-04-801-14");
		
		kbp_class="10-12-11-12-10";
		unitID = kbp_class+":"+this.servicename+"-executpool";
		this.setResult(this.throughputOfThreadpool  , unitID, "PM-00-04-801-15");
		this.setResult(this.totalCountOfThreadPool  , unitID, "PM-00-04-801-16");
		this.setResult(this.ildeCountOfThreadPool   , unitID, "PM-00-04-801-17");
		this.setResult(this.totalCountOfServicedRequest   , unitID, "PM-00-04-801-18");
		this.setResult(this.useRateOfThreadPool    , unitID, "PM-00-04-801-19");
		
		kbp_class="10-12-11-10-10";
		unitID = kbp_class+":"+this.servicename+"-total";
		this.setResult(this.activeServerCount    , unitID, "PM-00-04-801-20");
	}
	
	
	
	private void setResult(String value, String unitID, String kpiID) {
		try {
			if(value==null||value.equals("")){
				System.out.println(kpiID+"=空");
				return;
			}
			if(kpiID==null||kpiID.equals("")){
				System.out.println(unitID+"=空");
				
				return;
			}
			System.out.println(unitID+":"+kpiID+":"+value);
			TblATO_KPIDETAIL record;
			record = new TblATO_KPIDETAIL();
			record.setCLL_TIME(new java.util.Date()); // 采集所消耗的时间
			record.setKPI_ID(kpiID); // kpi编号
			record.setKPI_VALUE(value); // 具体采集得到的值信息
			record.setUNIT_ID(unitID); // unit
			record.setCLL_TIME(new Date()); // 日期
			result.add(record);
		} catch (Exception e) {
			logger.error(e);
		}
	}

	public String getOIDValue(String oid) {
		String value = "";
		if (oid == null || oid.equals("")) {
			return value;
		}
		Vector tmp_result = this.walkKPIInfo(oid, true);
		if (tmp_result != null && tmp_result.size() > 0) {
			value = (String) tmp_result.get(0);
			System.out.println(oid + "=" + value);
		}
		return value;
	}

	public Vector walkKPIInfo(String oid, boolean bool) {
		Vector tmp_result = new Vector();
		try {
			Vector tmp_oid = new Vector();
			target.setObjectID(oid);
			target.oidList[0] = new com.adventnet.snmp.snmp2.SnmpOID(oid);// .1.3.6.1.4.1.11.2.3.1.2.2.1
			int maxtry = 0;
			com.adventnet.snmp.snmp2.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;
						// break;
					}
					if (!SnmpTarget.isInSubTree(rootoid, target.getSnmpOID()))
						break; // check first column
					// System.out.println("result1.length=" +result1.length);
					for (int i = 0; i < result1.length; i++) { // print the
						tmp_result.add(result1[i]);
						tmp_oid.add(target.getObjectID(i));

					}

					if (result1[0].compareTo("NULL") == 0)
						break;
				}

				if (maxtry == 1) { // we did not get a valid row
					System.err
							.println("Request failed, timed out or no available data("
									+ oid + "). \n " + target.getErrorString());
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return tmp_result;
	}
	
	public void processRawData(){
		try{
			int total = Integer.valueOf(this.maxThreadPool).intValue();
			int use = Integer.valueOf(totalCountOfThreadPool).intValue();
			int userate = use*100/total;
			this.useRateOfThreadPool = String.valueOf(userate);
		}catch(Exception e){
			e.printStackTrace();
			this.useRateOfThreadPool = "";
			
		}
		try{
			if(this.weblogicRunMode!=null){
				if(this.weblogicRunMode.endsWith("clusterRuntime")){
					this.weblogicRunMode="集群";
				}else{
					this.weblogicRunMode="单机";
				}
			}
		}catch(Exception e){
			e.printStackTrace();
		}
		try{
			this.logfilePath = this.logfileName;
			if(this.logfileName!=null&&!logfileName.equals("")){
				String[] files=logfileName.split(File.separator);
				if(files!=null&&files.length>0){
					this.logfileName = files[files.length-1];
				}	
			}
			int ilogfileSize=0;
			if(this.logSize!=null){
				ilogfileSize = Integer.valueOf(logSize.trim()).intValue()/1024;
				this.logSize = String.valueOf(ilogfileSize);
			}
			
		}catch(Exception e){
			e.printStackTrace();
		}
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		HashMap map = new HashMap();
		map.put("COMMUNITY", "public");
		map.put("IP", "136.9.7.138");
		map.put("PORT", "10161");
		map.put("SERVICENAME", "myserver");
		map.put("SNMP_VERSION", "2");
		CollWeblogicAllWithSNMP cll = new CollWeblogicAllWithSNMP();
		Vector r=cll.coll(map);
		System.out.println(r.size());
		for(int i=0;i<r.size();i++){
			TblATO_KPIDETAIL result=(TblATO_KPIDETAIL) r.get(i);
			System.out.println(i);
			System.out.println(result.UNIT_ID+":"+result.KPI_ID+"="+result.KPI_VALUE);
		}

	}

}