Java Code Examples for com.yammer.metrics.reporting.GangliaReporter#enable()

The following examples show how to use com.yammer.metrics.reporting.GangliaReporter#enable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReporterSetup.java    From incubator-retired-blur with Apache License 2.0 5 votes vote down vote up
private static void setupGangliaReporter(BlurConfiguration configuration) {
  long period = configuration.getLong(BLUR_SHARD_METRICS_REPORTER_PREFIX + "ganglia." + "period", 5l);
  TimeUnit unit = TimeUnit.valueOf(configuration.get(BLUR_SHARD_METRICS_REPORTER_PREFIX + "ganglia." + "unit",
      "SECONDS").toUpperCase());
  String host = configuration.get(BLUR_SHARD_METRICS_REPORTER_PREFIX + "ganglia." + "host", "localhost");
  int port = configuration.getInt(BLUR_SHARD_METRICS_REPORTER_PREFIX + "ganglia." + "port", -1);
  String prefix = configuration.get(BLUR_SHARD_METRICS_REPORTER_PREFIX + "ganglia." + "prefix", "");
  boolean compressPackageNames = configuration.getBoolean(BLUR_SHARD_METRICS_REPORTER_PREFIX + "ganglia."
      + "compressPackageNames", false);
  GangliaReporter.enable(Metrics.defaultRegistry(), period, unit, host, port, prefix, MetricPredicate.ALL,
      compressPackageNames);
}
 
Example 2
Source File: Main.java    From hbase-indexer with Apache License 2.0 5 votes vote down vote up
private void setupMetrics(Configuration conf) {
    String gangliaHost = conf.get(ConfKeys.GANGLIA_SERVER);
    if (gangliaHost != null) {
        int gangliaPort = conf.getInt(ConfKeys.GANGLIA_PORT, 8649);
        int interval = conf.getInt(ConfKeys.GANGLIA_INTERVAL, 60);
        log.info("Enabling Ganglia reporting to " + gangliaHost + ":" + gangliaPort);
        GangliaReporter.enable(interval, TimeUnit.SECONDS, gangliaHost, gangliaPort);
    }
}
 
Example 3
Source File: GangliaConfiguration.java    From occurrence with Apache License 2.0 5 votes vote down vote up
/**
 * Starts the GangliaReporter, pointing to the configured host and port.
 */
@JsonIgnore
public void start() {
  if (gangliaHost != null && gangliaPort > 0) {
    GangliaReporter.enable(1, TimeUnit.MINUTES, gangliaHost, gangliaPort);
  }
}