Rename package to monasca-agent.

Change-Id: I713954bdb7ae1cacb98d0ed43bb90be6f1099964
This commit is contained in:
gary-hessler 2014-07-17 09:17:30 -06:00
parent 6317088fe3
commit a60555cf32
68 changed files with 242 additions and 312 deletions

5
.gitignore vendored
View File

@ -4,11 +4,8 @@
.settings
*.pyc
agent.conf
Monitoring_Agent.egg-info
build
dist
mon-agent_4.2.0-0_all.deb
artifacts
root
mon_agent.egg-info
.tox/
.tox/

View File

@ -1,66 +1,6 @@
Change Log
=======
# 1.0.7 / 2014-07-14
# 1.0.0 / 2014-07-16
## Changes
- Added additional support for Ceilometer, Neutron, Keystone, and Glance auto-configuration
- Increased PEP8 compliance and Python 3 compatibility
- Fixed Laconic filter import
- Fixed mon-agent not (re)starting on boot
- Fixed process plugin not returning data
- Keystone code cleanup
- Fixed one minor bug in MonAPI class
- Fixed __init__ in mon-setup
# 1.0.6 / 2014-06-19
## Changes
- Improved token handling in forwarder and http_status check.
- Updated the agent to allow plugins to override the default dimensions in the plugin config
- Added detection and auto-configuration of Nova, Swift and Cinder OpenStack processes and APIs
- Fixed crash in collector where plugins take more than 120 seconds to run
- Changed "active" plugins http_check, host_alive, and nagios_wrapper to use ServiceCheck class for threadpool support
# 1.0.5 / 2014-06-12
## Changes
- Initial support for mon-setup
- Changed project_id to project_name in the configuration
# 1.0.4 / 2014-06-09
## Changes
- host_alive and nagios_wrapper plugins can now support separate dimensions per instance
# 1.0.3 / 2014-05-28
## Changes
- Fixed http_check does not handle exception for unroutable network
- Fixed forwarder crashing with missing or malformed dimensions
- Removed deprecated "mon_" prefix from http_check metrics
- Fixed request format for Keystone token retrieval
- Changed supervisor to run as the mon-agent user, not root
# 1.0.2 / 2014-05-19
## Changes
- Integrated mon_client library
- Fixed bug in keystone processing
# 1.0.1 / 2014-05-12
## Changes
- Fixed subsequent dimensions missing in certain plugins
# 1.0.0 / 2014-04-28
## Changes
- Fork from Datadog agent 4.2.0
- removed most datadog branding
- removed embeded code
- Cleaned up name of collector/forwarder
- remove pup
- some pep8 changes, lots to go
- removed custom emitters
- removed data dog emitter, insert initial mon emitter
- collector only sends to forwarder now (previously you could optionally have it bypass the forwarder and send to datadogs)
- moved non-code files to root of project
- removed rpm build
- Rearranged code so things are more logically grouped
- Setup a standard message format for communicating to the forwarder
- Converted from tags to dimensions throughout the collector
- Rebranded dogstatsd and converted to dimensions
- New package renamed and moved over to StackForge from https://github.com/hpcloud-mon/mon-agent

View File

