use of com.googlecode.jmxtrans.model.JmxProcess in project jmxtrans by jmxtrans.
the class Ganglia method main.
// this is an example, no need to make IP addresses configurable
@SuppressWarnings("squid:S1313")
public static void main(String[] args) throws Exception {
printer.prettyPrint(new JmxProcess(Server.builder().setHost("w2").setPort("1099").setAlias("fooalias").addQuery(Query.builder().setObj("java.lang:type=GarbageCollector,name=ConcurrentMarkSweep").addOutputWriterFactory(GangliaWriter.builder().setHost("10.0.3.16").setPort(8649).setDebugEnabled(true).setGroupName("memory").build()).build()).build()));
Injector injector = JmxTransModule.createInjector(new JmxTransConfiguration());
JmxTransformer transformer = injector.getInstance(JmxTransformer.class);
transformer.executeStandalone(new JmxProcess(Server.builder().setHost("w2").setPort("1099").setAlias("fooalias").addQuery(Query.builder().setObj("java.lang:type=GarbageCollector,name=ConcurrentMarkSweep").addOutputWriterFactory(GangliaWriter.builder().setHost("10.0.3.16").setPort(8649).setDebugEnabled(true).setGroupName("memory").build()).build()).build()));
}
use of com.googlecode.jmxtrans.model.JmxProcess 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);
}
use of com.googlecode.jmxtrans.model.JmxProcess 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);
}
use of com.googlecode.jmxtrans.model.JmxProcess in project jmxtrans by jmxtrans.
the class ConfigurationParser method parseServers.
public ImmutableList parseServers(Iterable<File> jsonFiles, boolean continueOnJsonError) throws LifecycleException {
ServerListBuilder serverListBuilder = new ServerListBuilder();
for (File jsonFile : jsonFiles) {
try {
JmxProcess process = jsonUtils.parseProcess(jsonFile);
log.debug("Loaded file: {}", jsonFile.getAbsolutePath());
serverListBuilder.add(process.getServers());
} catch (Exception ex) {
String message = "Error parsing json: " + jsonFile;
// error parsing one file should not prevent the startup of JMXTrans
if (continueOnJsonError)
log.error(message, ex);
else
throw new LifecycleException(message, ex);
}
}
return serverListBuilder.build();
}
use of com.googlecode.jmxtrans.model.JmxProcess 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");
}
Aggregations