use of com.googlecode.jmxtrans.model.output.GraphiteWriter in project jmxtrans by jmxtrans.
the class ActiveMQ method main.
public static void main(String[] args) throws Exception {
Server.Builder serverBuilder = Server.builder().setHost("w2").setPort("1105").setAlias("w2_activemq_1105");
GraphiteWriter gw = GraphiteWriter.builder().addTypeName("destinationName").addTypeName("Destination").setDebugEnabled(true).setHost(GW_HOST).setPort(2003).build();
Query q = Query.builder().setObj("org.apache.activemq:BrokerName=localhost,Type=Subscription,clientId=*,consumerId=*,destinationName=*,destinationType=Queue,persistentMode=Non-Durable").addAttr("PendingQueueSize").addAttr("DispatchedQueueSize").addAttr("EnqueueCounter").addAttr("DequeueCounter").addAttr("MessageCountAwaitingAcknowledge").addAttr("DispachedCounter").addOutputWriterFactory(gw).build();
serverBuilder.addQuery(q);
Query q2 = Query.builder().setObj("org.apache.activemq:BrokerName=localhost,Destination=ActiveMQ.Advisory.Consumer.Queue.*,Type=Topic").addAttr("QueueSize").addAttr("MaxEnqueueTime").addAttr("MinEnqueueTime").addAttr("AverageEnqueueTime").addAttr("InFlightCount").addAttr("ConsumerCount").addAttr("ProducerCount").addAttr("DispatchCount").addAttr("DequeueCount").addAttr("EnqueueCount").addAttr("Subscriptions").addOutputWriterFactory(gw).build();
serverBuilder.addQuery(q2);
Query q3 = Query.builder().setObj("org.apache.activemq:BrokerName=localhost,Destination=*,Type=Queue").addAttr("QueueSize").addAttr("MaxEnqueueTime").addAttr("MinEnqueueTime").addAttr("AverageEnqueueTime").addAttr("InFlightCount").addAttr("ConsumerCount").addAttr("ProducerCount").addAttr("DispatchCount").addAttr("DequeueCount").addAttr("EnqueueCount").addAttr("Subscriptions").addOutputWriterFactory(gw).build();
serverBuilder.addQuery(q3);
Query q4 = Query.builder().setObj("org.apache.activemq:BrokerName=localhost,Destination=*,Type=Topic").addAttr("QueueSize").addAttr("MaxEnqueueTime").addAttr("MinEnqueueTime").addAttr("AverageEnqueueTime").addAttr("InFlightCount").addAttr("ConsumerCount").addAttr("ProducerCount").addAttr("DispatchCount").addAttr("DequeueCount").addAttr("EnqueueCount").addAttr("Subscriptions").addOutputWriterFactory(gw).build();
serverBuilder.addQuery(q4);
Query q5 = Query.builder().setObj("org.apache.activemq:BrokerName=localhost,Type=Broker").addOutputWriterFactory(gw).build();
serverBuilder.addQuery(q5);
Query q6 = Query.builder().setObj("java.lang:type=Memory").addAttr("HeapMemoryUsage").addAttr("NonHeapMemoryUsage").addOutputWriterFactory(gw).build();
serverBuilder.addQuery(q6);
Query q7 = Query.builder().setObj("java.lang:type=Threading").addAttr("DaemonThreadCount").addAttr("PeakThreadCount").addAttr("ThreadCount").addAttr("CurrentThreadCpuTime").addAttr("CurrentThreadUserTime").addAttr("TotalStartedThreadCount").addOutputWriterFactory(gw).build();
serverBuilder.addQuery(q7);
Query q8 = Query.builder().setObj("java.lang:name=*,type=GarbageCollector").addKey("committed").addKey("init").addKey("max").addKey("used").addKey("duration").addKey("CollectionCount").addKey("CollectionTime").addOutputWriterFactory(gw).build();
serverBuilder.addQuery(q8);
Query q9 = Query.builder().setObj("java.lang:type=MemoryPool,name=*").addOutputWriterFactory(GraphiteWriter.builder().addTypeName("name").setDebugEnabled(true).setHost(GW_HOST).setPort(2003).build()).build();
serverBuilder.addQuery(q9);
JmxProcess process = new JmxProcess(serverBuilder.build());
new JsonPrinter(System.out).prettyPrint(process);
Injector injector = JmxTransModule.createInjector(new JmxTransConfiguration());
JmxTransformer transformer = injector.getInstance(JmxTransformer.class);
transformer.executeStandalone(process);
}
use of com.googlecode.jmxtrans.model.output.GraphiteWriter in project jmxtrans by jmxtrans.
the class InterestingInfo method main.
// this is an example, no need to make IP addresses configurable
@SuppressWarnings("squid:S1313")
public static void main(String[] args) throws Exception {
Server.Builder serverBuilder = Server.builder().setHost("w2").setPort("1099").setNumQueryThreads(2);
Map<String, Object> settings = newHashMap();
settings.put(GraphiteWriter.HOST, "192.168.192.133");
settings.put(GraphiteWriter.PORT, 2003);
GraphiteWriter gw = GraphiteWriter.builder().setHost("192.168.192.133").setPort(2003).build();
StdOutWriter sw = new StdOutWriter(ImmutableList.<String>of(), false, false, Collections.<String, Object>emptyMap());
Query q = Query.builder().setObj("java.lang:type=Memory").addAttr("HeapMemoryUsage").addAttr("NonHeapMemoryUsage").addOutputWriterFactories(gw, sw).build();
serverBuilder.addQuery(q);
Query q2 = Query.builder().setObj("java.lang:type=Threading").addAttr("DaemonThreadCount").addAttr("PeakThreadCount").addAttr("ThreadCount").addOutputWriterFactories(gw, sw).build();
serverBuilder.addQuery(q2);
Query q3 = Query.builder().setObj("java.lang:name=ConcurrentMarkSweep,type=GarbageCollector").addAttr("LastGcInfo").addOutputWriterFactories(gw, sw).build();
serverBuilder.addQuery(q3);
Query q4 = Query.builder().setObj("java.lang:name=ParNew,type=GarbageCollector").addAttr("LastGcInfo").addOutputWriterFactories(gw, sw).build();
serverBuilder.addQuery(q4);
JmxProcess process = new JmxProcess(serverBuilder.build());
printer.prettyPrint(process);
Injector injector = JmxTransModule.createInjector(new JmxTransConfiguration());
JmxTransformer transformer = injector.getInstance(JmxTransformer.class);
transformer.executeStandalone(process);
}
Aggregations