コード例 #1
0
ファイル: service.py プロジェクト: mtodd/graphite
def createAggregatorService(config):
    from carbon.events import metricReceived
    from carbon.aggregator import receiver
    from carbon.aggregator.rules import RuleManager
    from carbon.aggregator import client
    from carbon.rewrite import RewriteRuleManager
    from carbon.conf import settings

    root_service = createBaseService(config)

    # Configure application components
    metricReceived.installHandler(receiver.process)
    RuleManager.read_from(settings["aggregation-rules"])
    if exists(settings["rewrite-rules"]):
        RewriteRuleManager.read_from(settings["rewrite-rules"])

    client.connect(settings["DESTINATION_HOST"],
                   int(settings["DESTINATION_PORT"]))

    return root_service
コード例 #2
0
    def shutdown():
        if os.path.exists(options.pidfile):
            os.unlink(options.pidfile)

    atexit.register(shutdown)

    logToDir(options.logdir)

# Configure application components
metricReceived.installHandler(receiver.process)
startListener(settings.LINE_RECEIVER_INTERFACE, settings.LINE_RECEIVER_PORT,
              MetricLineReceiver)
startListener(settings.PICKLE_RECEIVER_INTERFACE,
              settings.PICKLE_RECEIVER_PORT, MetricPickleReceiver)

client.connect(settings.DESTINATION_HOST, settings.DESTINATION_PORT)
startRecording()

# Run the twisted reactor
print "%s running with pid %d" % (program, os.getpid())

if options.profile:
    import cProfile

    if exists(options.profile):
        os.unlink(options.profile)

    cProfile.run('reactor.run()', options.profile)

else:
    reactor.run()
コード例 #3
0
ファイル: carbon-aggregator.py プロジェクト: katzj/graphite
  def shutdown():
    if os.path.exists(options.pidfile):
      os.unlink(options.pidfile)

  atexit.register(shutdown)

  logToDir(options.logdir)


# Configure application components
metricReceived.installHandler(receiver.process)
startListener(settings.LINE_RECEIVER_INTERFACE, settings.LINE_RECEIVER_PORT, MetricLineReceiver)
startListener(settings.PICKLE_RECEIVER_INTERFACE, settings.PICKLE_RECEIVER_PORT, MetricPickleReceiver)

client.connect(settings.DESTINATION_HOST, settings.DESTINATION_PORT)
startRecording()


# Run the twisted reactor
print "%s running with pid %d" % (program, os.getpid())

if options.profile:
  import cProfile

  if exists(options.profile):
    os.unlink(options.profile)

  cProfile.run('reactor.run()', options.profile)

else: