i trying average cpu usage ec2s in specific region. tried following:
- request 1 instance statistics per request, works slow.
- i tried remove dimensions request got empty response, although cli returns instances available (statistics 35 instances on span of 24 hours).
i tried set 10 dimensions per request got exception:
2016-01-24 23:13:30.925 java[20057:31669898] gl_framebuffer_incomplete_attachment_ext java.lang.runtimeexception: requested texture dimensions (62206x154) require dimensions (0x154) exceed maximum texture size (16384) @ com.sun.prism.es2.es2rttexture.create(es2rttexture.java:220) @ com.sun.prism.es2.es2resourcefactory.createrttexture(es2resourcefactory.java:158) @ com.sun.prism.es2.es2swapchain.creategraphics(es2swapchain.java:210) @ com.sun.prism.es2.es2swapchain.creategraphics(es2swapchain.java:40) @ com.sun.javafx.tk.quantum.presentingpainter.run(presentingpainter.java:87) @ java.util.concurrent.executors$runnableadapter.call(executors.java:511) @ java.util.concurrent.futuretask.runandreset(futuretask.java:308) @ com.sun.javafx.tk.renderjob.run(renderjob.java:58) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ com.sun.javafx.tk.quantum.quantumrenderer$pipelinerunnable.run(quantumrenderer.java:125) @ java.lang.thread.run(thread.java:745)
code:
private list<datapoint> monitorinstance(amazoncloudwatchclient cloudwatchclient, list<dimension> dimensions) { list<datapoint> datapoints = new arraylist<>(); try { int dimensionslastindex = 0; (int dimensionsindex = 0; dimensionsindex < dimensions.size(); dimensionsindex = dimensionslastindex + 1) { dimensionslastindex = (dimensionsindex + 10) <= dimensions.size() ? dimensionsindex + 9 : dimensions.size() - 1; long offsetinmilliseconds = 1000 * 60 * 60 * 24; getmetricstatisticsrequest request = new getmetricstatisticsrequest() .withstarttime(new date(new date().gettime() - offsetinmilliseconds)) .withnamespace("aws/ec2") .withperiod(60 * 60) .withdimensions(dimensions.sublist(dimensionsindex, dimensionslastindex)) .withmetricname("cpuutilization") .withstatistics("average") .withendtime(new date()); getmetricstatisticsresult getmetricstatisticsresult = cloudwatchclient.getmetricstatistics(request); datapoints.addall(getmetricstatisticsresult.getdatapoints()); } return datapoints; } catch (amazonserviceexception e) { error(e.getmessage(), stacktracetostring(e)); } return new arraylist<>(); }
although want fix exception, wonder if there simple way stats instances in 1 request.
Comments
Post a Comment