com.yammer.metrics.reporting.GangliaReporter Java Examples

The following examples show how to use com.yammer.metrics.reporting.GangliaReporter. 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
public static void setupReporter(BlurConfiguration configuration, String reporter) {
  reporter = reporter.trim();
  try {
    TYPES type = TYPES.valueOf(reporter.trim());
    switch (type) {
    case ConsoleReporter:
      setupConsoleReporter(configuration);
      return;
    case CsvReporter:
      setupCsvReporter(configuration);
      return;
    case GangliaReporter:
      setupGangliaReporter(configuration);
      return;
    case GraphiteReporter:
      setupGraphiteReporter(configuration);
      return;
    default:
      break;
    }
  } catch (IllegalArgumentException e) {
    LOG.info("Cannot resolve reporter of type [{0}] trying to find class.", reporter);
    try {
      Class<?> reporterClazz = Class.forName(reporter);
      reflectiveSetup(reporterClazz, configuration, reporter);
    } catch (ClassNotFoundException ex) {
      LOG.error("Cannot find class [{0}]", reporter);
    }
  }
}
 
Example #2
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 #3
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 #4
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);
  }
}