use of com.googlecode.jmxtrans.model.output.RRDToolWriter in project jmxtrans by jmxtrans.
the class ActiveMQ2 method main.
@SuppressFBWarnings(value = "DMI_HARDCODED_ABSOLUTE_FILENAME", justification = "Path to RRD binary is hardcoded as this is example code")
public static void main(String[] args) throws Exception {
File outputFile = new File("target/w2-TEST.rrd");
if (!outputFile.exists() && !outputFile.createNewFile()) {
throw new IOException("Could not create output file");
}
RRDToolWriter gw = RRDToolWriter.builder().setTemplateFile(new File("memorypool-rrd-template.xml")).setOutputFile(outputFile).setBinaryPath(new File("/opt/local/bin")).setDebugEnabled(true).setGenerate(true).addTypeName("Destination").build();
JmxProcess process = new JmxProcess(Server.builder().setHost("w2").setPort("1105").setAlias("w2_activemq_1105").addQuery(Query.builder().setObj("org.apache.activemq:BrokerName=localhost,Type=Queue,Destination=*").addAttr("QueueSize").addAttr("MaxEnqueueTime").addAttr("MinEnqueueTime").addAttr("AverageEnqueueTime").addAttr("InFlightCount").addAttr("ConsumerCount").addAttr("ProducerCount").addAttr("DispatchCount").addAttr("DequeueCount").addAttr("EnqueueCount").addOutputWriterFactory(gw).build()).addQuery(Query.builder().setObj("org.apache.activemq:BrokerName=localhost,Type=Topic,Destination=*").addAttr("QueueSize").addAttr("MaxEnqueueTime").addAttr("MinEnqueueTime").addAttr("AverageEnqueueTime").addAttr("InFlightCount").addAttr("ConsumerCount").addAttr("ProducerCount").addAttr("DispatchCount").addAttr("DequeueCount").addAttr("EnqueueCount").addOutputWriterFactory(gw).build()).build());
jsonPrinter.prettyPrint(process);
Injector injector = JmxTransModule.createInjector(new JmxTransConfiguration());
JmxTransformer transformer = injector.getInstance(JmxTransformer.class);
transformer.executeStandalone(process);
}
Aggregations