Search in sources :

Example 6 with JmxTransConfiguration

use of com.googlecode.jmxtrans.cli.JmxTransConfiguration in project jmxtrans by jmxtrans.

the class HeapMemory method main.

public static void main(String[] args) throws Exception {
    Injector injector = JmxTransModule.createInjector(new JmxTransConfiguration());
    JsonUtils jsonUtils = injector.getInstance(JsonUtils.class);
    JmxProcess process = jsonUtils.parseProcess(new File("heapmemory.json"));
    new JsonPrinter(System.out).print(process);
    JmxTransformer transformer = injector.getInstance(JmxTransformer.class);
    transformer.executeStandalone(process);
}
Also used : JmxTransConfiguration(com.googlecode.jmxtrans.cli.JmxTransConfiguration) JmxTransformer(com.googlecode.jmxtrans.JmxTransformer) JsonUtils(com.googlecode.jmxtrans.util.JsonUtils) Injector(com.google.inject.Injector) JmxProcess(com.googlecode.jmxtrans.model.JmxProcess) File(java.io.File)

Example 7 with JmxTransConfiguration

use of com.googlecode.jmxtrans.cli.JmxTransConfiguration in project jmxtrans by jmxtrans.

the class Hibernate method main.

public static void main(String[] args) throws Exception {
    JmxProcess process = new JmxProcess(Server.builder().setHost("w2").setPort("1099").setAlias("w2_hibernate_1099").addQuery(Query.builder().setObj("org.hibernate.jmx:name=*,type=StatisticsService").addAttr("EntityDeleteCount").addAttr("EntityInsertCount").addAttr("EntityLoadCount").addAttr("EntityFetchCount").addAttr("EntityUpdateCount").addAttr("QueryExecutionCount").addAttr("QueryCacheHitCount").addAttr("QueryExecutionMaxTime").addAttr("QueryCacheMissCount").addAttr("QueryCachePutCount").addAttr("FlushCount").addAttr("ConnectCount").addAttr("SecondLevelCacheHitCount").addAttr("SecondLevelCacheMissCount").addAttr("SecondLevelCachePutCount").addAttr("SessionCloseCount").addAttr("SessionOpenCount").addAttr("CollectionLoadCount").addAttr("CollectionFetchCount").addAttr("CollectionUpdateCount").addAttr("CollectionRemoveCount").addAttr("CollectionRecreateCount").addAttr("SuccessfulTransactionCount").addAttr("TransactionCount").addAttr("CloseStatementCount").addAttr("PrepareStatementCount").addAttr("OptimisticFailureCount").addOutputWriterFactory(GraphiteWriter.builder().addTypeName("name").setDebugEnabled(true).setHost(GW_HOST).setPort(2003).build()).build()).build());
    printer.prettyPrint(process);
    Injector injector = JmxTransModule.createInjector(new JmxTransConfiguration());
    JmxTransformer transformer = injector.getInstance(JmxTransformer.class);
    transformer.executeStandalone(process);
}
Also used : JmxTransConfiguration(com.googlecode.jmxtrans.cli.JmxTransConfiguration) JmxTransformer(com.googlecode.jmxtrans.JmxTransformer) Injector(com.google.inject.Injector) JmxProcess(com.googlecode.jmxtrans.model.JmxProcess)

Example 8 with JmxTransConfiguration

use of com.googlecode.jmxtrans.cli.JmxTransConfiguration in project jmxtrans by jmxtrans.

the class JmxTransformerTest method startDateIsSpreadAccordingToRunPeriod.

@Test
public void startDateIsSpreadAccordingToRunPeriod() {
    JmxTransformer jmxTransformer = new JmxTransformer(null, new JmxTransConfiguration(), null, null, null, null);
    Date now = new Date();
    assertThat(jmxTransformer.computeSpreadStartDate(60)).isBetween(now, new Date(now.getTime() + MILLISECONDS.convert(60, SECONDS)));
}
Also used : JmxTransConfiguration(com.googlecode.jmxtrans.cli.JmxTransConfiguration) Date(java.util.Date) Test(org.junit.Test)

Example 9 with JmxTransConfiguration

use of com.googlecode.jmxtrans.cli.JmxTransConfiguration in project jmxtrans by jmxtrans.

the class CloudWatchWriterIT method loadingFromFile.

@Test
public void loadingFromFile() throws URISyntaxException, IOException {
    JsonUtils jsonUtils = createInjector(new JmxTransConfiguration()).getInstance(JsonUtils.class);
    File input = new File(CloudWatchWriterIT.class.getResource("/cloud-watch.json").toURI());
    JmxProcess process = jsonUtils.parseProcess(input);
    assertThat(process.getName()).isEqualTo("cloud-watch.json");
}
Also used : JmxTransConfiguration(com.googlecode.jmxtrans.cli.JmxTransConfiguration) JsonUtils(com.googlecode.jmxtrans.util.JsonUtils) JmxProcess(com.googlecode.jmxtrans.model.JmxProcess) File(java.io.File) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) IntegrationTest(com.googlecode.jmxtrans.test.IntegrationTest) Test(org.junit.Test)

Example 10 with JmxTransConfiguration

use of com.googlecode.jmxtrans.cli.JmxTransConfiguration in project jmxtrans by jmxtrans.

the class InfluxDbWriterTests method loadingFromFile.

@Test
public void loadingFromFile() throws URISyntaxException, IOException {
    File input = new File(InfluxDbWriterTests.class.getResource("/influxDB.json").toURI());
    Injector injector = JmxTransModule.createInjector(new JmxTransConfiguration());
    JsonUtils jsonUtils = injector.getInstance(JsonUtils.class);
    JmxProcess process = jsonUtils.parseProcess(input);
    assertThat(process.getName()).isEqualTo("influxDB.json");
}
Also used : JmxTransConfiguration(com.googlecode.jmxtrans.cli.JmxTransConfiguration) JsonUtils(com.googlecode.jmxtrans.util.JsonUtils) Injector(com.google.inject.Injector) JmxProcess(com.googlecode.jmxtrans.model.JmxProcess) File(java.io.File) Test(org.junit.Test)

Aggregations

JmxTransConfiguration (com.googlecode.jmxtrans.cli.JmxTransConfiguration)18 Injector (com.google.inject.Injector)15 JmxProcess (com.googlecode.jmxtrans.model.JmxProcess)12 JmxTransformer (com.googlecode.jmxtrans.JmxTransformer)10 File (java.io.File)7 JsonUtils (com.googlecode.jmxtrans.util.JsonUtils)6 Before (org.junit.Before)4 Server (com.googlecode.jmxtrans.model.Server)3 Test (org.junit.Test)3 Query (com.googlecode.jmxtrans.model.Query)2 GraphiteWriter (com.googlecode.jmxtrans.model.output.GraphiteWriter)2 StdOutWriter (com.googlecode.jmxtrans.model.output.StdOutWriter)2 ConfigurationParser (com.googlecode.jmxtrans.ConfigurationParser)1 ClassLoaderEnricher (com.googlecode.jmxtrans.classloader.ClassLoaderEnricher)1 JCommanderArgumentParser (com.googlecode.jmxtrans.cli.JCommanderArgumentParser)1 RRDToolWriter (com.googlecode.jmxtrans.model.output.RRDToolWriter)1 IntegrationTest (com.googlecode.jmxtrans.test.IntegrationTest)1 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 IOException (java.io.IOException)1 Date (java.util.Date)1