Example #1
0
    def test_server_create(self):
        server = Server()

        if getattr(self, "assertIsNotNone", False):
            self.assertIsNotNone(server)
        else:
            assert server is not None
Example #2
0
    def run(self, options):
        if setproctitle:
            setproctitle('pystatsd')
        server = Server(pct_threshold=options.pct,
                        debug=options.debug,
                        transport=options.transport,
                        graphite_host=options.graphite_host,
                        graphite_port=options.graphite_port,
                        global_prefix=options.global_prefix,
                        ganglia_host=options.ganglia_host,
                        ganglia_spoof_host=options.ganglia_spoof_host,
                        ganglia_port=options.ganglia_port,
                        gmetric_exec=options.gmetric_exec,
                        gmetric_options=options.gmetric_options,
                        flush_interval=options.flush_interval,
                        no_aggregate_counters=options.no_aggregate_counters,
                        counters_prefix=options.counters_prefix,
                        timers_prefix=options.timers_prefix,
                        expire=options.expire)

        server.serve(options.name, options.port)
Example #3
0
    def run(self, options):
        if setproctitle:
            setproctitle('pystatsd')
        server = Server(pct_threshold=options.pct,
                        debug=options.debug,
                        transport=options.transport,
                        graphite_host=options.graphite_host,
                        graphite_port=options.graphite_port,
                        global_prefix=options.global_prefix,
                        ganglia_host=options.ganglia_host,
                        ganglia_spoof_host=options.ganglia_spoof_host,
                        ganglia_port=options.ganglia_port,
                        gmetric_exec=options.gmetric_exec,
                        gmetric_options=options.gmetric_options,
                        flush_interval=options.flush_interval,
                        no_aggregate_counters=options.no_aggregate_counters,
                        counters_prefix=options.counters_prefix,
                        timers_prefix=options.timers_prefix,
                        expire=options.expire)

        server.serve(options.name, options.port)
Example #4
0
def start_graphite_proxy(config):
    global _config
    _config.clear()
    _config.update(config)
    host = _config.get("host")
    port = _config.get("port")
    if host and port:
        global _statsd
        _statsd = Server(pct_threshold=100, debug=_config.get("debug", False))

        def _start():
            try:
                _statsd.serve(graphite_host=host, graphite_port=port)
                logger.info("Metrics server started, emitting stats to graphite at %s:%s" % (host, port))
            except:
                logger.warn("Unable to start metrics UDP server at port 8125 - perhaps one is already running?")
        gevent.spawn(_start)
    else:
        logger.warn("Graphite is not configured, metrics will not be collected")
Example #5
0
def worker():
    srvr = Server(debug=True, flush_interval=500)
    srvr.serve()
Example #6
0
#!/usr/bin/env python

from pystatsd import Client, Server

sc = Client('localhost', 8125)

sc.timing('python_test.time', 500)
sc.increment('python_test.inc_int')
sc.decrement('python_test.decr_int')

srvr = Server(debug=True)
srvr.serve()
Example #7
0
#!/usr/bin/env python

from pystatsd import Client, Server
from pystatsd.backends import Console

sc = Client('localhost', 8125)

sc.timing('python_test.time', 500)
sc.increment('python_test.inc_int')
sc.decrement('python_test.decr_int')
sc.gauge('python_test.gauge', 42)

srvr = Server(debug=True, flush_interval=2000, deleteGauges=True, backends=[Console()])
srvr.serve()
Example #8
0
#!/usr/bin/env python

from pystatsd import Client, Server
from pystatsd.backends import Console

sc = Client('localhost', 8125)

sc.timing('python_test.time', 500)
sc.increment('python_test.inc_int')
sc.decrement('python_test.decr_int')
sc.gauge('python_test.gauge', 42)

srvr = Server(debug=True,
              flush_interval=2000,
              deleteGauges=True,
              backends=[Console()])
srvr.serve()