Package com.googlecode.jmxtrans.model

Examples of com.googlecode.jmxtrans.model.Query


    private BrokerFarm brokerFarm;
    private ExchangeMetricWriter writer;
    private ExchangeMetricArchiver archiver;

    private Query createMonitorQuery() {
        Query query = new Query();
        query.setObj("com.sun.messaging.jms.server:type=Destination,subtype=Monitor,desttype=*,name=*");
        query.addAttr("NumMsgs");
        query.addAttr("NumMsgsIn");
        query.addAttr("NumMsgsOut");
        query.addAttr("NumMsgsPendingAcks");
        query.addAttr("NumConsumers");
        query.addAttr("NumProducers");
        query.addAttr("MsgBytesIn");
        query.addAttr("MsgBytesOut");
        query.addAttr("TotalMsgBytes");
        query.addOutputWriter(writer);
        return query;
    }
View Full Code Here


        query.addOutputWriter(writer);
        return query;
    }

    private Query createConfigQuery() {
        Query query = new Query();
        query.setObj("com.sun.messaging.jms.server:type=Destination,subtype=Config,desttype=*,name=*");
        query.addAttr("MaxNumMsgs");
        query.addAttr("MaxTotalMsgBytes");
        query.addAttr("LimitBehavior");
        query.addOutputWriter(writer);
        return query;
    }
View Full Code Here

  @Test
  public void writeSingleResult() throws Exception {
    // a lot of setup for not much of a test ...
    Server server = Server.builder().setHost("host").setPort("123").build();
    Query query = Query.builder().build();
    Result result = new Result("attributeName", "className", "classNameAlias", "typeName", ImmutableMap.of("key", (Object)1));

    GenericKeyedObjectPool<InetSocketAddress, Socket> pool = mock(GenericKeyedObjectPool.class);
    Socket socket = mock(Socket.class);
    when(pool.borrowObject(any(InetSocketAddress.class))).thenReturn(socket);
View Full Code Here

public class EqualsTests {

  @Test
  public void testQuery() {
    Query q1 = Query.builder()
        .setObj("obj")
        .addKeys("key1", "key2")
        .addAttr("foo", "bar")
        .setResultAlias("alias")
        .build();

    // same as q1
    Query q2 = Query.builder()
        .setObj("obj")
        .addKeys("key1", "key2")
        .addAttr("foo", "bar")
        .setResultAlias("alias")
        .build();

    // different
    Query q3 = Query.builder()
        .setObj("obj3")
        .addKeys("key1", "key2")
        .addAttr("foo", "bar")
        .setResultAlias("alias")
        .build();
View Full Code Here

    assertThat(q1).isNotEqualTo(q3);
  }

  @Test
  public void testQuery2() {
    Query q1 = Query.builder()
        .setObj("*")
        .addKeys("key1", "key2")
        .addAttr("foo", "bar")
        .setResultAlias("alias")
        .build();

    // not same as q1
    Query q2 = Query.builder()
        .setObj("obj")
        .addKeys("key1", "key2")
        .addAttr("foo", "bar")
        .setResultAlias("alias")
        .build();
View Full Code Here

  }

  @Test
  public void querySimpleAttribute() throws Exception {
    OutputWriter outputWriter = mock(OutputWriter.class);
    Query query = Query.builder()
        .setObj(MBEAN_NAME)
        .addAttr("DummyValue")
        .addOutputWriter(outputWriter)
        .build();
View Full Code Here

    /** Test validation when only required parameters are set. */
    @Test
    public void testValidationMinimalSettings() throws ValidationException {
    GangliaWriter writer = GangliaWriter.builder().setHost("192.168.1.144").build();
        Query test = Query.builder()
        .setObj("test")
        .build();
    Server server = Server.builder().setHost("localhost").setPort("123").build();
    writer.validateSetup(server, test);
        assertEquals("192.168.1.144", writer.getHost());
View Full Code Here

        .setTmax(354)
        .setDmax(24)
        .setGroupName("dummy")
        .build();

        Query test = Query.builder()
        .setObj("test")
        .build();
    Server server = Server.builder().setHost("localhost").setPort("123").build();
    writer.validateSetup(server, test);
        assertEquals("192.168.1.144", writer.getHost());
View Full Code Here

        .setPort(2003)
        .build();

    StdOutWriter sw = new StdOutWriter(ImmutableList.<String>of(), false, Collections.<String, Object>emptyMap());

    Query q = Query.builder()
        .setObj("java.lang:type=Memory")
        .addAttr("HeapMemoryUsage")
        .addAttr("NonHeapMemoryUsage")
        .addOutputWriters(gw, sw)
        .build();
    serverBuilder.addQuery(q);

    Query q2 = Query.builder()
        .setObj("java.lang:type=Threading")
        .addAttr("DaemonThreadCount")
        .addAttr("PeakThreadCount")
        .addAttr("ThreadCount")
        .addOutputWriters(gw, sw)
        .build();
    serverBuilder.addQuery(q2);

    Query q3 = Query.builder()
        .setObj("java.lang:name=ConcurrentMarkSweep,type=GarbageCollector")
        .addAttr("LastGcInfo")
        .addOutputWriters(gw, sw)
        .build();
    serverBuilder.addQuery(q3);

    Query q4 = Query.builder()
        .setObj("java.lang:name=ParNew,type=GarbageCollector")
        .addAttr("LastGcInfo")
        .addOutputWriters(gw, sw)
        .build();
    serverBuilder.addQuery(q4);
View Full Code Here

        .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")
        .addOutputWriter(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")
        .addOutputWriter(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")
        .addOutputWriter(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")
        .addOutputWriter(gw)
        .build();
    serverBuilder.addQuery(q4);

    Query q5 = Query.builder()
        .setObj("org.apache.activemq:BrokerName=localhost,Type=Broker")
        .addOutputWriter(gw)
        .build();
    serverBuilder.addQuery(q5);

    Query q6 = Query.builder()
        .setObj("java.lang:type=Memory")
        .addAttr("HeapMemoryUsage")
        .addAttr("NonHeapMemoryUsage")
        .addOutputWriter(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")
        .addOutputWriter(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")
        .addOutputWriter(gw)
        .build();
    serverBuilder.addQuery(q8);


    Query q9 = Query.builder()
        .setObj("java.lang:type=MemoryPool,name=*")
        .addOutputWriter(GraphiteWriter.builder()
            .addTypeName("name")
            .setDebugEnabled(true)
            .setHost(GW_HOST)
 
View Full Code Here

TOP

Related Classes of com.googlecode.jmxtrans.model.Query

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.