/** * This method retrieves the performance counters available. * * @return a map of performance counters */ public Map<Integer, PerfCounterInfo> getPerfCounterInfoMap() { if (m_perfCounterInfoMap == null) { m_perfCounterInfoMap = new HashMap<Integer, PerfCounterInfo>(); PerfCounterInfo[] perfCounterInfos = getPerformanceManager().getPerfCounter(); for (PerfCounterInfo perfCounterInfo : perfCounterInfos) { m_perfCounterInfoMap.put(perfCounterInfo.getKey(), perfCounterInfo); } } return m_perfCounterInfoMap; }
/** * This method retrieves the performance counters available. * * @return a map of performance counters */ public Map<Integer, PerfCounterInfo> getPerfCounterInfoMap() { if (m_perfCounterInfoMap == null) { m_perfCounterInfoMap = new HashMap<Integer, PerfCounterInfo>(); PerfCounterInfo[] perfCounterInfos = getPerformanceManager().getPerfCounter(); for (PerfCounterInfo perfCounterInfo : perfCounterInfos) { m_perfCounterInfoMap.put(perfCounterInfo.getKey(), perfCounterInfo); } } return m_perfCounterInfoMap; }
public static synchronized Boolean updateConnection() throws IOException { try { serviceInstance = new ServiceInstance(new URL(sdkUrl), uname, passwd, true, connectTimeout, readTimeout); if (serviceInstance == null) { LOG.error("serviceInstance in null! Connection failed."); return false; } Folder rootFolder = serviceInstance.getRootFolder(); inventoryNavigator = new InventoryNavigator(serviceInstance.getRootFolder()); performanceManager = serviceInstance.getPerformanceManager(); // retrieve all the available performance counters PerfCounterInfo[] pcis = performanceManager.getPerfCounter(); return true; } catch (Exception ex) { ex.printStackTrace(); } return false; }
private List getCounterByName(String name) throws IOException { List<String> ctrProps = counterCache.getIfPresent(name); if (ctrProps != null) { LOG.debug("CacheHIT: PerfCounter name: " + name); return ctrProps; } PerfCounterInfo[] pcis = performanceManager.getPerfCounter(); String perfCounter = ""; for (int i = 0; i < pcis.length; i++) { perfCounter = pcis[i].getGroupInfo().getKey() + "." + pcis[i].getNameInfo().getKey() + "." + pcis[i].getRollupType().toString(); ctrProps = new ArrayList<String>(); ctrProps.add(String.valueOf(pcis[i].getKey())); ctrProps.add(pcis[i].getUnitInfo().getKey().toString()); ctrProps.add(pcis[i].getStatsType().toString()); ctrProps.add(pcis[i].getRollupType().toString()); counterCache.put(perfCounter, ctrProps); if (perfCounter.equals(name)) { LOG.debug("CacheMISS: PerfCounter name: " + name); return ctrProps; } } return counterCache.getIfPresent(name); }
public static void main(String[] args) throws Exception { if(args.length != 3) { System.out.println("Usage: java PrintPerfMgr " + "<url> <username> <password>"); return; } ServiceInstance si = new ServiceInstance( new URL(args[0]), args[1], args[2], true); PerformanceManager perfMgr = si.getPerformanceManager(); System.out.println("***Print All Descriptions:"); PerformanceDescription pd = perfMgr.getDescription(); printPerfDescription(pd); System.out.println("\n***Print All Historical Intervals:"); PerfInterval[] pis = perfMgr.getHistoricalInterval(); printPerfIntervals(pis); System.out.println("\n***Print All Perf Counters:"); PerfCounterInfo[] pcis = perfMgr.getPerfCounter(); printPerfCounters(pcis); si.getServerConnection().logout(); }
public static void main(String[] args) throws Exception { ServiceInstance si = SampleUtil.createServiceInstance(); PerformanceManager perfMgr = si.getPerformanceManager(); System.out.println("***Print All Descriptions:"); PerformanceDescription pd = perfMgr.getDescription(); printPerfDescription(pd); System.out.println("\n***Print All Historical Intervals:"); PerfInterval[] pis = perfMgr.getHistoricalInterval(); printPerfIntervals(pis); System.out.println("\n***Print All Perf Counters:"); PerfCounterInfo[] pcis = perfMgr.getPerfCounter(); printPerfCounters(pcis); si.getServerConnection().logout(); }
PerfCounterInfo[] perfCounterInfos = performanceManager.getPerfCounter();
PerfCounterInfo[] perfCounterInfos = performanceManager.getPerfCounter();