Fixes following the initial rebranding.

This commit is contained in:
Tim Kuhlman 2014-04-29 17:05:22 -06:00
parent 16e9642e73
commit 33d6481721
7 changed files with 25 additions and 52 deletions

View File

@ -12,7 +12,6 @@ from config import get_version, get_system_stats
import checks.system.unix as u
import checks.system.win32 as w32
from checks.agent_metrics import CollectorMetrics
from checks.nagios import Nagios
from checks.datadog import Dogstreams
from checks.check_status import CheckStatus, CollectorStatus, EmitterStatus
from resources.processes import Processes as ResProcesses
@ -90,11 +89,6 @@ class Collector(object):
except Exception, e:
log.exception('Unable to load custom check module %s' % module_spec)
# Event Checks
self._event_checks = [
Nagios(get_hostname()),
]
# Resource Checks
self._resources_checks = [
ResProcesses(log, self.agentConfig)
@ -198,12 +192,6 @@ class Collector(object):
payload.update(dogstreamData)
# Process the event checks.
for event_check in self._event_checks:
event_data = event_check.check(log, self.agentConfig)
if event_data:
events[event_check.key] = event_data
# Resources checks
if self.os != 'windows':
has_resource = False

View File

@ -28,7 +28,7 @@ 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("Datadog Agent requires python 2.4 or later.\n")
sys.stderr.write("Mon Agent requires python 2.4 or later.\n")
sys.exit(2)
# Custom modules
@ -42,7 +42,7 @@ from jmxfetch import JMXFetch
# Constants
PID_NAME = "dd-agent"
PID_NAME = "mon-agent"
WATCHDOG_MULTIPLIER = 10
RESTART_INTERVAL = 4 * 24 * 60 * 60 # Defaults to 4 days
START_COMMANDS = ['start', 'restart', 'foreground']
@ -213,7 +213,7 @@ def main():
sys.stderr.write("Unknown command: %s\n" % command)
return 3
pid_file = PidFile('dd-agent')
pid_file = PidFile('mon-agent')
if options.clean:
pid_file.clean()

View File

@ -26,7 +26,7 @@ from util import get_os, Platform
from jmxfetch import JMXFetch, JMX_COLLECT_COMMAND
# CONSTANTS
DATADOG_CONF = "datadog.conf"
AGENT_CONF = "agent.conf"
DEFAULT_CHECK_FREQUENCY = 15 # seconds
DEFAULT_STATSD_FREQUENCY = 2 # seconds
DEFAULT_STATSD_BUCKET_SIZE = 10 # seconds
@ -86,7 +86,7 @@ def _windows_commondata_path():
def _windows_config_path():
common_data = _windows_commondata_path()
path = os.path.join(common_data, 'Datadog', DATADOG_CONF)
path = os.path.join(common_data, 'Datadog', AGENT_CONF)
if os.path.exists(path):
return path
raise PathNotFound(path)
@ -116,16 +116,16 @@ def _windows_checksd_path():
def _unix_config_path():
path = os.path.join('/etc/dd-agent', DATADOG_CONF)
path = os.path.join('/etc/mon-agent', AGENT_CONF)
if os.path.exists(path):
return path
elif os.path.exists('./%s' % DATADOG_CONF):
return './%s' % DATADOG_CONF
elif os.path.exists('./%s' % AGENT_CONF):
return './%s' % AGENT_CONF
raise PathNotFound(path)
def _unix_confd_path():
path = os.path.join('/etc/dd-agent', 'conf.d')
path = os.path.join('/etc/mon-agent', 'conf.d')
if os.path.exists(path):
return path
raise PathNotFound(path)
@ -172,8 +172,8 @@ def get_config_path(cfg_path=None, os_name=None):
# Check if there's a config stored in the current agent directory
path = os.path.realpath(__file__)
path = os.path.dirname(path)
if os.path.exists(os.path.join(path, DATADOG_CONF)):
return os.path.join(path, DATADOG_CONF)
if os.path.exists(os.path.join(path, AGENT_CONF)):
return os.path.join(path, AGENT_CONF)
# If all searches fail, exit the agent with an error
sys.stderr.write("Please supply a configuration file at %s or in the directory where the Agent is currently deployed.\n" % bad_path)
@ -197,7 +197,7 @@ def get_config(parse_args=True, cfg_path=None, options=None):
'tags': None,
'version': get_version(),
'watchdog': True,
'additional_checksd': '/etc/dd-agent/checks.d/',
'additional_checksd': '/etc/mon-agent/checks.d/',
}
dogstatsd_interval = DEFAULT_STATSD_FREQUENCY