@ -1,16 +1,16 @@
#mon-agent
#monasca-agent
The Monitoring Agent is a system for gathering metrics and sending them to
The Monasca Monitoring Agent is a system for gathering metrics and sending them to
the Monitoring API. In its basic configuration, the Agent collects metrics
on various aspects of the host system, but may be extended with Python-based
plugins or statsd-compatible clients. Many plugins are included, and some of
these may be used to gather metrics against remote systems and services as well.
For information on deploying and using the Monitoring Agent, please see the
For information on deploying and using the Monasca Monitoring Agent, please see the
[Wiki](https://github.com/hpcloud-mon/mon-agent/wiki)
# Simple Installation
- `pip install mon-agent`
- Run configuration `mon-setup -u me -p pass --project_name myproject -s mini-mon --keystone_url https://keystone --mon_url https://mon-api`
- `pip install monasca-agent`
- Run configuration `monasca-setup -u me -p pass --project_name myproject -s mini-mon --keystone_url https://keystone --monasca_url https://mon-api`
Copyright (c) 2014 Hewlett-Packard Development Company, L.P.

View File

@ -1,7 +1,7 @@
[Api]
# Monitoring API URL: URL for the monitoring API
# Example: https://region-a.geo-1.monitoring.hpcloudsvc.com/v1.1/metrics
url: {args.mon_url}
url: {args.monasca_url}
# Keystone Username
username: {args.username}
# Keystone Password
@ -33,7 +33,7 @@ use_mount: no
# listen_port: 17123
# Additional directory to look for checks
# additional_checksd: /etc/mon-agent/checks.d/
# additional_checksd: /etc/monasca/agent/checks.d/
# Allow non-local traffic to this Agent
# This is required when using this Agent as a proxy for other Agents
@ -117,9 +117,9 @@ monstatsd_port : 8125
log_level: INFO
collector_log_file: /var/log/mon-agent/collector.log
forwarder_log_file: /var/log/mon-agent/forwarder.log
monstatsd_log_file: /var/log/mon-agent/monstatsd.log
collector_log_file: /var/log/monasca/agent/collector.log
forwarder_log_file: /var/log/monasca/agent/forwarder.log
monstatsd_log_file: /var/log/monasca/agent/monstatsd.log
# if syslog is enabled but a host and port are not set, a local domain socket
# connection will be attempted

View File

@ -149,8 +149,9 @@ class ProcessCheck(AgentCheck):
read_bytes += io_counters.read_bytes
write_bytes += io_counters.write_bytes
except psutil.AccessDenied:
self.log.debug('mon-agent user does not have access ' +
'to I/O counters for process %d: %s'
self.log.debug('monasca-agent user does not have ' +
'access to I/O counters for process' +
' %d: %s'
% (pid, p.name))
read_count = None
write_count = None
@ -163,7 +164,7 @@ class ProcessCheck(AgentCheck):
pass
if got_denied:
self.warning("The Monitoring Agent was denied access",
self.warning("The Monitoring Agent was denied access " +
"when trying to get the number of file descriptors")
# Memory values are in Byte

View File

@ -1,14 +1,4 @@
#!/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
@ -28,7 +18,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("Mon Agent requires python 2.4 or later.\n")
sys.stderr.write("Monasca Agent requires python 2.4 or later.\n")
sys.exit(2)
# Custom modules
@ -38,11 +28,11 @@ from monagent.common.config import get_config, get_parsed_args, load_check_direc
from monagent.common.daemon import Daemon, AgentSupervisor
from monagent.common.emitter import http_emitter
from monagent.common.util import Watchdog, PidFile, get_os
from jmxfetch import JMXFetch
from jmxfetch import JMXFetch, JMX_LIST_COMMANDS
# Constants
PID_NAME = "mon-agent"
PID_NAME = "monasca-agent"
WATCHDOG_MULTIPLIER = 10
RESTART_INTERVAL = 4 * 24 * 60 * 60 # Defaults to 4 days
START_COMMANDS = ['start', 'restart', 'foreground']
@ -216,7 +206,7 @@ def main():
sys.stderr.write("Unknown command: %s\n" % command)
return 3
pid_file = PidFile('mon-agent')
pid_file = PidFile('monasca-agent')
if options.clean:
pid_file.clean()
@ -303,7 +293,6 @@ def main():
return 1
elif 'jmx' == command:
from collector.jmxfetch import JMX_LIST_COMMANDS, JMXFetch
if len(args) < 2 or args[1] not in JMX_LIST_COMMANDS.keys():
print "#" * 80
@ -314,7 +303,7 @@ def main():
print "You have to specify one of the following command:"
for command, desc in JMX_LIST_COMMANDS.iteritems():
print " - %s [OPTIONAL: LIST OF CHECKS]: %s" % (command, desc)
print "Example: sudo /etc/init.d/mon-agent jmx list_matching_attributes tomcat jmx solr"
print "Example: sudo /etc/init.d/monasca-agent jmx list_matching_attributes tomcat jmx solr"
print "\n"
else:

View File

@ -33,6 +33,8 @@ DEFAULT_CHECK_FREQUENCY = 15 # seconds
DEFAULT_STATSD_FREQUENCY = 2 # seconds
DEFAULT_STATSD_BUCKET_SIZE = 10 # seconds
LOGGING_MAX_BYTES = 5 * 1024 * 1024
DEFAULT_CONFIG_DIR = '/etc/monasca/agent'
DEFAULT_LOG_DIR = '/var/log/monasca/agent'
log = logging.getLogger(__name__)
windows_file_handler_added = False
@ -118,7 +120,7 @@ def _windows_checksd_path():
def _unix_config_path():
path = os.path.join('/etc/mon-agent', AGENT_CONF)
path = os.path.join(DEFAULT_CONFIG_DIR, AGENT_CONF)
if os.path.exists(path):
return path
elif os.path.exists('./%s' % AGENT_CONF):
@ -127,7 +129,7 @@ def _unix_config_path():
def _unix_confd_path():
path = os.path.join('/etc/mon-agent', 'conf.d')
path = os.path.join(DEFAULT_CONFIG_DIR, 'conf.d')
if os.path.exists(path):
return path
raise PathNotFound(path)
@ -200,7 +202,7 @@ def get_config(parse_args=True, cfg_path=None, options=None):
'listen_port': None,
'version': get_version(),
'watchdog': True,
'additional_checksd': '/etc/mon-agent/checks_d/',
'additional_checksd': DEFAULT_CONFIG_DIR + '/checks_d/',
}
monstatsd_interval = DEFAULT_STATSD_FREQUENCY
@ -366,7 +368,7 @@ def set_win32_cert_path():
crt_path = os.path.join(prog_path, 'ca-certificates.crt')
else:
cur_path = os.path.dirname(__file__)
crt_path = os.path.join(cur_path, 'packaging', 'mon-agent', 'win32',
crt_path = os.path.join(cur_path, 'packaging', 'monasca-agent', 'win32',
'install_files', 'ca-certificates.crt')
import tornado.simple_httpclient
log.info("Windows certificate path: %s" % crt_path)
@ -681,10 +683,10 @@ def get_logging_config(cfg_path=None):
if system_os != 'windows':
logging_config = {
'log_level': None,
'collector_log_file': '/var/log/mon-agent/collector.log',
'forwarder_log_file': '/var/log/mon-agent/forwarder.log',
'monstatsd_log_file': '/var/log/mon-agent/monstatsd.log',
'jmxfetch_log_file': '/var/log/mon-agent/jmxfetch.log',
'collector_log_file': DEFAULT_LOG_DIR + '/collector.log',
'forwarder_log_file': DEFAULT_LOG_DIR + '/forwarder.log',
'monstatsd_log_file': DEFAULT_LOG_DIR + '/monstatsd.log',
'jmxfetch_log_file': DEFAULT_LOG_DIR + '/jmxfetch.log',
'log_to_event_viewer': False,
'log_to_syslog': True,
'syslog_host': None,

View File

@ -234,7 +234,7 @@ class PidFile(object):
""" A small helper class for pidfiles. """
PID_DIR = '/var/run/mon-agent'
PID_DIR = '/var/run/monasca-agent'
def __init__(self, program, pid_dir=None):
self.pid_file = "%s.pid" % program

View File

@ -1 +1 @@
__version__ = '1.0.7'
__version__ = '1.0.0'

View File

@ -1,6 +1,6 @@
import logging
from monclient import exc as exc, client
from monascaclient import exc as exc, client
from monagent.common.keystone import Keystone
from monagent.common.util import get_hostname
@ -64,7 +64,7 @@ class MonAPI(object):
# with the data
if response.status_code == 401:
# Get a new token/client and retry
self.mon_client = self.get_client()
self.mon_client.replace_token(self.keystone.refresh_token())
continue
else:
error_msg = "Successful web service call but there" + \

View File

@ -1,6 +1,6 @@
# mon-setup
# monasca-setup
This script will detect running services and configure mon-agent to watch them as well as starting the agent and
This script will detect running services and configure monasca-agent to watch them as well as starting the agent and
configuring it to start up on boot.

View File

@ -5,7 +5,7 @@ import collections
class Plugins(collections.defaultdict):
"""A container for the plugin configurations used by the mon-agent.
"""A container for the plugin configurations used by the monasca-agent.
This is essentially a defaultdict(dict) but put into a class primarily to make the interface clear, also
to add a couple of helper methods.
Each plugin config is stored with the key being its config name (excluding .yaml).

View File

@ -1,12 +1,10 @@
"""Classes for detection of running resources to be monitored.
Detection classes should be platform independent
"""
from monclient import client
class Plugin(object):
"""Abstract class implemented by the mon-agent plugin detection classes
"""Abstract class implemented by the monasca-agent plugin detection classes
"""
# todo these should include dependency detection

View File

@ -10,7 +10,7 @@ class Postfix(Plugin):
"""If postfix is running install the default config
"""
# todo this is is disabled as postfix requires passwordless sudo for the
# mon-agent user, a bad practice
# monasca-agent user, a bad practice
def _detect(self):
"""Run detection, set self.available True if the service is detected."""

View File

@ -10,7 +10,7 @@ log = logging.getLogger(__name__)
class ServicePlugin(Plugin):
"""Base class implemented by the mon-agent plugin detection classes
"""Base class implemented by the monasca-agent plugin detection classes
for OpenStack Services
"""

View File

@ -12,7 +12,9 @@ import sys
import yaml
import agent_config
from detection.plugins import kafka, mon, mysql, network, zookeeper, nova, glance, cinder, neutron, swift, ceilometer, keystone
from detection.plugins import kafka, mon, mysql, network, zookeeper
from detection.plugins import nova, glance, cinder, neutron, swift
from detection.plugins import keystone, ceilometer
from service import sysv
# List of all detection plugins to run
@ -36,11 +38,11 @@ def main(argv=None):
parser.add_argument(
'-s', '--service', help="Service this node is associated with.", required=True)
parser.add_argument('--keystone_url', help="Keystone url", required=True)
parser.add_argument('--mon_url', help="Mon API url", required=True)
parser.add_argument('--config_dir', help="Configuration directory", default='/etc/mon-agent')
parser.add_argument('--log_dir', help="mon-agent log directory", default='/var/log/mon-agent')
parser.add_argument('--monasca_url', help="Monasca API url", required=True)
parser.add_argument('--config_dir', help="Configuration directory", default='/etc/monasca/agent')
parser.add_argument('--log_dir', help="monasca-agent log directory", default='/var/log/monasca/agent')
parser.add_argument(
'--template_dir', help="Alternative template directory", default='/usr/local/share/mon/agent')
'--template_dir', help="Alternative template directory", default='/usr/local/share/monasca/agent')
parser.add_argument('--headless', help="Run in a non-interactive mode", action="store_true")
parser.add_argument('--overwrite',
help="Overwrite existing plugin configuration." +
@ -49,7 +51,7 @@ def main(argv=None):
parser.add_argument('--skip_enable', help="By default the service is enabled," +
" which requires the script run as root. Set this to skip that step.",
action="store_true")
parser.add_argument('--user', help="User name to run mon-agent as", default='mon-agent')
parser.add_argument('--user', help="User name to run monasca-agent as", default='monasca-agent')
parser.add_argument('-v', '--verbose', help="Verbose Output", action="store_true")
args = parser.parse_args()
@ -63,7 +65,8 @@ def main(argv=None):
# Service enable, includes setup of users/config directories so must be
# done before configuration
agent_service = OS_SERVICE_MAP[detected_os](os.path.join(args.template_dir, 'mon-agent.init'), args.config_dir,
agent_service = OS_SERVICE_MAP[detected_os](os.path.join(args.template_dir, 'monasca-agent.init'),
args.config_dir,
args.log_dir, username=args.user)
if not args.skip_enable:
agent_service.enable()

View File

@ -1,4 +1,4 @@
"""Classes implementing different methods for running mon-agent on startup as well as starting the process immediately
"""Classes implementing different methods for running monasca-agent on startup as well as starting the process immediately
"""
import psutil
@ -7,40 +7,40 @@ class Service(object):
"""Abstract base class implementing the interface for various service types."""
def __init__(self, config_dir, log_dir, name='mon-agent'):
def __init__(self, config_dir, log_dir, name='monasca-agent'):
self.config_dir = config_dir
self.log_dir = log_dir
self.name = name
def enable(self):
"""Sets mon-agent to start on boot.
"""Sets monasca-agent to start on boot.
Generally this requires running as super user
"""
raise NotImplementedError
def start(self, restart=True):
"""Starts mon-agent
"""Starts monasca-agent
If the agent is running and restart is True, restart
"""
raise NotImplementedError
def stop(self):
"""Stops mon-agent
"""Stops monasca-agent
"""
raise NotImplementedError
def is_enabled(self):
"""Returns True if mon-agent is setup to start on boot, false otherwise
"""Returns True if monasca-agent is setup to start on boot, false otherwise
"""
raise NotImplementedError
@staticmethod
def is_running():
"""Returns True if mon-agent is running, false otherwise
"""Returns True if monasca-agent is running, false otherwise
"""
# Looking for the supervisor process not the individual components
for process in psutil.process_iter():
if '/etc/mon-agent/supervisor.conf' in process.cmdline():
if '/etc/monasca/agent/supervisor.conf' in process.cmdline():
return True
return False

View File

@ -13,7 +13,7 @@ log = logging.getLogger(__name__)
class SysV(Service):
def __init__(self, init_template, config_dir, log_dir, name='mon-agent', username='mon-agent'):
def __init__(self, init_template, config_dir, log_dir, name='monasca-agent', username='monasca-agent'):
"""Setup this service with the given init template"""
super(SysV, self).__init__(config_dir, log_dir, name)
self.init_script = '/etc/init.d/%s' % self.name
@ -21,10 +21,10 @@ class SysV(Service):
self.username = username
def enable(self):
"""Sets mon-agent to start on boot.
"""Sets monasca-agent to start on boot.
Generally this requires running as super user
"""
# Create mon-agent user/group if needed
# Create monasca-agent user/group if needed
try:
user = pwd.getpwnam(self.username)
except KeyError:
@ -35,7 +35,7 @@ class SysV(Service):
# todo log dir is hardcoded
for path in (self.log_dir, self.config_dir, '%s/conf.d' % self.config_dir):
if not os.path.exists(path):
os.mkdir(path, 0o755)
os.makedirs(path, 0o755)
os.chown(path, 0, user.pw_gid)
# the log dir needs to be writable by the user
os.chown(self.log_dir, user.pw_uid, user.pw_gid)
@ -46,14 +46,14 @@ class SysV(Service):
os.chmod(self.init_script, 0o755)
for runlevel in ['2', '3', '4', '5']:
link_path = '/etc/rc%s.d/S10mon-agent' % runlevel
link_path = '/etc/rc%s.d/S10monasca-agent' % runlevel
if not os.path.exists(link_path):
os.symlink(self.init_script, link_path)
log.info('Enabled {0} service via SysV init script'.format(self.name))
def start(self, restart=True):
"""Starts mon-agent
"""Starts monasca-agent
If the agent is running and restart is True, restart
"""
if not self.is_enabled():
@ -65,7 +65,7 @@ class SysV(Service):
return True
def stop(self):
"""Stops mon-agent
"""Stops monasca-agent
"""
if not self.is_enabled():
log.error('The service is not enabled')
@ -76,12 +76,12 @@ class SysV(Service):
return True
def is_enabled(self):
"""Returns True if mon-agent is setup to start on boot, false otherwise
"""Returns True if monasca-agent is setup to start on boot, false otherwise
"""
if not os.path.exists(self.init_script):
return False
if len(glob('/etc/rc?.d/S??mon-agent')) > 0:
if len(glob('/etc/rc?.d/S??monasca-agent')) > 0:
return True
else:
return False

View File

@ -37,7 +37,7 @@ source:
cp -r $(SRC)/monagent $(ROOT)/
cp -r $(SRC)/conf.d $(ROOT)/
cp -r $(SRC)/LICENSE* $(ROOT)/
cp -r $(SRC)/agent.conf.example $(ROOT)/
cp -r $(SRC)/agent.conf.template $(ROOT)/
find $(ROOT) -name "*.pyc" -exec rm {} \;
@ -45,20 +45,21 @@ source:
# the build directory.
install_full: source
mkdir -p $(BUILD)
mkdir -p $(BUILD)/usr/share/mon/agent
mkdir -p $(BUILD)/etc/mon-agent
mkdir -p $(BUILD)/etc/mon-agent/conf.d
mkdir -p $(BUILD)/usr/monasca/agent
mkdir -p $(BUILD)/etc/monasca/agent
mkdir -p $(BUILD)/etc/monasca/agent/conf.d
mkdir -p $(BUILD)/usr/bin
mkdir -p $(BUILD)/var/log/mon-agent
mkdir -p $(BUILD)/var/log/monasca/agent
mkdir -p $(BUILD)/usr/share/monasca/agent
# Install the source to usr/share
cp -r $(ROOT)/* $(BUILD)/usr/share/mon/agent/
cp -r $(ROOT)/* $(BUILD)/usr/share/monasca/agent
# Install the common executables.
ln -sf ../share/mon/agent/monagent/monstatsd/daemon.py $(BUILD)/usr/bin/monstatsd
ln -sf ../share/mon/agent/monagent/forwarder/daemon.py $(BUILD)/usr/bin/mon-forwarder
ln -sf ../share/mon/agent/monagent/collector/daemon.py $(BUILD)/usr/bin/mon-collector
chmod 755 $(BUILD)/usr/bin/monstatsd
chmod 755 $(BUILD)/usr/bin/mon-forwarder
chmod 755 $(BUILD)/usr/bin/mon-collector
ln -sf ../share/monasca/agent/monagent/monstatsd/daemon.py $(BUILD)/usr/bin/monasca-statsd
ln -sf ../share/monasca/agent/monagent/forwarder/daemon.py $(BUILD)/usr/bin/monasca-forwarder
ln -sf ../share/monasca/agent/monagent/collector/daemon.py $(BUILD)/usr/bin/monasca-collector
chmod 755 $(BUILD)/usr/bin/monasca-statsd
chmod 755 $(BUILD)/usr/bin/monasca-forwarder
chmod 755 $(BUILD)/usr/bin/monasca-collector
# =====================
# DEBIAN
@ -66,18 +67,18 @@ install_full: source
install_deb: install_full
mkdir -p $(BUILD)/etc/init.d
cp mon-agent-deb/mon-agent.init $(BUILD)/etc/init.d/mon-agent
chmod 755 $(BUILD)/etc/init.d/mon-agent
cp monasca-agent-deb/monasca-agent.init $(BUILD)/etc/init.d/monasca-agent
chmod 755 $(BUILD)/etc/init.d/monasca-agent
# Install supervisor config.
cp mon-agent-deb/supervisor.conf $(BUILD)/etc/mon-agent/supervisor.conf
cp monasca-agent-deb/supervisor.conf $(BUILD)/etc/monasca/agent/supervisor.conf
# Make the mon agent debian package that includes supervisor, the forwarder
# Make the monasca agent debian package that includes supervisor, the forwarder
# etc.
mon_agent_deb: clean install_deb
FPM_EDITOR="echo 'Replaces: mon-agent (<= $(VERSION)), mon-agent, mon-agent-base (<= $(VERSION)), mon-agent-lib' >>" \
monasca_agent_deb: clean install_deb
FPM_EDITOR="echo 'Replaces: monasca-agent (<= $(VERSION)), monasca-agent, monasca-agent-base (<= $(VERSION)), monasca-agent-lib' >>" \
$(FPM_BUILD) -t deb \
-n mon-agent \
-n monasca-agent \
-d "python (>= 2.6)" \
-d "python-tornado (>= 2.3)" \
-d "supervisor (>= 3.0)" \
@ -89,24 +90,23 @@ $(FPM_BUILD) -t deb \
-d "python-httplib2" \
-d "python-ntplib" \
-d "python-yaml" \
-d "python-monclient" \
--post-install mon-agent-deb/postinst \
--post-uninstall mon-agent-deb/postrm \
--pre-uninstall mon-agent-deb/prerm \
-d "python-monascaclient" \
--post-install monasca-agent-deb/postinst \
--post-uninstall monasca-agent-deb/postrm \
--pre-uninstall monasca-agent-deb/prerm \
.
#===================
# JENKINS TARGETS
#===================
deb:
mkdir -p ../artifacts
make mon_agent_deb
make monasca_agent_deb
cp *.deb ../artifacts
installdeb:
dpkg -i --force-confdef --force-confnew `ls -t ../artifacts/mon-agent_*.deb | head -1`
dpkg -i --force-confdef --force-confnew `ls -t ../artifacts/monasca-agent_*.deb | head -1`
deb_repo:
rm Packages.gz

View File

@ -1,47 +0,0 @@
#! /bin/bash
set -e
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/mon/agent mon-agent
chown root:root /etc/init.d/mon-agent
chown -R mon-agent:root /etc/mon-agent
chown -R mon-agent:root /var/log/mon-agent
chown -R root:root /usr/share/mon/agent
chown -h root:root /usr/bin/monstatsd
chown -h root:root /usr/bin/mon-collector
chown -h root:root /usr/bin/mon-forwarder
set +e
if which invoke-rc.d >/dev/null 2>&1; then
invoke-rc.d mon-agent restart
else
/etc/init.d/mon-agent restart
fi
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
if [ $RETVAL -eq 3 ]; then
# No agent.conf file is present. The user is probably following
# the step-by-step instructions and will add the config file next.
echo "No /etc/mon-agent/agent.conf found, exiting"
exit 0
else
exit $?
fi
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
;;
esac
#DEBHELPER#
exit 0

View File

@ -1,9 +0,0 @@
#! /bin/bash
set -e
if [ "$1" = purge ]; then
update-rc.d mon-agent remove
deluser mon-agent
fi
exit 0

View File

@ -1,13 +0,0 @@
#! /bin/bash
set -e
if [ -f /etc/init.d/mon-agent ]; then
if which invoke-rc.d >/dev/null 2>&1; then
invoke-rc.d mon-agent stop || true
else
/etc/init.d/mon-agent stop || true
fi
fi
#DEBHELPER#
exit 0

View File

@ -1,8 +0,0 @@
#! /bin/sh
if which invoke-rc.d >/dev/null 2>&1; then
invoke-rc.d mon-agent stop || true
else
/etc/init.d/mon-agent stop || true
fi

View File

@ -1,9 +1,9 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: mon-agent
# Short-Description: Start and start mon-agent
# Description: mon-agent is the monitoring Agent component OpenStack Monitoring
# Provides: monasca-agent
# Short-Description: Start and start monasca-agent
# Description: monasca-agent is the monitoring Agent component OpenStack Monitoring
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
@ -12,19 +12,19 @@
. /lib/lsb/init-functions
PATH=$PATH:/sbin # add the location of start-stop-daemon on Debian
export PYTHONPATH=$PYTHONPATH:/usr/share/mon/agent/
export PYTHONPATH=$PYTHONPATH:/usr/monasca/agent/
AGENTPATH="/usr/local/bin/mon-collector"
AGENTCONF="/etc/mon-agent/agent.conf"
MONSTATSDPATH="/usr/local/bin/monstatsd"
AGENTUSER="mon-agent"
FORWARDERPATH="/usr/local/bin/mon-forwarder"
NAME="mon-agent"
DESC="Monitoring Agent"
AGENT_PID_PATH="/var/run/mon-agent.pid"
SUPERVISOR_PIDFILE="/var/run/mon-agent-supervisord.pid"
SUPERVISOR_FILE="/etc/mon-agent/supervisor.conf"
SUPERVISOR_SOCK="/var/tmp/mon-agent-supervisor.sock"
AGENTPATH="/usr/local/bin/monasca-collector"
AGENTCONF="/etc/monasca/agent/agent.conf"
MONSTATSDPATH="/usr/local/bin/monasca-statsd"
AGENTUSER="monasca-agent"
FORWARDERPATH="/usr/local/bin/monasca-forwarder"
NAME="monasca-agent"
DESC="Monasca Monitoring Agent"
AGENT_PID_PATH="/var/run/monasca-agent.pid"
SUPERVISOR_PIDFILE="/var/run/monasca-agent-supervisord.pid"
SUPERVISOR_FILE="/etc/monasca/agent/supervisor.conf"
SUPERVISOR_SOCK="/var/tmp/monasca-agent-supervisor.sock"
SUPERVISORD=$(which supervisord)
# This script is considered a configuration file and will not be
@ -81,7 +81,7 @@ case "$1" in
su $AGENTUSER -c "$AGENTPATH configcheck" > /dev/null
if [ $? -ne 0 ]; then
log_daemon_msg "Invalid check configuration. Please run sudo /etc/init.d/mon-agent configtest for more details."
log_daemon_msg "Invalid check configuration. Please run sudo /etc/init.d/monasca-agent configtest for more details."
log_daemon_msg "Resuming starting process."
fi
@ -122,7 +122,7 @@ case "$1" in
info)
shift # Shift 'info' out of args so we can pass any
# addtional options to the real command
# (right now only mon-agent supports additional flags)
# (right now only monasca-agent supports additional flags)
su $AGENTUSER -c "$AGENTPATH info $@"
COLLECTOR_RETURN=$?
su $AGENTUSER -c "$MONSTATSDPATH info"

View File

@ -0,0 +1,47 @@
#! /bin/bash
set -e
case "$1" in
configure)
update-rc.d monasca-agent defaults
adduser --system monasca-agent --disabled-login --shell /bin/sh --no-create-home --quiet
usermod -d /usr/share/monasca/agent monasca-agent
chown root:root /etc/init.d/monasca-agent
chown -R monasca-agent:root /etc/monasca/agent
chown -R monasca-agent:root /var/log/monasca/agent
chown -R root:root /usr/share/monasca/agent
chown -h root:root /usr/bin/monasca-statsd
chown -h root:root /usr/bin/monasca-collector
chown -h root:root /usr/bin/monasca-forwarder
set +e
if which invoke-rc.d >/dev/null 2>&1; then
invoke-rc.d monasca-agent restart
else
/etc/init.d/monasca-agent restart
fi
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
if [ $RETVAL -eq 3 ]; then
# No agent.conf file is present. The user is probably following
# the step-by-step instructions and will add the config file next.
echo "No /etc/monasca/agent/agent.conf found, exiting"
exit 0
else
exit $?
fi
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
;;
esac
#DEBHELPER#
exit 0

View File

@ -0,0 +1,9 @@
#! /bin/bash
set -e
if [ "$1" = purge ]; then
update-rc.d monasca-agent remove
deluser monasca-agent
fi
exit 0

View File

@ -0,0 +1,13 @@
#! /bin/bash
set -e
if [ -f /etc/init.d/monasca-agent ]; then
if which invoke-rc.d >/dev/null 2>&1; then
invoke-rc.d monasca-agent stop || true
else
/etc/init.d/monasca-agent stop || true
fi
fi
#DEBHELPER#
exit 0

View File

@ -0,0 +1,8 @@
#! /bin/sh
if which invoke-rc.d >/dev/null 2>&1; then
invoke-rc.d monasca-agent stop || true
else
/etc/init.d/monasca-agent stop || true
fi

View File

@ -1,8 +1,8 @@
[supervisorctl]
serverurl = unix:///var/tmp/mon-agent-supervisor.sock
serverurl = unix:///var/tmp/monasca-agent-supervisor.sock
[unix_http_server]
file=/var/tmp/mon-agent-supervisor.sock
file=/var/tmp/monasca-agent-supervisor.sock
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
@ -11,37 +11,37 @@ supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
minfds = 1024
minprocs = 200
loglevel = info
logfile = /var/log/mon-agent/supervisord.log
logfile = /var/log/monasca/agent/supervisord.log
logfile_maxbytes = 50MB
nodaemon = false
pidfile = /var/run/mon-agent-supervisord.pid
pidfile = /var/run/monasca-agent-supervisord.pid
logfile_backups = 10
environment=PYTHONPATH='/usr/share/mon/agent:/usr/share/mon/agent',LANG=POSIX
environment=PYTHONPATH='/usr/share/monasca/agent',LANG=POSIX
[program:collector]
command=/usr/bin/mon-collector foreground
command=/usr/bin/monasca-collector foreground
stdout_logfile=NONE
stderr_logfile=NONE
priority=999
startsecs=2
user=mon-agent
environment=LC_ALL=POSIX,PYTHONPATH='/usr/share/mon/agent:$PYTHONPATH'
user=monasca-agent
environment=LC_ALL=POSIX,PYTHONPATH='/usr/share/monasca/agent:$PYTHONPATH'
[program:forwarder]
command=/usr/bin/mon-forwarder
command=/usr/bin/monasca-forwarder
stdout_logfile=NONE
stderr_logfile=NONE
startsecs=3
priority=998
user=mon-agent
user=monasca-agent
[program:monstatsd]
command=/usr/bin/monstatsd
command=/usr/bin/monasca-statsd
stdout_logfile=NONE
stderr_logfile=NONE
startsecs=3
priority=998
user=mon-agent
user=monasca-agent
[group:mon-agent]
[group:monasca-agent]
programs=forwarder,collector,monstatsd

View File

@ -1,9 +1,9 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: mon-agent
# Short-Description: Start and start mon-agent
# Description: mon-agent is the monitoring Agent component OpenStack Monitoring
# Provides: monasca-agent
# Short-Description: Start and start monasca-agent
# Description: monasca-agent is the monitoring Agent component OpenStack Monitoring
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
@ -14,17 +14,17 @@
PATH=$PATH:/usr/local/bin # supervisord might live here
PATH=$PATH:/sbin # add the location of start-stop-daemon on Debian
AGENTPATH="/usr/local/bin/mon-collector"
AGENTCONF="/etc/mon-agent/agent.conf"
MONSTATSDPATH="/usr/local/bin/monstatsd"
AGENTUSER="mon-agent"
FORWARDERPATH="/usr/local/bin/mon-forwarder"
NAME="mon-agent"
DESC="Monitoring Agent"
AGENT_PID_PATH="/var/tmp/mon-agent.pid"
SUPERVISOR_PIDFILE="/var/tmp/mon-agent-supervisord.pid"
SUPERVISOR_FILE="/etc/mon-agent/supervisor.conf"
SUPERVISOR_SOCK="/var/tmp/mon-agent-supervisor.sock"
AGENTPATH="/usr/local/bin/monasca-collector"
AGENTCONF="/etc/monasca/agent/agent.conf"
MONSTATSDPATH="/usr/local/bin/monasca-statsd"
AGENTUSER="monasca-agent"
FORWARDERPATH="/usr/local/bin/monasca-forwarder"
NAME="monasca-agent"
DESC="Monasca Monitoring Agent"
AGENT_PID_PATH="/var/tmp/monasca-agent.pid"
SUPERVISOR_PIDFILE="/var/tmp/monasca-agent-supervisord.pid"
SUPERVISOR_FILE="/etc/monasca/agent/supervisor.conf"
SUPERVISOR_SOCK="/var/tmp/monasca-agent-supervisor.sock"
SUPERVISORD=$(which supervisord)
# This script is considered a configuration file and will not be
@ -81,7 +81,7 @@ case "$1" in
su $AGENTUSER -c "$AGENTPATH configcheck" > /dev/null
if [ $? -ne 0 ]; then
log_daemon_msg "Invalid check configuration. Please run sudo /etc/init.d/mon-agent configtest for more details."
log_daemon_msg "Invalid check configuration. Please run sudo /etc/init.d/monasca-agent configtest for more details."
log_daemon_msg "Resuming starting process."
fi
@ -122,7 +122,7 @@ case "$1" in
info)
shift # Shift 'info' out of args so we can pass any
# addtional options to the real command
# (right now only mon-agent supports additional flags)
# (right now only monasca-agent supports additional flags)
su $AGENTUSER -c "$AGENTPATH info $@"
COLLECTOR_RETURN=$?
su $AGENTUSER -c "$MONSTATSDPATH info"

View File

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 104 KiB

View File

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 612 B

After

Width:  |  Height:  |  Size: 612 B

View File

Before

Width:  |  Height:  |  Size: 522 B

After

Width:  |  Height:  |  Size: 522 B

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -1,8 +1,8 @@
[supervisorctl]
serverurl = unix:///var/tmp/mon-agent-supervisor.sock
serverurl = unix:///var/tmp/monasca-agent-supervisor.sock
[unix_http_server]
file=/var/tmp/mon-agent-supervisor.sock
file=/var/tmp/monasca-agent-supervisor.sock
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
@ -11,35 +11,35 @@ supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
minfds = 1024
minprocs = 200
loglevel = info
logfile = /var/log/mon-agent/supervisord.log
logfile = /var/log/monasca/agent/supervisord.log
logfile_maxbytes = 50MB
nodaemon = false
pidfile = /var/run/mon-agent-supervisord.pid
pidfile = /var/run/monasca-agent-supervisord.pid
logfile_backups = 10
[program:collector]
command=/usr/local/bin/mon-collector foreground
command=/usr/local/bin/monasca-collector foreground
stdout_logfile=NONE
stderr_logfile=NONE
priority=999
startsecs=2
user=mon-agent
user=monasca-agent
[program:forwarder]
command=/usr/local/bin/mon-forwarder
command=/usr/local/bin/monasca-forwarder
stdout_logfile=NONE
stderr_logfile=NONE
startsecs=3
priority=998
user=mon-agent
user=monasca-agent
[program:monstatsd]
command=/usr/local/bin/monstatsd
command=/usr/local/bin/monasca-statsd
stdout_logfile=NONE
stderr_logfile=NONE
startsecs=3
priority=998
user=mon-agent
user=monasca-agent
[group:mon-agent]
[group:monasca-agent]
programs=forwarder,collector,monstatsd

View File

@ -26,7 +26,7 @@ install_requires = [
'simplejson',
'supervisor',
'tornado',
'python-monclient',
'python-monascaclient',
]
if sys.platform == 'win32':
@ -84,7 +84,7 @@ if sys.platform == 'win32':
self.version = '1.0.0'
self.cmdline_style = 'pywin32'
agent_svc = Target(name='Mon Agent', modules='win32.agent', dest_base='ddagent')
agent_svc = Target(name='Monasca Agent', modules='win32.agent', dest_base='monascaagent')
from monagent.collector.jmxfetch import JMX_FETCH_JAR_NAME
@ -103,7 +103,7 @@ if sys.platform == 'win32':
'dest_base': "agent-manager",
# The manager needs to be administrator to stop/start the service
'uac_info': "requireAdministrator",
'icon_resources': [(1, r"packaging\mon-agent\win32\install_files\dd_agent_win_256.ico")],
'icon_resources': [(1, r"packaging\monasca-agent\win32\install_files\dd_agent_win_256.ico")],
}],
'data_files': [
("Microsoft.VC90.CRT", glob(r'C:\Python27\redist\*.*')),
@ -115,11 +115,11 @@ if sys.platform == 'win32':
}
setup(
name='mon-agent',
name='monasca-agent',
maintainer="Tim Kuhlman",
maintainer_email="tim.kuhlman@hp.com",
version=__version__,
description="Collects metrics from the host it is installed on and sends to the monitroing api",
description="Collects metrics from the host it is installed on and sends to the monitoring api",
classifiers=[
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: Apache Software License",
@ -129,18 +129,18 @@ setup(
keywords="openstack monitoring",
install_requires=install_requires,
setup_requires=setup_requires,
url="https://github.com/hpcloud-mon/mon-agent",
url="https://github.com/stackforge/monasca-agent",
packages=find_packages(exclude=['tests', 'build*', 'packaging*']),
entry_points={
'console_scripts': [
'mon-forwarder = monagent.forwarder.daemon:main',
'mon-collector = monagent.collector.daemon:main',
'monstatsd = monagent.monstatsd.daemon:main',
'mon-setup = monsetup.main:main'
'monasca-forwarder = monagent.forwarder.daemon:main',
'monasca-collector = monagent.collector.daemon:main',
'monasca-statsd = monagent.monstatsd.daemon:main',
'monasca-setup = monsetup.main:main'
],
},
include_package_data=True,
data_files=[('share/mon/agent', ['agent.conf.template', 'packaging/supervisor.conf', 'packaging/mon-agent.init']),
('share/mon/agent/conf.d', glob('conf.d/*'))],
data_files=[('share/monasca/agent', ['agent.conf.template', 'packaging/supervisor.conf', 'packaging/monasca-agent.init']),
('share/monasca/agent/conf.d', glob('conf.d/*'))],
test_suite='nose.collector'
)

View File

@ -2,7 +2,7 @@ Tests for the mon agent.
Run with `nosestests -w tests`
For many tests to work an agent.conf must be in either /etc/mon-agent/agent.conf or in the working directory.
For many tests to work an agent.conf must be in either /etc/monasca/agent/agent.conf or in the working directory.
Many tests require specific applications enabled in order for the test to run, these are skipped by default. See
https://nose.readthedocs.org/en/latest/plugins/skip.html for details.