Package com.googlecode.jmxtrans.example

Source Code of com.googlecode.jmxtrans.example.Graphite

package com.googlecode.jmxtrans.example;

import com.googlecode.jmxtrans.model.JmxProcess;
import com.googlecode.jmxtrans.model.Query;
import com.googlecode.jmxtrans.model.Server;
import com.googlecode.jmxtrans.model.output.GraphiteWriter;
import com.googlecode.jmxtrans.util.JsonPrinter;

/**
* This class hits a Graphite server running on port 2003 and sends the memory
* usage data to it for graphing.
*
* @author jon
*/
public class Graphite {

  private static JsonPrinter printer = new JsonPrinter(System.out);

  public static void main(String[] args) throws Exception {
    printer.prettyPrint(new JmxProcess(Server.builder()
        .setHost("w2")
        .setPort("1099")
        .addQuery(Query.builder()
            .setObj("java.lang:type=GarbageCollector,name=ConcurrentMarkSweep")
            .addOutputWriter(GraphiteWriter.builder()
                .setHost("192.168.192.133")
                .setPort(2003)
                .setDebugEnabled(true)
                .setRootPrefix("jon.foo.bar")
                .build())
            .build())
        .build()));
  }

}
TOP

Related Classes of com.googlecode.jmxtrans.example.Graphite

TOP
Copyright © 2018 www.massapi.com. 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.