View File

@ -6,7 +6,6 @@ import subprocess
import sys
import math
import time
import types
import urllib2
import uuid
import tempfile
@ -71,7 +70,7 @@ def get_os():
def headers(agentConfig):
# Build the request headers
return {
'User-Agent': 'Datadog Agent/%s' % agentConfig['version'],
'User-Agent': 'Mon Agent/%s' % agentConfig['version'],
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'text/html, */*',
}
@ -134,7 +133,7 @@ def get_hostname(config=None):
Tries, in order:
* agent config (datadog.conf, "hostname:")
* agent config (agent.conf, "hostname:")
* 'hostname -f' (on unix)
* socket.gethostname()
"""
@ -182,8 +181,8 @@ def get_hostname(config=None):
hostname = socket_hostname
if hostname is None:
log.critical('Unable to reliably determine host name. You can define one in datadog.conf or in your hosts file')
raise Exception('Unable to reliably determine host name. You can define one in datadog.conf or in your hosts file')
log.critical('Unable to reliably determine host name. You can define one in agent.conf or in your hosts file')
raise Exception('Unable to reliably determine host name. You can define one in agent.conf or in your hosts file')
else:
return hostname
@ -305,7 +304,7 @@ class Watchdog(object):
class PidFile(object):
""" A small helper class for pidfiles. """
PID_DIR = '/var/run/dd-agent'
PID_DIR = '/var/run/mon-agent'
def __init__(self, program, pid_dir=None):

View File

@ -42,7 +42,7 @@ source:
cp -r $(SRC)/monagent/api $(ROOT)/
cp -r $(SRC)/monagent/*.py $(ROOT)/
cp -r $(SRC)/LICENSE* $(ROOT)/
cp -r $(SRC)/datadog.conf.example $(ROOT)/
cp -r $(SRC)/agent.conf.example $(ROOT)/
find $(ROOT) -name "*.pyc" -exec rm {} \;
@ -63,7 +63,7 @@ install_full: source
ln -sf ../share/mon/agent/collector_daemon.py $(BUILD)/usr/bin/mon-collector
chmod 755 $(BUILD)/usr/bin/dogstatsd
chmod 755 $(BUILD)/usr/bin/mon-forwarder
chmod 755 $(BUILD)/var/log/mon-collector
chmod 755 $(BUILD)/usr/bin/mon-collector
# =====================
# DEBIAN

View File

@ -6,14 +6,14 @@ case "$1" in
configure)
update-rc.d mon-agent defaults
adduser --system mon-agent --disabled-login --shell /bin/sh --no-create-home --quiet
usermod -d /usr/share/datadog/agent mon-agent
usermod -d /usr/share/mon/agent mon-agent
chown root:root /etc/init.d/mon-agent
chown -R mon-agent:root /etc/dd-agent
chown -R mon-agent:root /etc/mon-agent
chown -R mon-agent:root /var/log/mon-agent
chown -R root:root /usr/share/datadog
chown -R root:root /usr/share/mon/agent
chown -h root:root /usr/bin/dogstatsd
chown -h root:root /usr/bin/dd-agent
chown -h root:root /usr/bin/dd-forwarder
chown -h root:root /usr/bin/mon-collector
chown -h root:root /usr/bin/mon-forwarder
set +e
@ -26,7 +26,7 @@ case "$1" in
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
if [ $RETVAL -eq 3 ]; then
# No datadog.conf file is present. The user is probably following
# No agent.conf file is present. The user is probably following
# the step-by-step instructions and will add the config file next.
exit 0
else

View File

@ -9,19 +9,5 @@ if [ -f /etc/init.d/mon-agent ]; then
fi
fi
# Since we now package our own supervisor config, we no longer want
# the old config to be loaded. Since supervisor automatically loads
# configs in conf.d, we have to delete the old config file.
if [ -f /etc/supervisor/conf.d/ddagent.conf ]; then
echo "Removing old configuration from system supervisord"
rm /etc/supervisor/conf.d/ddagent.conf
fi
# Previous versions of dd-agent created this file but didn't do
# anything with it.
if [ -f /etc/dd-agent/supervisor_ddagent.conf ]; then
rm /etc/dd-agent/supervisor_ddagent.conf
fi
#DEBHELPER#
exit 0