Ejemplo n.º 1
0
"""
    Datadog
    www.datadoghq.com
    ----
    Make sense of your IT Data

    Licensed under Simplified BSD License (see LICENSE)
    (C) Boxed Ice 2010 all rights reserved
    (C) Datadog, Inc. 2010-2013 all rights reserved
"""

# set up logging before importing any other components
from monagent.common.config import initialize_logging
from monagent.forwarder.api.mon import MonAPI

initialize_logging('forwarder')
from monagent.common.config import get_logging_config

import os
os.umask(0o22)

# Standard imports
import logging
import sys
from datetime import timedelta
import signal
from socket import gaierror, error as socket_error

# Tornado
import tornado.httpclient
import tornado.httpserver
Ejemplo n.º 2
0
import logging
import select
import socket
from monagent.common.config import initialize_logging
initialize_logging('monstatsd')
log = logging.getLogger('monstatsd')


UDP_SOCKET_TIMEOUT = 5


class Server(object):

    """
    A statsd udp server.
    """

    def __init__(self, aggregator, host, port, forward_to_host=None, forward_to_port=None):
        self.host = host
        self.port = int(port)
        self.address = (self.host, self.port)
        self.aggregator = aggregator
        self.buffer_size = 1024 * 8

        self.running = False

        self.should_forward = forward_to_host is not None

        self.forward_udp_sock = None
        # In case we want to forward every packet received to another statsd server
        if self.should_forward:
Ejemplo n.º 3
0
"""
    Datadog
    www.datadoghq.com
    ----
    Make sense of your IT Data

    Licensed under Simplified BSD License (see LICENSE)
    (C) Boxed Ice 2010 all rights reserved
    (C) Datadog, Inc. 2010-2013 all rights reserved
"""

# set up logging before importing any other components
from monagent.common.config import initialize_logging
from monagent.forwarder.api.mon import MonAPI

initialize_logging('forwarder')
from monagent.common.config import get_logging_config

import os
os.umask(0o22)

# Standard imports
import logging
import sys
from datetime import timedelta
import signal
from socket import gaierror, error as socket_error

# Tornado
import tornado.httpclient
import tornado.httpserver
Ejemplo n.º 4
0
import json
import logging
import threading
from monagent.common.check_status import MonstatsdStatus
from monagent.common.emitter import http_emitter
from monagent.common.util import plural
from monagent.common.config import initialize_logging
initialize_logging('monstatsd')
log = logging.getLogger('monstatsd')


WATCHDOG_TIMEOUT = 120
# Since we call flush more often than the metrics aggregation interval, we should
#  log a bunch of flushes in a row every so often.
FLUSH_LOGGING_PERIOD = 70
FLUSH_LOGGING_INITIAL = 10
FLUSH_LOGGING_COUNT = 5
EVENT_CHUNK_SIZE = 50


class Reporter(threading.Thread):

    """
    The reporter periodically sends the aggregated metrics to the
    server.
    """

    def __init__(self, interval, aggregator, api_host, use_watchdog=False, event_chunk_size=None):
        threading.Thread.__init__(self)
        self.interval = int(interval)
        self.finished = threading.Event()
Ejemplo n.º 5
0
#!/usr/bin/env python
'''
    Datadog
    www.datadoghq.com
    ----
    Make sense of your IT Data

    Licensed under Simplified BSD License (see LICENSE)
    (C) Boxed Ice 2010 all rights reserved
    (C) Datadog, Inc. 2010-2013 all rights reserved
'''

# set up logging before importing any other components
from monagent.common.config import get_version, initialize_logging
initialize_logging('collector')

import os
os.umask(0o22)

# Core modules
import logging
import os.path
import signal
import sys
import time
import glob

# Check we're not using an old version of Python. We need 2.4 above because some modules (like subprocess)
# were only introduced in 2.4.
if int(sys.version_info[1]) <= 3:
    sys.stderr.write("Mon Agent requires python 2.4 or later.\n")