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(); }
static void printPerfIntervals(PerfInterval[] pis) { for(int i=0; pis!=null && i<pis.length; i++) { System.out.println("\nPerfInterval # " + i); StringBuffer sb = new StringBuffer(); sb.append("Name:" + pis[i].getName()); sb.append("\nKey:" + pis[i].getKey()); sb.append("\nLevel:"+ pis[i].getLevel()); sb.append("\nSamplingPeriod:" + pis[i].getSamplingPeriod()); sb.append("\nLength:" + pis[i].getLength()); sb.append("\nEnabled:" + pis[i].isEnabled()); System.out.println(sb); } }
public void createPerfInterval(PerfInterval interval) throws Exception { _context.getService().createPerfInterval(_mor, interval); }
public void updatePerfInterval(PerfInterval interval) throws Exception { _context.getService().updatePerfInterval(_mor, interval); }
public List<PerfInterval> getIntervalInfo() throws Exception { return _context.getVimClient().getDynamicProperty(_mor, "historicalInterval"); }
/** * @throws java.rmi.RemoteException * @throws com.vmware.vim25.RuntimeFault * @deprecated use UpdatePerfInterval instead */ @Deprecated void createPerfInterval(PerfInterval intervalId) throws RuntimeFault, RemoteException;
List<PerfInterval> getHistoricalInterval();
void updatePerfInterval(PerfInterval interval) throws RuntimeFault, RemoteException;