From 34d82d455e9447323aade4d6ab654d696fd8c411 Mon Sep 17 00:00:00 2001 From: gary-hessler Date: Wed, 17 Dec 2014 12:01:44 -0700 Subject: [PATCH] Renaming agent packages to reflect monasca Renamed monagent package to monasca_agent and monsetup package to monasca_setup. Also, renamed the monstatsd agent package to statsd to more closely match the internal collector and forwarder packages. Change-Id: I0649ae4341fe325007e2a8d37161d330e4c95d72 --- README.md | 6 +- agent.conf.template | 20 +++--- {monagent => monasca_agent}/__init__.py | 0 .../collector/__init__.py | 0 .../collector/checks/__init__.py | 0 .../collector/checks/check.py | 63 +++++++++--------- .../collector/checks/collector.py | 50 +++++++------- .../collector/checks/datadog.py | 8 +-- .../collector/checks/libs/__init__.py | 0 .../jmxfetch-0.3.0-jar-with-dependencies.jar | Bin .../checks/libs/jmxterm-1.0-DATADOG-uber.jar | Bin .../collector/checks/libs/thread_pool.py | 0 .../collector/checks/services_checks.py | 10 +-- .../collector/checks/system/__init__.py | 0 .../collector/checks/system/unix.py | 57 ++++++++-------- .../collector/checks/system/win32.py | 26 ++++---- .../collector/checks/utils.py | 0 .../collector/checks_d/__init__.py | 0 .../collector/checks_d/apache.py | 6 +- .../collector/checks_d/cacti.py | 2 +- .../collector/checks_d/couch.py | 4 +- .../collector/checks_d/couchbase.py | 6 +- .../collector/checks_d/directory.py | 2 +- .../collector/checks_d/docker.py | 2 +- .../collector/checks_d/elastic.py | 6 +- .../collector/checks_d/gearmand.py | 2 +- .../collector/checks_d/gunicorn.py | 2 +- .../collector/checks_d/haproxy.py | 4 +- .../collector/checks_d/hdfs.py | 2 +- .../collector/checks_d/host_alive.py | 4 +- .../collector/checks_d/http_check.py | 7 +- .../collector/checks_d/iis.py | 2 +- .../collector/checks_d/jenkins.py | 4 +- .../collector/checks_d/kafka_consumer.py | 2 +- .../collector/checks_d/kyototycoon.py | 2 +- .../collector/checks_d/libvirt.py | 4 +- .../collector/checks_d/lighttpd.py | 6 +- .../collector/checks_d/mcache.py | 2 +- .../collector/checks_d/mongo.py | 4 +- .../collector/checks_d/mysql.py | 2 +- .../collector/checks_d/nagios_wrapper.py | 2 +- .../collector/checks_d/network.py | 4 +- .../collector/checks_d/nginx.py | 6 +- .../collector/checks_d/postfix.py | 2 +- .../collector/checks_d/postgres.py | 4 +- .../collector/checks_d/process.py | 4 +- .../collector/checks_d/rabbitmq.py | 2 +- .../collector/checks_d/redisdb.py | 2 +- .../collector/checks_d/riak.py | 2 +- .../collector/checks_d/sqlserver.py | 2 +- .../collector/checks_d/tcp_check.py | 6 +- .../collector/checks_d/varnish.py | 2 +- .../collector/checks_d/win32_event_log.py | 2 +- .../collector/checks_d/wmi_check.py | 2 +- .../collector/checks_d/zk.py | 2 +- .../collector/daemon.py | 60 ++++++++--------- .../collector/dogstream/__init__.py | 0 .../collector/dogstream/cassandra.py | 2 +- .../collector/dogstream/common.py | 0 .../collector/dogstream/supervisord_log.py | 0 .../collector/jmxfetch.py | 10 +-- .../collector/modules.py | 0 .../collector/virt/__init__.py | 0 .../collector/virt/hyperv/__init__.py | 0 .../collector/virt/hyperv/inspector.py | 4 +- .../collector/virt/hyperv/utilsv2.py | 2 +- .../collector/virt/inspector.py | 2 +- .../collector/virt/libvirt/__init__.py | 0 .../collector/virt/libvirt/inspector.py | 2 +- .../collector/virt/vmware/__init__.py | 0 .../collector/virt/vmware/inspector.py | 4 +- .../virt/vmware/vsphere_operations.py | 0 .../collector/virt/xenapi/__init__.py | 0 .../collector/virt/xenapi/inspector.py | 2 +- .../common/__init__.py | 0 .../common/aggregator.py | 4 +- .../common/check_status.py | 4 +- {monagent => monasca_agent}/common/config.py | 36 +++++----- {monagent => monasca_agent}/common/daemon.py | 0 {monagent => monasca_agent}/common/emitter.py | 4 +- .../common/exceptions.py | 0 .../common/keystone.py | 0 {monagent => monasca_agent}/common/metrics.py | 2 +- {monagent => monasca_agent}/common/util.py | 2 +- .../forwarder/__init__.py | 0 .../forwarder/api/__init__.py | 0 .../forwarder/api/mon.py | 4 +- .../forwarder/daemon.py | 16 ++--- .../forwarder/transaction.py | 4 +- .../statsd}/__init__.py | 0 .../statsd}/daemon.py | 48 ++++++------- .../statsd}/reporter.py | 20 +++--- .../monstatsd => monasca_agent/statsd}/udp.py | 6 +- {monagent => monasca_agent}/win32/__init__.py | 0 {monagent => monasca_agent}/win32/agent.py | 63 ++++++------------ {monagent => monasca_agent}/win32/common.py | 0 {monagent => monasca_agent}/win32/gui.py | 0 {monagent => monasca_agent}/win32/shell.py | 0 {monsetup => monasca_setup}/README.md | 0 {monsetup => monasca_setup}/__init__.py | 0 {monsetup => monasca_setup}/agent_config.py | 0 .../detection/__init__.py | 0 .../detection/plugin.py | 0 .../detection/plugins/__init__.py | 0 .../detection/plugins/ceilometer.py | 4 +- .../detection/plugins/cinder.py | 4 +- .../detection/plugins/glance.py | 4 +- .../detection/plugins/kafka_consumer.py | 6 +- .../detection/plugins/keystone.py | 4 +- .../detection/plugins/libvirt.py | 12 ++-- .../detection/plugins/mon.py | 20 +++--- .../detection/plugins/mysql.py | 12 ++-- .../detection/plugins/network.py | 4 +- .../detection/plugins/neutron.py | 4 +- .../detection/plugins/nova.py | 4 +- .../detection/plugins/postfix.py | 10 +-- .../detection/plugins/rabbitmq.py | 12 ++-- .../detection/plugins/swift.py | 4 +- .../detection/plugins/zookeeper.py | 12 ++-- .../detection/service_plugin.py | 8 +-- .../detection/utils.py | 2 +- {monsetup => monasca_setup}/main.py | 0 .../service/__init__.py | 0 .../service/service.py | 0 {monsetup => monasca_setup}/service/sysv.py | 0 packaging/Makefile | 10 +-- .../monasca-agent-deb/monasca-agent.init | 8 +-- packaging/monasca-agent-deb/supervisor.conf | 4 +- packaging/monasca-agent.init | 8 +-- packaging/supervisor.conf | 4 +- setup.cfg | 22 +++--- tests/__init__.py | 2 +- tests/common.py | 6 +- ...ctional.py => monascastatsd_functional.py} | 0 tests/performance/benchmark_aggregator.py | 2 +- tests/test_cassandra_jmx.py | 10 +-- tests/test_check_status.py | 4 +- tests/test_common.py | 6 +- tests/test_config.py | 4 +- tests/test_java_jmx.py | 10 +-- tests/test_monstatsd.py | 12 ++-- tests/test_solr.py | 10 +-- tests/test_system.py | 8 +-- tests/test_tomcat.py | 10 +-- tests/test_transaction.py | 4 +- tests/test_watchdog.py | 6 +- tests/test_win32.py | 2 +- 147 files changed, 462 insertions(+), 478 deletions(-) rename {monagent => monasca_agent}/__init__.py (100%) rename {monagent => monasca_agent}/collector/__init__.py (100%) rename {monagent => monasca_agent}/collector/checks/__init__.py (100%) rename {monagent => monasca_agent}/collector/checks/check.py (91%) rename {monagent => monasca_agent}/collector/checks/collector.py (87%) rename {monagent => monasca_agent}/collector/checks/datadog.py (98%) rename {monagent => monasca_agent}/collector/checks/libs/__init__.py (100%) rename {monagent => monasca_agent}/collector/checks/libs/jmxfetch-0.3.0-jar-with-dependencies.jar (100%) rename {monagent => monasca_agent}/collector/checks/libs/jmxterm-1.0-DATADOG-uber.jar (100%) rename {monagent => monasca_agent}/collector/checks/libs/thread_pool.py (100%) rename {monagent => monasca_agent}/collector/checks/services_checks.py (94%) rename {monagent => monasca_agent}/collector/checks/system/__init__.py (100%) rename {monagent => monasca_agent}/collector/checks/system/unix.py (96%) rename {monagent => monasca_agent}/collector/checks/system/win32.py (91%) rename {monagent => monasca_agent}/collector/checks/utils.py (100%) rename {monagent => monasca_agent}/collector/checks_d/__init__.py (100%) rename {monagent => monasca_agent}/collector/checks_d/apache.py (95%) rename {monagent => monasca_agent}/collector/checks_d/cacti.py (99%) rename {monagent => monasca_agent}/collector/checks_d/couch.py (96%) rename {monagent => monasca_agent}/collector/checks_d/couchbase.py (96%) rename {monagent => monasca_agent}/collector/checks_d/directory.py (98%) rename {monagent => monasca_agent}/collector/checks_d/docker.py (99%) rename {monagent => monasca_agent}/collector/checks_d/elastic.py (99%) rename {monagent => monasca_agent}/collector/checks_d/gearmand.py (97%) rename {monagent => monasca_agent}/collector/checks_d/gunicorn.py (98%) rename {monagent => monasca_agent}/collector/checks_d/haproxy.py (99%) rename {monagent => monasca_agent}/collector/checks_d/hdfs.py (97%) rename {monagent => monasca_agent}/collector/checks_d/host_alive.py (96%) rename {monagent => monasca_agent}/collector/checks_d/http_check.py (96%) rename {monagent => monasca_agent}/collector/checks_d/iis.py (98%) rename {monagent => monasca_agent}/collector/checks_d/jenkins.py (98%) rename {monagent => monasca_agent}/collector/checks_d/kafka_consumer.py (99%) rename {monagent => monasca_agent}/collector/checks_d/kyototycoon.py (98%) rename {monagent => monasca_agent}/collector/checks_d/libvirt.py (99%) rename {monagent => monasca_agent}/collector/checks_d/lighttpd.py (97%) rename {monagent => monasca_agent}/collector/checks_d/mcache.py (99%) rename {monagent => monasca_agent}/collector/checks_d/mongo.py (98%) rename {monagent => monasca_agent}/collector/checks_d/mysql.py (99%) rename {monagent => monasca_agent}/collector/checks_d/nagios_wrapper.py (97%) rename {monagent => monasca_agent}/collector/checks_d/network.py (99%) rename {monagent => monasca_agent}/collector/checks_d/nginx.py (95%) rename {monagent => monasca_agent}/collector/checks_d/postfix.py (97%) rename {monagent => monasca_agent}/collector/checks_d/postgres.py (98%) rename {monagent => monasca_agent}/collector/checks_d/process.py (98%) rename {monagent => monasca_agent}/collector/checks_d/rabbitmq.py (99%) rename {monagent => monasca_agent}/collector/checks_d/redisdb.py (99%) rename {monagent => monasca_agent}/collector/checks_d/riak.py (98%) rename {monagent => monasca_agent}/collector/checks_d/sqlserver.py (99%) rename {monagent => monasca_agent}/collector/checks_d/tcp_check.py (96%) rename {monagent => monasca_agent}/collector/checks_d/varnish.py (99%) rename {monagent => monasca_agent}/collector/checks_d/win32_event_log.py (99%) rename {monagent => monasca_agent}/collector/checks_d/wmi_check.py (98%) rename {monagent => monasca_agent}/collector/checks_d/zk.py (99%) rename {monagent => monasca_agent}/collector/daemon.py (82%) rename {monagent => monasca_agent}/collector/dogstream/__init__.py (100%) rename {monagent => monasca_agent}/collector/dogstream/cassandra.py (97%) rename {monagent => monasca_agent}/collector/dogstream/common.py (100%) rename {monagent => monasca_agent}/collector/dogstream/supervisord_log.py (100%) rename {monagent => monasca_agent}/collector/jmxfetch.py (98%) rename {monagent => monasca_agent}/collector/modules.py (100%) rename {monagent => monasca_agent}/collector/virt/__init__.py (100%) rename {monagent => monasca_agent}/collector/virt/hyperv/__init__.py (100%) rename {monagent => monasca_agent}/collector/virt/hyperv/inspector.py (95%) rename {monagent => monasca_agent}/collector/virt/hyperv/utilsv2.py (99%) rename {monagent => monasca_agent}/collector/virt/inspector.py (99%) rename {monagent => monasca_agent}/collector/virt/libvirt/__init__.py (100%) rename {monagent => monasca_agent}/collector/virt/libvirt/inspector.py (98%) rename {monagent => monasca_agent}/collector/virt/vmware/__init__.py (100%) rename {monagent => monasca_agent}/collector/virt/vmware/inspector.py (98%) rename {monagent => monasca_agent}/collector/virt/vmware/vsphere_operations.py (100%) rename {monagent => monasca_agent}/collector/virt/xenapi/__init__.py (100%) rename {monagent => monasca_agent}/collector/virt/xenapi/inspector.py (99%) rename {monagent => monasca_agent}/common/__init__.py (100%) rename {monagent => monasca_agent}/common/aggregator.py (98%) rename {monagent => monasca_agent}/common/check_status.py (99%) rename {monagent => monasca_agent}/common/config.py (96%) rename {monagent => monasca_agent}/common/daemon.py (100%) rename {monagent => monasca_agent}/common/emitter.py (91%) rename {monagent => monasca_agent}/common/exceptions.py (100%) rename {monagent => monasca_agent}/common/keystone.py (100%) rename {monagent => monasca_agent}/common/metrics.py (99%) rename {monagent => monasca_agent}/common/util.py (99%) rename {monagent => monasca_agent}/forwarder/__init__.py (100%) rename {monagent => monasca_agent}/forwarder/api/__init__.py (100%) rename {monagent => monasca_agent}/forwarder/api/mon.py (98%) rename {monagent => monasca_agent}/forwarder/daemon.py (95%) rename {monagent => monasca_agent}/forwarder/transaction.py (98%) rename {monagent/monstatsd => monasca_agent/statsd}/__init__.py (100%) rename {monagent/monstatsd => monasca_agent/statsd}/daemon.py (73%) rename {monagent/monstatsd => monasca_agent/statsd}/reporter.py (87%) rename {monagent/monstatsd => monasca_agent/statsd}/udp.py (98%) rename {monagent => monasca_agent}/win32/__init__.py (100%) rename {monagent => monasca_agent}/win32/agent.py (76%) rename {monagent => monasca_agent}/win32/common.py (100%) rename {monagent => monasca_agent}/win32/gui.py (100%) rename {monagent => monasca_agent}/win32/shell.py (100%) rename {monsetup => monasca_setup}/README.md (100%) rename {monsetup => monasca_setup}/__init__.py (100%) rename {monsetup => monasca_setup}/agent_config.py (100%) rename {monsetup => monasca_setup}/detection/__init__.py (100%) rename {monsetup => monasca_setup}/detection/plugin.py (100%) rename {monsetup => monasca_setup}/detection/plugins/__init__.py (100%) rename {monsetup => monasca_setup}/detection/plugins/ceilometer.py (91%) rename {monsetup => monasca_setup}/detection/plugins/cinder.py (87%) rename {monsetup => monasca_setup}/detection/plugins/glance.py (86%) rename {monsetup => monasca_setup}/detection/plugins/kafka_consumer.py (96%) rename {monsetup => monasca_setup}/detection/plugins/keystone.py (85%) rename {monsetup => monasca_setup}/detection/plugins/libvirt.py (89%) rename {monsetup => monasca_setup}/detection/plugins/mon.py (82%) rename {monsetup => monasca_setup}/detection/plugins/mysql.py (91%) rename {monsetup => monasca_setup}/detection/plugins/network.py (91%) rename {monsetup => monasca_setup}/detection/plugins/neutron.py (89%) rename {monsetup => monasca_setup}/detection/plugins/nova.py (90%) rename {monsetup => monasca_setup}/detection/plugins/postfix.py (78%) rename {monsetup => monasca_setup}/detection/plugins/rabbitmq.py (93%) rename {monsetup => monasca_setup}/detection/plugins/swift.py (92%) rename {monsetup => monasca_setup}/detection/plugins/zookeeper.py (73%) rename {monsetup => monasca_setup}/detection/service_plugin.py (90%) rename {monsetup => monasca_setup}/detection/utils.py (98%) rename {monsetup => monasca_setup}/main.py (100%) rename {monsetup => monasca_setup}/service/__init__.py (100%) rename {monsetup => monasca_setup}/service/service.py (100%) rename {monsetup => monasca_setup}/service/sysv.py (100%) rename tests/functional/{dogstatsd_functional.py => monascastatsd_functional.py} (100%) diff --git a/README.md b/README.md index 7ce99a72..58426400 100644 --- a/README.md +++ b/README.md @@ -400,10 +400,10 @@ Plugins are the way to extend the Monasca Agent. Plugins add additional functio Developers can extend the functionality of the Agent by writing custom plugins. Plugins are written in Python according to the conventions described below. The plugin script is placed in /etc/monasca/agent/checks.d, and a YAML file containing the configuration for the plugin is placed in /etc/monasca/agent/conf.d. The YAML file must have the same stem name as the plugin script. ### AgentCheck Interface -Most monasca-agent plugin code uses the AgentCheck interface. All custom checks inherit from the AgentCheck class found in monagent/collector/checks/__init__.py and require a check() method that takes one argument, instance, which is a dict specifying the configuration of the instance on behalf of the plugin being executed. The check() method is run once per instance defined in the check's configuration (discussed later). +Most monasca-agent plugin code uses the AgentCheck interface. All custom checks inherit from the AgentCheck class found in monasca_agent/collector/checks/__init__.py and require a check() method that takes one argument, instance, which is a dict specifying the configuration of the instance on behalf of the plugin being executed. The check() method is run once per instance defined in the check's configuration (discussed later). ### ServicesCheck interface -Some monasca-agent plugins use the ServicesCheck class found in monagent/collector/services_checks.py. These require a _check() method that is similar to AgentCheck's check(), but instead of being called once per iteration in a linear fashion, it is run against a threadpool to allow concurrent instances to be checked. Also, _check() must return a tuple consisting of either Status.UP or 'Status.DOWN(frommonagent.collector.checks.services_checks`), plus a text description. +Some monasca-agent plugins use the ServicesCheck class found in monasca_agent/collector/services_checks.py. These require a _check() method that is similar to AgentCheck's check(), but instead of being called once per iteration in a linear fashion, it is run against a threadpool to allow concurrent instances to be checked. Also, _check() must return a tuple consisting of either Status.UP or 'Status.DOWN(from monasca_agent.collector.checks.services_checks`), plus a text description. The size of the threadpool is either 6 or the total number of instances, whichever is lower. This may be adjusted with the threads_count parameter in the plugin's init_config (see Plugin Configuration below). @@ -965,7 +965,7 @@ The following ceilometer processes are monitored, if they exist when the monasca The Libvirt plugin provides metrics for virtual machines when run on the hypervisor server. It provides two sets of metrics per measurement: one designed for the owner of the VM, and one intended for the owner of the hypervisor server. ### Configuration -The `monasca-setup` program will configure the Libvirt plugin if `nova-api` is running, `/etc/nova/nova.conf` exists, and `python-novaclient` is installed. It uses a cache directory to persist data, which is `/dev/shm` by default. On non-Linux systems (BSD, Mac OSX), `/dev/shm` may not exist, so `cache_dir` would need to be changed accordingly, either in `monsetup/detection/plugins/libvirt.py` prior to running `monasca-setup`, or `/etc/monasca/agent/conf.d/libvirt.yaml` afterwards. +The `monasca-setup` program will configure the Libvirt plugin if `nova-api` is running, `/etc/nova/nova.conf` exists, and `python-novaclient` is installed. It uses a cache directory to persist data, which is `/dev/shm` by default. On non-Linux systems (BSD, Mac OSX), `/dev/shm` may not exist, so `cache_dir` would need to be changed accordingly, either in `monasca_setup/detection/plugins/libvirt.py` prior to running `monasca-setup`, or `/etc/monasca/agent/conf.d/libvirt.yaml` afterwards. `nova_refresh` specifies the number of seconds between calls to the Nova API to refresh the instance cache. This is helpful for updating VM hostname and pruning deleted instances from the cache. By default, it is set to 14,400 seconds (four hours). Set to 0 to refresh every time the Collector runs, or to None to disable regular refreshes entirely (though the instance cache will still be refreshed if a new instance is detected). diff --git a/agent.conf.template b/agent.conf.template index 154d3de1..76f4a392 100644 --- a/agent.conf.template +++ b/agent.conf.template @@ -79,24 +79,24 @@ use_mount: no # non_local_traffic: no # ========================================================================== # -# MonStatsd configuration # +# Monasca Statsd configuration # # ========================================================================== # -# MonStatsd is a small server that aggregates your custom app metrics. +# Monasca Statsd is a small server that aggregates your custom app metrics. # Make sure your client is sending to the same port. -monstatsd_port : 8125 +monasca_statsd_port : 8125 -## The monstatsd flush period. -# monstatsd_interval : 10 +## The monasca_statsd flush period. +# monasca_statsd_interval : 10 ## If 'yes', counters and rates will be normalized to 1 second (that is divided -## by the monstatsd_interval) before being sent to the server. Defaults to 'yes' -# monstatsd_normalize : yes +## by the monasca_statsd_interval) before being sent to the server. Defaults to 'yes' +# monasca_statsd_normalize : yes -# If you want to forward every packet received by the monstatsd server +# If you want to forward every packet received by the monasca_statsd server # to another statsd server, uncomment these lines. -# WARNING: Make sure that forwarded packets are regular statsd packets and not "monstatsd" packets, +# WARNING: Make sure that forwarded packets are regular statsd packets and not "monasca_statsd" packets, # as your other statsd server might not be able to handle them. # statsd_forward_host: address_of_own_statsd_server # statsd_forward_port: 8125 @@ -155,7 +155,7 @@ log_level: INFO 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 +statsd_log_file: /var/log/monasca/agent/statsd.log # if syslog is enabled but a host and port are not set, a local domain socket # connection will be attempted diff --git a/monagent/__init__.py b/monasca_agent/__init__.py similarity index 100% rename from monagent/__init__.py rename to monasca_agent/__init__.py diff --git a/monagent/collector/__init__.py b/monasca_agent/collector/__init__.py similarity index 100% rename from monagent/collector/__init__.py rename to monasca_agent/collector/__init__.py diff --git a/monagent/collector/checks/__init__.py b/monasca_agent/collector/checks/__init__.py similarity index 100% rename from monagent/collector/checks/__init__.py rename to monasca_agent/collector/checks/__init__.py diff --git a/monagent/collector/checks/check.py b/monasca_agent/collector/checks/check.py similarity index 91% rename from monagent/collector/checks/check.py rename to monasca_agent/collector/checks/check.py index fc592249..04b479c1 100644 --- a/monagent/collector/checks/check.py +++ b/monasca_agent/collector/checks/check.py @@ -15,10 +15,11 @@ import traceback import yaml -from monagent.common.aggregator import MetricsAggregator -import monagent.common.config -import monagent.common.exceptions -import monagent.common.util +from monasca_agent.common.keystone import Keystone +from monasca_agent.common.aggregator import MetricsAggregator +import monasca_agent.common.config +import monasca_agent.common.exceptions +import monasca_agent.common.util log = logging.getLogger(__name__) @@ -52,7 +53,7 @@ class Check(object): self._counters = {} # metric_name: bool self.logger = logger try: - self.logger.addFilter(monagent.common.util.LaconicFilter()) + self.logger.addFilter(monasca_agent.common.util.LaconicFilter()) except Exception: self.logger.exception("Trying to install laconic log filter and failed") @@ -127,11 +128,11 @@ class Check(object): if timestamp is None: timestamp = time.time() if metric not in self._sample_store: - raise monagent.common.exceptions.CheckException("Saving a sample for an undefined metric: %s" % metric) + raise monasca_agent.common.exceptions.CheckException("Saving a sample for an undefined metric: %s" % metric) try: - value = monagent.common.util.cast_metric_val(value) + value = monasca_agent.common.util.cast_metric_val(value) except ValueError as ve: - raise monagent.common.exceptions.NaN(ve) + raise monasca_agent.common.exceptions.NaN(ve) # Sort and validate dimensions self._set_dimensions(dimensions) @@ -147,8 +148,8 @@ class Check(object): self._sample_store[metric][key] = self._sample_store[metric][key][-1:] + \ [(timestamp, value, hostname, device_name)] else: - raise monagent.common.exceptions.CheckException("%s must be either gauge or counter, skipping sample at %s" % - (metric, time.ctime(timestamp))) + raise monasca_agent.common.exceptions.CheckException("%s must be either gauge or counter, skipping sample at %s" % + (metric, time.ctime(timestamp))) if self.is_gauge(metric): # store[metric][dimensions] = (ts, val) - only 1 value allowed @@ -169,19 +170,19 @@ class Check(object): try: interval = sample2[0] - sample1[0] if interval == 0: - raise monagent.common.exceptions.Infinity() + raise monasca_agent.common.exceptions.Infinity() delta = sample2[1] - sample1[1] if delta < 0: - raise monagent.common.exceptions.UnknownValue() + raise monasca_agent.common.exceptions.UnknownValue() return (sample2[0], delta / interval, sample2[2], sample2[3]) - except monagent.common.exceptions.Infinity: + except monasca_agent.common.exceptions.Infinity: raise - except monagent.common.exceptions.UnknownValue: + except monasca_agent.common.exceptions.UnknownValue: raise except Exception as e: - raise monagent.common.exceptions.NaN(e) + raise monasca_agent.common.exceptions.NaN(e) def get_sample_with_timestamp(self, metric, dimensions=None, device_name=None, expire=True): """Get (timestamp-epoch-style, value). @@ -192,11 +193,11 @@ class Check(object): # Never seen this metric if metric not in self._sample_store: - raise monagent.common.exceptions.UnknownValue() + raise monasca_agent.common.exceptions.UnknownValue() # Not enough value to compute rate elif self.is_counter(metric) and len(self._sample_store[metric][key]) < 2: - raise monagent.common.exceptions.UnknownValue() + raise monasca_agent.common.exceptions.UnknownValue() elif self.is_counter(metric) and len(self._sample_store[metric][key]) >= 2: res = self._rate( @@ -209,7 +210,7 @@ class Check(object): return self._sample_store[metric][key][-1] else: - raise monagent.common.exceptions.UnknownValue() + raise monasca_agent.common.exceptions.UnknownValue() def get_sample(self, metric, dimensions=None, device_name=None, expire=True): """Return the last value for that metric. @@ -259,7 +260,7 @@ class Check(object): try: ts, val, hostname, device_name = self.get_sample_with_timestamp( m, dimensions, device_name, expire) - except monagent.common.exceptions.UnknownValue: + except monasca_agent.common.exceptions.UnknownValue: continue attributes = {} if dimensions_list: @@ -289,7 +290,7 @@ class AgentCheck(object): self.name = name self.init_config = init_config self.agent_config = agent_config - self.hostname = monagent.common.util.get_hostname(agent_config) + self.hostname = monasca_agent.common.util.get_hostname(agent_config) self.log = logging.getLogger('%s.%s' % (__name__, name)) self.aggregator = MetricsAggregator(self.hostname, @@ -455,7 +456,7 @@ class AgentCheck(object): """Get all metrics, including the ones that are tagged. @return the list of samples - @rtype list of Measurement objects from monagent.common.metrics + @rtype list of Measurement objects from monasca_agent.common.metrics """ if prettyprint: metrics = self.aggregator.flush() @@ -528,18 +529,18 @@ class AgentCheck(object): try: self.check(instance) if self.has_warnings(): - instance_status = monagent.common.check_status.InstanceStatus(i, - monagent.common.check_status.STATUS_WARNING, - warnings=self.get_warnings()) + instance_status = monasca_agent.common.check_status.InstanceStatus(i, + monasca_agent.common.check_status.STATUS_WARNING, + warnings=self.get_warnings()) else: - instance_status = monagent.common.check_status.InstanceStatus(i, - monagent.common.check_status.STATUS_OK) + instance_status = monasca_agent.common.check_status.InstanceStatus(i, + monasca_agent.common.check_status.STATUS_OK) except Exception as e: self.log.exception("Check '%s' instance #%s failed" % (self.name, i)) - instance_status = monagent.common.check_status.InstanceStatus(i, - monagent.common.check_status.STATUS_ERROR, - error=e, - tb=traceback.format_exc()) + instance_status = monasca_agent.common.check_status.InstanceStatus(i, + monasca_agent.common.check_status.STATUS_ERROR, + error=e, + tb=traceback.format_exc()) instance_statuses.append(instance_status) return instance_statuses @@ -622,7 +623,7 @@ def run_check(name, path=None): import tests.common # Read the config file - confd_path = path or os.path.join(monagent.common.config.get_confd_path(monagent.common.util.get_os()), + confd_path = path or os.path.join(monasca_agent.common.config.get_confd_path(monasca_agent.common.util.get_os()), '%s.yaml' % name) try: diff --git a/monagent/collector/checks/collector.py b/monasca_agent/collector/checks/collector.py similarity index 87% rename from monagent/collector/checks/collector.py rename to monasca_agent/collector/checks/collector.py index 8fa747d9..f2dca7f5 100644 --- a/monagent/collector/checks/collector.py +++ b/monasca_agent/collector/checks/collector.py @@ -6,9 +6,9 @@ import system.win32 as w32 import threading import time -import monagent.common.check_status -import monagent.common.metrics -import monagent.common.util +import monasca_agent.common.check_status +import monasca_agent.common.metrics +import monasca_agent.common.util log = logging.getLogger(__name__) @@ -32,7 +32,7 @@ class Collector(object): def __init__(self, agent_config, emitter, checksd=None): self.emit_duration = None self.agent_config = agent_config - self.os = monagent.common.util.get_os() + self.os = monasca_agent.common.util.get_os() self.plugins = None self.emitter = emitter socket.setdefaulttimeout(15) @@ -79,18 +79,18 @@ class Collector(object): # Don't try to send to an emitter if we're stopping/ if self.continue_running: name = self.emitter.__name__ - emitter_status = monagent.common.check_status.EmitterStatus(name) + emitter_status = monasca_agent.common.check_status.EmitterStatus(name) try: self.emitter(payload, log, self.agent_config['forwarder_url']) except Exception as e: log.exception("Error running emitter: %s" % self.emitter.__name__) - emitter_status = monagent.common.check_status.EmitterStatus(name, e) + emitter_status = monasca_agent.common.check_status.EmitterStatus(name, e) statuses.append(emitter_status) return statuses def _set_status(self, check_statuses, emitter_statuses, collect_duration): try: - monagent.common.check_status.CollectorStatus(check_statuses, emitter_statuses).persist() + monasca_agent.common.check_status.CollectorStatus(check_statuses, emitter_statuses).persist() except Exception: log.exception("Error persisting collector status") @@ -129,7 +129,7 @@ class Collector(object): There are currently two types of checks the system checks and the configured ones from checks_d """ - timer = monagent.common.util.Timer() + timer = monasca_agent.common.util.Timer() self.run_count += 1 log.debug("Starting collection run #%s" % self.run_count) @@ -142,12 +142,12 @@ class Collector(object): for check_type in self._legacy_checks: try: for name, value in check_type.check().iteritems(): - metrics_list.append(monagent.common.metrics.Measurement(name, - timestamp, - value, - {'component': 'monasca-agent', - 'service': 'monitoring'}, - None)) + metrics_list.append(monasca_agent.common.metrics.Measurement(name, + timestamp, + value, + {'component': 'monasca-agent', + 'service': 'monitoring'}, + None)) except Exception: log.exception('Error running check.') @@ -166,12 +166,12 @@ class Collector(object): # Add in metrics on the collector run, emit_duration is from the previous run for name, value in self.collector_stats(len(metrics_list), len(events), collect_duration, self.emit_duration).iteritems(): - metrics_list.append(monagent.common.metrics.Measurement(name, - timestamp, - value, - {'component': 'monasca-agent', - 'service': 'monitoring'}, - None)) + metrics_list.append(monasca_agent.common.metrics.Measurement(name, + timestamp, + value, + {'component': 'monasca-agent', + 'service': 'monitoring'}, + None)) emitter_statuses = self._emit(metrics_list) self.emit_duration = timer.step() @@ -215,16 +215,16 @@ class Collector(object): except Exception: log.exception("Error running check %s" % check.name) - check_status = monagent.common.check_status.CheckStatus(check.name, instance_statuses, metric_count, event_count, - library_versions=check.get_library_info()) + check_status = monasca_agent.common.check_status.CheckStatus(check.name, instance_statuses, metric_count, event_count, + library_versions=check.get_library_info()) check_statuses.append(check_status) for check_name, info in self.init_failed_checks_d.iteritems(): if not self.continue_running: return - check_status = monagent.common.check_status.CheckStatus(check_name, None, None, None, - init_failed_error=info['error'], - init_failed_traceback=info['traceback']) + check_status = monasca_agent.common.check_status.CheckStatus(check_name, None, None, None, + init_failed_error=info['error'], + init_failed_traceback=info['traceback']) check_statuses.append(check_status) return measurements, events, check_statuses diff --git a/monagent/collector/checks/datadog.py b/monasca_agent/collector/checks/datadog.py similarity index 98% rename from monagent/collector/checks/datadog.py rename to monasca_agent/collector/checks/datadog.py index 60755295..a15849fd 100644 --- a/monagent/collector/checks/datadog.py +++ b/monasca_agent/collector/checks/datadog.py @@ -5,8 +5,8 @@ import re import time import traceback -import monagent.collector -import monagent.common.util +import monasca_agent.collector +import monasca_agent.common.util import utils @@ -111,7 +111,7 @@ class Dogstream(object): if parser_spec: try: - parse_func = monagent.collector.modules.load(parser_spec, 'parser') + parse_func = monasca_agent.collector.modules.load(parser_spec, 'parser') if isinstance(parse_func, type): logger.info('Instantiating class-based dogstream') parse_func = parse_func( @@ -142,7 +142,7 @@ class Dogstream(object): self.class_based = class_based # Apply LaconicFilter to avoid log flooding - self.logger.addFilter(monagent.common.util.LaconicFilter("dogstream")) + self.logger.addFilter(monasca_agent.common.util.LaconicFilter("dogstream")) self.log_path = log_path self.parse_func = parse_func or self._default_line_parser diff --git a/monagent/collector/checks/libs/__init__.py b/monasca_agent/collector/checks/libs/__init__.py similarity index 100% rename from monagent/collector/checks/libs/__init__.py rename to monasca_agent/collector/checks/libs/__init__.py diff --git a/monagent/collector/checks/libs/jmxfetch-0.3.0-jar-with-dependencies.jar b/monasca_agent/collector/checks/libs/jmxfetch-0.3.0-jar-with-dependencies.jar similarity index 100% rename from monagent/collector/checks/libs/jmxfetch-0.3.0-jar-with-dependencies.jar rename to monasca_agent/collector/checks/libs/jmxfetch-0.3.0-jar-with-dependencies.jar diff --git a/monagent/collector/checks/libs/jmxterm-1.0-DATADOG-uber.jar b/monasca_agent/collector/checks/libs/jmxterm-1.0-DATADOG-uber.jar similarity index 100% rename from monagent/collector/checks/libs/jmxterm-1.0-DATADOG-uber.jar rename to monasca_agent/collector/checks/libs/jmxterm-1.0-DATADOG-uber.jar diff --git a/monagent/collector/checks/libs/thread_pool.py b/monasca_agent/collector/checks/libs/thread_pool.py similarity index 100% rename from monagent/collector/checks/libs/thread_pool.py rename to monasca_agent/collector/checks/libs/thread_pool.py diff --git a/monagent/collector/checks/services_checks.py b/monasca_agent/collector/checks/services_checks.py similarity index 94% rename from monagent/collector/checks/services_checks.py rename to monasca_agent/collector/checks/services_checks.py index 0db2d891..4224f188 100644 --- a/monagent/collector/checks/services_checks.py +++ b/monasca_agent/collector/checks/services_checks.py @@ -3,8 +3,8 @@ import Queue import threading import time -import monagent.collector.checks -import monagent.collector.checks.libs.thread_pool +import monasca_agent.collector.checks +import monasca_agent.collector.checks.libs.thread_pool TIMEOUT = 180 @@ -17,7 +17,7 @@ Status = up_down('UP', 'DOWN') EventType = up_down("servicecheck.state_change.up", "servicecheck.state_change.down") -class ServicesCheck(monagent.collector.checks.AgentCheck): +class ServicesCheck(monasca_agent.collector.checks.AgentCheck): SOURCE_TYPE_NAME = 'servicecheck' """Services checks inherits from this class. @@ -39,7 +39,7 @@ class ServicesCheck(monagent.collector.checks.AgentCheck): """ def __init__(self, name, init_config, agentConfig, instances): - monagent.collector.checks.AgentCheck.__init__(self, name, init_config, agentConfig, instances) + monasca_agent.collector.checks.AgentCheck.__init__(self, name, init_config, agentConfig, instances) # A dictionary to keep track of service statuses self.statuses = {} @@ -59,7 +59,7 @@ class ServicesCheck(monagent.collector.checks.AgentCheck): default_size = min(self.instance_count(), DEFAULT_SIZE_POOL) self.pool_size = int(self.init_config.get('threads_count', default_size)) - self.pool = monagent.collector.checks.libs.thread_pool.Pool(self.pool_size) + self.pool = monasca_agent.collector.checks.libs.thread_pool.Pool(self.pool_size) self.resultsq = Queue.Queue() self.jobs_status = {} diff --git a/monagent/collector/checks/system/__init__.py b/monasca_agent/collector/checks/system/__init__.py similarity index 100% rename from monagent/collector/checks/system/__init__.py rename to monasca_agent/collector/checks/system/__init__.py diff --git a/monagent/collector/checks/system/unix.py b/monasca_agent/collector/checks/system/unix.py similarity index 96% rename from monagent/collector/checks/system/unix.py rename to monasca_agent/collector/checks/system/unix.py index b99c8296..527bc298 100644 --- a/monagent/collector/checks/system/unix.py +++ b/monasca_agent/collector/checks/system/unix.py @@ -13,16 +13,16 @@ import time # project -import monagent.collector.checks.check -import monagent.common.metrics -import monagent.common.util +import monasca_agent.collector.checks.check +import monasca_agent.common.metrics +import monasca_agent.common.util # locale-resilient float converter to_float = lambda s: float(s.replace(",", ".")) -class Disk(monagent.collector.checks.check.Check): +class Disk(monasca_agent.collector.checks.check.Check): """Collects metrics about the machine's disks. """ @@ -60,13 +60,13 @@ class Disk(monagent.collector.checks.check.Check): # parse into a list of Measurements stats.update(inodes) timestamp = time.time() - measurements = [monagent.common.metrics.Measurement(key.split('.', 1)[1], - timestamp, - value, - {'device': key.split('.', 1)[0], - 'service': 'monitoring', - 'component': 'monasca-agent'}, - None) + measurements = [monasca_agent.common.metrics.Measurement(key.split('.', 1)[1], + timestamp, + value, + {'device': key.split('.', 1)[0], + 'service': 'monitoring', + 'component': 'monasca-agent'}, + None) for key, value in stats.iteritems()] return measurements @@ -93,14 +93,14 @@ class Disk(monagent.collector.checks.check.Check): if use_mount: parts[0] = parts[-1] if inodes: - if monagent.common.util.Platform.is_darwin(platform_name): + if monasca_agent.common.util.Platform.is_darwin(platform_name): # Filesystem 512-blocks Used Available Capacity iused ifree %iused Mounted # Inodes are in position 5, 6 and we need to compute the total # Total parts[1] = int(parts[5]) + int(parts[6]) # Total parts[2] = int(parts[5]) # Used parts[3] = int(parts[6]) # Available - elif monagent.common.util.Platform.is_freebsd(platform_name): + elif monasca_agent.common.util.Platform.is_freebsd(platform_name): # Filesystem 1K-blocks Used Avail Capacity iused ifree %iused Mounted # Inodes are in position 5, 6 and we need to compute the total parts[1] = int(parts[5]) + int(parts[6]) # Total @@ -207,10 +207,10 @@ class Disk(monagent.collector.checks.check.Check): return devices -class IO(monagent.collector.checks.check.Check): +class IO(monasca_agent.collector.checks.check.Check): def __init__(self, logger): - monagent.collector.checks.check.Check.__init__(self, logger) + monasca_agent.collector.checks.check.Check.__init__(self, logger) self.header_re = re.compile(r'([%\\/\-_a-zA-Z0-9]+)[\s+]?') self.item_re = re.compile(r'^([a-zA-Z0-9\/]+)') self.value_re = re.compile(r'\d+\.\d+') @@ -300,7 +300,7 @@ class IO(monagent.collector.checks.check.Check): """ io = {} try: - if monagent.common.util.Platform.is_linux(): + if monasca_agent.common.util.Platform.is_linux(): stdout = sp.Popen(['iostat', '-d', '1', '2', '-x', '-k'], stdout=sp.PIPE, close_fds=True).communicate()[0] @@ -412,10 +412,13 @@ class IO(monagent.collector.checks.check.Check): for dev_name, stats in filtered_io.iteritems(): filtered_stats = {stat: stats[stat] for stat in stats.iterkeys() if stat not in self.stat_blacklist} - m_list = [monagent.common.metrics.Measurement(key, timestamp, value, {'device': dev_name, - 'service': 'monitoring', - 'component': 'monasca-agent'}, - None) + m_list = [monasca_agent.common.metrics.Measurement(key, + timestamp, + value, + {'device': dev_name, + 'service': 'monitoring', + 'component': 'monasca-agent'}, + None) for key, value in filtered_stats.iteritems()] measurements.extend(m_list) @@ -426,10 +429,10 @@ class IO(monagent.collector.checks.check.Check): return {} -class Load(monagent.collector.checks.check.Check): +class Load(monasca_agent.collector.checks.check.Check): def check(self): - if monagent.common.util.Platform.is_linux(): + if monasca_agent.common.util.Platform.is_linux(): try: loadAvrgProc = open('/proc/loadavg', 'r') uptime = loadAvrgProc.readlines() @@ -458,10 +461,10 @@ class Load(monagent.collector.checks.check.Check): } -class Memory(monagent.collector.checks.check.Check): +class Memory(monasca_agent.collector.checks.check.Check): def __init__(self, logger): - monagent.collector.checks.check.Check.__init__(self, logger) + monasca_agent.collector.checks.check.Check.__init__(self, logger) macV = None if sys.platform == 'darwin': macV = platform.mac_ver() @@ -485,7 +488,7 @@ class Memory(monagent.collector.checks.check.Check): pass def check(self): - if monagent.common.util.Platform.is_linux(): + if monasca_agent.common.util.Platform.is_linux(): try: meminfoProc = open('/proc/meminfo', 'r') lines = meminfoProc.readlines() @@ -756,7 +759,7 @@ class Memory(monagent.collector.checks.check.Check): return {} -class Cpu(monagent.collector.checks.check.Check): +class Cpu(monasca_agent.collector.checks.check.Check): def check(self): """Return an aggregate of CPU stats across all CPUs. @@ -789,7 +792,7 @@ class Cpu(monagent.collector.checks.check.Check): self.logger.debug("Cannot extract cpu value %s from %s (%s)" % (name, data, legend)) return 0.0 - if monagent.common.util.Platform.is_linux(): + if monasca_agent.common.util.Platform.is_linux(): mpstat = sp.Popen(['mpstat', '1', '3'], stdout=sp.PIPE, close_fds=True).communicate()[0] # topdog@ip:~$ mpstat 1 3 # Linux 2.6.32-341-ec2 (ip) 01/19/2012 _x86_64_ (2 CPU) diff --git a/monagent/collector/checks/system/win32.py b/monasca_agent/collector/checks/system/win32.py similarity index 91% rename from monagent/collector/checks/system/win32.py rename to monasca_agent/collector/checks/system/win32.py index 7e85fd66..ddb0d3b6 100644 --- a/monagent/collector/checks/system/win32.py +++ b/monasca_agent/collector/checks/system/win32.py @@ -1,4 +1,4 @@ -import monagent.collector.checks.check +import monasca_agent.collector.checks.check try: import wmi @@ -15,10 +15,10 @@ B2MB = float(1048576) KB2MB = B2KB = float(1024) -class Processes(monagent.collector.checks.check.Check): +class Processes(monasca_agent.collector.checks.check.Check): def __init__(self, logger): - monagent.collector.checks.check.Check.__init__(self, logger) + monasca_agent.collector.checks.check.Check.__init__(self, logger) self.gauge('system.proc.queue_length') self.gauge('system.proc.count') @@ -44,10 +44,10 @@ class Processes(monagent.collector.checks.check.Check): return self.get_metrics() -class Memory(monagent.collector.checks.check.Check): +class Memory(monasca_agent.collector.checks.check.Check): def __init__(self, logger): - monagent.collector.checks.check.Check.__init__(self, logger) + monasca_agent.collector.checks.check.Check.__init__(self, logger) self.logger = logger self.gauge('system.mem.free') self.gauge('system.mem.used') @@ -84,10 +84,10 @@ class Memory(monagent.collector.checks.check.Check): return self.get_metrics() -class Cpu(monagent.collector.checks.check.Check): +class Cpu(monasca_agent.collector.checks.check.Check): def __init__(self, logger): - monagent.collector.checks.check.Check.__init__(self, logger) + monasca_agent.collector.checks.check.Check.__init__(self, logger) self.logger = logger self.gauge('system.cpu.user') self.gauge('system.cpu.idle') @@ -143,10 +143,10 @@ class Cpu(monagent.collector.checks.check.Check): return val -class Network(monagent.collector.checks.check.Check): +class Network(monasca_agent.collector.checks.check.Check): def __init__(self, logger): - monagent.collector.checks.check.Check.__init__(self, logger) + monasca_agent.collector.checks.check.Check.__init__(self, logger) self.logger = logger self.gauge('system.net.bytes_rcvd') self.gauge('system.net.bytes_sent') @@ -170,10 +170,10 @@ class Network(monagent.collector.checks.check.Check): return self.get_metrics() -class Disk(monagent.collector.checks.check.Check): +class Disk(monasca_agent.collector.checks.check.Check): def __init__(self, logger): - monagent.collector.checks.check.Check.__init__(self, logger) + monasca_agent.collector.checks.check.Check.__init__(self, logger) self.logger = logger self.gauge('system.disk.free') self.gauge('system.disk.total') @@ -204,10 +204,10 @@ class Disk(monagent.collector.checks.check.Check): return self.get_metrics() -class IO(monagent.collector.checks.check.Check): +class IO(monasca_agent.collector.checks.check.Check): def __init__(self, logger): - monagent.collector.checks.check.Check.__init__(self, logger) + monasca_agent.collector.checks.check.Check.__init__(self, logger) self.logger = logger self.gauge('system.io.wkb_s') self.gauge('system.io.w_s') diff --git a/monagent/collector/checks/utils.py b/monasca_agent/collector/checks/utils.py similarity index 100% rename from monagent/collector/checks/utils.py rename to monasca_agent/collector/checks/utils.py diff --git a/monagent/collector/checks_d/__init__.py b/monasca_agent/collector/checks_d/__init__.py similarity index 100% rename from monagent/collector/checks_d/__init__.py rename to monasca_agent/collector/checks_d/__init__.py diff --git a/monagent/collector/checks_d/apache.py b/monasca_agent/collector/checks_d/apache.py similarity index 95% rename from monagent/collector/checks_d/apache.py rename to monasca_agent/collector/checks_d/apache.py index 7c802cb9..d461feb2 100644 --- a/monagent/collector/checks_d/apache.py +++ b/monasca_agent/collector/checks_d/apache.py @@ -1,8 +1,8 @@ import urllib2 -from monagent.collector.checks import AgentCheck -from monagent.collector.checks.utils import add_basic_auth -from monagent.common.util import headers +from monasca_agent.collector.checks import AgentCheck +from monasca_agent.collector.checks.utils import add_basic_auth +from monasca_agent.common.util import headers class Apache(AgentCheck): diff --git a/monagent/collector/checks_d/cacti.py b/monasca_agent/collector/checks_d/cacti.py similarity index 99% rename from monagent/collector/checks_d/cacti.py rename to monasca_agent/collector/checks_d/cacti.py index 528b56f0..c9a398c2 100644 --- a/monagent/collector/checks_d/cacti.py +++ b/monasca_agent/collector/checks_d/cacti.py @@ -3,7 +3,7 @@ from fnmatch import fnmatch import os import time -from monagent.collector.checks import AgentCheck +from monasca_agent.collector.checks import AgentCheck CFUNC_TO_AGGR = { 'AVERAGE': 'avg', diff --git a/monagent/collector/checks_d/couch.py b/monasca_agent/collector/checks_d/couch.py similarity index 96% rename from monagent/collector/checks_d/couch.py rename to monasca_agent/collector/checks_d/couch.py index 2e26ed9b..d1d8409e 100644 --- a/monagent/collector/checks_d/couch.py +++ b/monasca_agent/collector/checks_d/couch.py @@ -1,8 +1,8 @@ import json import urllib2 -from monagent.collector.checks import AgentCheck -from monagent.common.util import headers +from monasca_agent.collector.checks import AgentCheck +from monasca_agent.common.util import headers class CouchDb(AgentCheck): diff --git a/monagent/collector/checks_d/couchbase.py b/monasca_agent/collector/checks_d/couchbase.py similarity index 96% rename from monagent/collector/checks_d/couchbase.py rename to monasca_agent/collector/checks_d/couchbase.py index 14be8cd8..8d8ef4a2 100644 --- a/monagent/collector/checks_d/couchbase.py +++ b/monasca_agent/collector/checks_d/couchbase.py @@ -3,9 +3,9 @@ import urllib2 import re import sys -from monagent.collector.checks import AgentCheck -from monagent.collector.checks.utils import add_basic_auth -from monagent.common.util import headers +from monasca_agent.collector.checks import AgentCheck +from monasca_agent.collector.checks.utils import add_basic_auth +from monasca_agent.common.util import headers # Constants diff --git a/monagent/collector/checks_d/directory.py b/monasca_agent/collector/checks_d/directory.py similarity index 98% rename from monagent/collector/checks_d/directory.py rename to monasca_agent/collector/checks_d/directory.py index 8c064853..a70e54b0 100644 --- a/monagent/collector/checks_d/directory.py +++ b/monasca_agent/collector/checks_d/directory.py @@ -6,7 +6,7 @@ from os.path import exists from os.path import join import time -from monagent.collector.checks import AgentCheck +from monasca_agent.collector.checks import AgentCheck class DirectoryCheck(AgentCheck): diff --git a/monagent/collector/checks_d/docker.py b/monasca_agent/collector/checks_d/docker.py similarity index 99% rename from monagent/collector/checks_d/docker.py rename to monasca_agent/collector/checks_d/docker.py index 7ac31b35..c61502ed 100644 --- a/monagent/collector/checks_d/docker.py +++ b/monasca_agent/collector/checks_d/docker.py @@ -7,7 +7,7 @@ import urllib2 import urllib from urlparse import urlsplit -from monagent.collector.checks import AgentCheck +from monasca_agent.collector.checks import AgentCheck DEFAULT_MAX_CONTAINERS = 20 diff --git a/monagent/collector/checks_d/elastic.py b/monasca_agent/collector/checks_d/elastic.py similarity index 99% rename from monagent/collector/checks_d/elastic.py rename to monasca_agent/collector/checks_d/elastic.py index b0692650..a63ab54f 100644 --- a/monagent/collector/checks_d/elastic.py +++ b/monasca_agent/collector/checks_d/elastic.py @@ -6,9 +6,9 @@ import time import urllib2 import urlparse -from monagent.collector.checks import AgentCheck -from monagent.collector.checks.utils import add_basic_auth -from monagent.common.util import headers +from monasca_agent.collector.checks import AgentCheck +from monasca_agent.collector.checks.utils import add_basic_auth +from monasca_agent.common.util import headers class NodeNotFound(Exception): diff --git a/monagent/collector/checks_d/gearmand.py b/monasca_agent/collector/checks_d/gearmand.py similarity index 97% rename from monagent/collector/checks_d/gearmand.py rename to monasca_agent/collector/checks_d/gearmand.py index c482b958..0977aeaa 100644 --- a/monagent/collector/checks_d/gearmand.py +++ b/monasca_agent/collector/checks_d/gearmand.py @@ -1,4 +1,4 @@ -from monagent.collector.checks import AgentCheck +from monasca_agent.collector.checks import AgentCheck class Gearman(AgentCheck): diff --git a/monagent/collector/checks_d/gunicorn.py b/monasca_agent/collector/checks_d/gunicorn.py similarity index 98% rename from monagent/collector/checks_d/gunicorn.py rename to monasca_agent/collector/checks_d/gunicorn.py index b576d62b..4a67302d 100644 --- a/monagent/collector/checks_d/gunicorn.py +++ b/monasca_agent/collector/checks_d/gunicorn.py @@ -13,7 +13,7 @@ except ImportError: psutil = None # project -from monagent.collector.checks import AgentCheck +from monasca_agent.collector.checks import AgentCheck class GUnicornCheck(AgentCheck): diff --git a/monagent/collector/checks_d/haproxy.py b/monasca_agent/collector/checks_d/haproxy.py similarity index 99% rename from monagent/collector/checks_d/haproxy.py rename to monasca_agent/collector/checks_d/haproxy.py index c586c296..3dcbc605 100644 --- a/monagent/collector/checks_d/haproxy.py +++ b/monasca_agent/collector/checks_d/haproxy.py @@ -2,8 +2,8 @@ from collections import defaultdict import time import urllib2 -from monagent.collector.checks import AgentCheck -from monagent.common.util import headers +from monasca_agent.collector.checks import AgentCheck +from monasca_agent.common.util import headers STATS_URL = "/;csv;norefresh" diff --git a/monagent/collector/checks_d/hdfs.py b/monasca_agent/collector/checks_d/hdfs.py similarity index 97% rename from monagent/collector/checks_d/hdfs.py rename to monasca_agent/collector/checks_d/hdfs.py index 321b0bec..c512525c 100644 --- a/monagent/collector/checks_d/hdfs.py +++ b/monasca_agent/collector/checks_d/hdfs.py @@ -1,4 +1,4 @@ -from monagent.collector.checks import AgentCheck +from monasca_agent.collector.checks import AgentCheck class HDFSCheck(AgentCheck): diff --git a/monagent/collector/checks_d/host_alive.py b/monasca_agent/collector/checks_d/host_alive.py similarity index 96% rename from monagent/collector/checks_d/host_alive.py rename to monasca_agent/collector/checks_d/host_alive.py index d00490f5..6caabc82 100644 --- a/monagent/collector/checks_d/host_alive.py +++ b/monasca_agent/collector/checks_d/host_alive.py @@ -7,8 +7,8 @@ import socket import subprocess import sys -from monagent.collector.checks.services_checks import ServicesCheck -from monagent.collector.checks.services_checks import Status +from monasca_agent.collector.checks.services_checks import ServicesCheck +from monasca_agent.collector.checks.services_checks import Status class HostAlive(ServicesCheck): diff --git a/monagent/collector/checks_d/http_check.py b/monasca_agent/collector/checks_d/http_check.py similarity index 96% rename from monagent/collector/checks_d/http_check.py rename to monasca_agent/collector/checks_d/http_check.py index 6e1de877..76047ddd 100644 --- a/monagent/collector/checks_d/http_check.py +++ b/monasca_agent/collector/checks_d/http_check.py @@ -12,10 +12,9 @@ from httplib2 import Http from httplib2 import httplib from httplib2 import HttpLib2Error -from monagent.collector.checks.check import AgentCheck -from monagent.collector.checks.services_checks import ServicesCheck -from monagent.collector.checks.services_checks import Status -from monagent.common.keystone import Keystone +from monasca_agent.collector.checks.check import AgentCheck +from monasca_agent.collector.checks.services_checks import ServicesCheck +from monasca_agent.collector.checks.services_checks import Status class HTTPCheck(ServicesCheck): diff --git a/monagent/collector/checks_d/iis.py b/monasca_agent/collector/checks_d/iis.py similarity index 98% rename from monagent/collector/checks_d/iis.py rename to monasca_agent/collector/checks_d/iis.py index 950bce57..9daf46f8 100644 --- a/monagent/collector/checks_d/iis.py +++ b/monasca_agent/collector/checks_d/iis.py @@ -6,7 +6,7 @@ try: except Exception: wmi = None -from monagent.collector.checks import AgentCheck +from monasca_agent.collector.checks import AgentCheck class IIS(AgentCheck): diff --git a/monagent/collector/checks_d/jenkins.py b/monasca_agent/collector/checks_d/jenkins.py similarity index 98% rename from monagent/collector/checks_d/jenkins.py rename to monasca_agent/collector/checks_d/jenkins.py index a45e7006..5198e8b1 100644 --- a/monagent/collector/checks_d/jenkins.py +++ b/monasca_agent/collector/checks_d/jenkins.py @@ -11,8 +11,8 @@ except ImportError: except ImportError: pass -from monagent.collector.checks import AgentCheck -from monagent.common.util import get_hostname +from monasca_agent.collector.checks import AgentCheck +from monasca_agent.common.util import get_hostname class Skip(Exception): diff --git a/monagent/collector/checks_d/kafka_consumer.py b/monasca_agent/collector/checks_d/kafka_consumer.py similarity index 99% rename from monagent/collector/checks_d/kafka_consumer.py rename to monasca_agent/collector/checks_d/kafka_consumer.py index 8591b008..378a8953 100644 --- a/monagent/collector/checks_d/kafka_consumer.py +++ b/monasca_agent/collector/checks_d/kafka_consumer.py @@ -7,7 +7,7 @@ if sys.version_info < (2, 6): raise Exception('kafka_consumer check requires at least Python 2.6') from collections import defaultdict -from monagent.collector.checks import AgentCheck +from monasca_agent.collector.checks import AgentCheck try: from kafka.client import KafkaClient diff --git a/monagent/collector/checks_d/kyototycoon.py b/monasca_agent/collector/checks_d/kyototycoon.py similarity index 98% rename from monagent/collector/checks_d/kyototycoon.py rename to monasca_agent/collector/checks_d/kyototycoon.py index 5e9cd818..aac02fe4 100644 --- a/monagent/collector/checks_d/kyototycoon.py +++ b/monasca_agent/collector/checks_d/kyototycoon.py @@ -2,7 +2,7 @@ from collections import defaultdict import re import urllib2 -from monagent.collector.checks import AgentCheck +from monasca_agent.collector.checks import AgentCheck db_stats = re.compile(r'^db_(\d)+$') diff --git a/monagent/collector/checks_d/libvirt.py b/monasca_agent/collector/checks_d/libvirt.py similarity index 99% rename from monagent/collector/checks_d/libvirt.py rename to monasca_agent/collector/checks_d/libvirt.py index 03ae4afd..67d3114e 100644 --- a/monagent/collector/checks_d/libvirt.py +++ b/monasca_agent/collector/checks_d/libvirt.py @@ -22,8 +22,8 @@ import yaml from calendar import timegm from datetime import datetime -from monagent.collector.virt import inspector -from monagent.collector.checks import AgentCheck +from monasca_agent.collector.virt import inspector +from monasca_agent.collector.checks import AgentCheck class LibvirtCheck(AgentCheck): diff --git a/monagent/collector/checks_d/lighttpd.py b/monasca_agent/collector/checks_d/lighttpd.py similarity index 97% rename from monagent/collector/checks_d/lighttpd.py rename to monasca_agent/collector/checks_d/lighttpd.py index 6153a60a..e28e5cc9 100644 --- a/monagent/collector/checks_d/lighttpd.py +++ b/monasca_agent/collector/checks_d/lighttpd.py @@ -1,8 +1,8 @@ import urllib2 -from monagent.collector.checks import AgentCheck -from monagent.collector.checks.utils import add_basic_auth -from monagent.common.util import headers +from monasca_agent.collector.checks import AgentCheck +from monasca_agent.collector.checks.utils import add_basic_auth +from monasca_agent.common.util import headers class Lighttpd(AgentCheck): diff --git a/monagent/collector/checks_d/mcache.py b/monasca_agent/collector/checks_d/mcache.py similarity index 99% rename from monagent/collector/checks_d/mcache.py rename to monasca_agent/collector/checks_d/mcache.py index 83d521bf..6f9c0d20 100644 --- a/monagent/collector/checks_d/mcache.py +++ b/monasca_agent/collector/checks_d/mcache.py @@ -1,4 +1,4 @@ -from monagent.collector.checks import AgentCheck +from monasca_agent.collector.checks import AgentCheck # Reference: http://code.sixapart.com/svn/memcached/trunk/server/doc/protocol.txt # Name Type Meaning diff --git a/monagent/collector/checks_d/mongo.py b/monasca_agent/collector/checks_d/mongo.py similarity index 98% rename from monagent/collector/checks_d/mongo.py rename to monasca_agent/collector/checks_d/mongo.py index 413f55ef..081cdb39 100644 --- a/monagent/collector/checks_d/mongo.py +++ b/monasca_agent/collector/checks_d/mongo.py @@ -2,8 +2,8 @@ import re import time import types -from monagent.collector.checks import AgentCheck -from monagent.common.util import get_hostname +from monasca_agent.collector.checks import AgentCheck +from monasca_agent.common.util import get_hostname # When running with pymongo < 2.0 diff --git a/monagent/collector/checks_d/mysql.py b/monasca_agent/collector/checks_d/mysql.py similarity index 99% rename from monagent/collector/checks_d/mysql.py rename to monasca_agent/collector/checks_d/mysql.py index 77d71c2d..ef853a56 100644 --- a/monagent/collector/checks_d/mysql.py +++ b/monasca_agent/collector/checks_d/mysql.py @@ -4,7 +4,7 @@ import subprocess import sys import traceback -from monagent.collector.checks import AgentCheck +from monasca_agent.collector.checks import AgentCheck GAUGE = "gauge" diff --git a/monagent/collector/checks_d/nagios_wrapper.py b/monasca_agent/collector/checks_d/nagios_wrapper.py similarity index 97% rename from monagent/collector/checks_d/nagios_wrapper.py rename to monasca_agent/collector/checks_d/nagios_wrapper.py index 1051139f..6d1d4890 100644 --- a/monagent/collector/checks_d/nagios_wrapper.py +++ b/monasca_agent/collector/checks_d/nagios_wrapper.py @@ -11,7 +11,7 @@ import socket import subprocess import time -from monagent.collector.checks.services_checks import ServicesCheck, Status +from monasca_agent.collector.checks.services_checks import ServicesCheck, Status class WrapNagios(ServicesCheck): diff --git a/monagent/collector/checks_d/network.py b/monasca_agent/collector/checks_d/network.py similarity index 99% rename from monagent/collector/checks_d/network.py rename to monasca_agent/collector/checks_d/network.py index b52720de..56984100 100644 --- a/monagent/collector/checks_d/network.py +++ b/monasca_agent/collector/checks_d/network.py @@ -7,8 +7,8 @@ import re import subprocess # project -from monagent.collector.checks import AgentCheck -from monagent.common.util import Platform +from monasca_agent.collector.checks import AgentCheck +from monasca_agent.common.util import Platform class Network(AgentCheck): diff --git a/monagent/collector/checks_d/nginx.py b/monasca_agent/collector/checks_d/nginx.py similarity index 95% rename from monagent/collector/checks_d/nginx.py rename to monasca_agent/collector/checks_d/nginx.py index 94e773c2..5fbfab8d 100644 --- a/monagent/collector/checks_d/nginx.py +++ b/monasca_agent/collector/checks_d/nginx.py @@ -1,9 +1,9 @@ import re import urllib2 -from monagent.collector.checks import AgentCheck -from monagent.collector.checks.utils import add_basic_auth -from monagent.common.util import headers +from monasca_agent.collector.checks import AgentCheck +from monasca_agent.collector.checks.utils import add_basic_auth +from monasca_agent.common.util import headers class Nginx(AgentCheck): diff --git a/monagent/collector/checks_d/postfix.py b/monasca_agent/collector/checks_d/postfix.py similarity index 97% rename from monagent/collector/checks_d/postfix.py rename to monasca_agent/collector/checks_d/postfix.py index 4d6547a1..23a98bc1 100644 --- a/monagent/collector/checks_d/postfix.py +++ b/monasca_agent/collector/checks_d/postfix.py @@ -1,6 +1,6 @@ import os -from monagent.collector.checks import AgentCheck +from monasca_agent.collector.checks import AgentCheck class PostfixCheck(AgentCheck): diff --git a/monagent/collector/checks_d/postgres.py b/monasca_agent/collector/checks_d/postgres.py similarity index 98% rename from monagent/collector/checks_d/postgres.py rename to monasca_agent/collector/checks_d/postgres.py index 3a58282d..b7109b8b 100644 --- a/monagent/collector/checks_d/postgres.py +++ b/monasca_agent/collector/checks_d/postgres.py @@ -1,5 +1,5 @@ -from monagent.collector.checks import AgentCheck -from monagent.common.exceptions import CheckException +from monasca_agent.collector.checks import AgentCheck +from monasca_agent.common.exceptions import CheckException class ShouldRestartException(Exception): diff --git a/monagent/collector/checks_d/process.py b/monasca_agent/collector/checks_d/process.py similarity index 98% rename from monagent/collector/checks_d/process.py rename to monasca_agent/collector/checks_d/process.py index 38786a38..43206fc2 100644 --- a/monagent/collector/checks_d/process.py +++ b/monasca_agent/collector/checks_d/process.py @@ -1,8 +1,8 @@ """Gather metrics on specific processes. """ -from monagent.collector.checks import AgentCheck -from monagent.common.util import Platform +from monasca_agent.collector.checks import AgentCheck +from monasca_agent.common.util import Platform class ProcessCheck(AgentCheck): diff --git a/monagent/collector/checks_d/rabbitmq.py b/monasca_agent/collector/checks_d/rabbitmq.py similarity index 99% rename from monagent/collector/checks_d/rabbitmq.py rename to monasca_agent/collector/checks_d/rabbitmq.py index 122d26b8..81aad02f 100644 --- a/monagent/collector/checks_d/rabbitmq.py +++ b/monasca_agent/collector/checks_d/rabbitmq.py @@ -3,7 +3,7 @@ import time import urllib2 import urlparse -from monagent.collector.checks import AgentCheck +from monasca_agent.collector.checks import AgentCheck EVENT_TYPE = SOURCE_TYPE_NAME = 'rabbitmq' diff --git a/monagent/collector/checks_d/redisdb.py b/monasca_agent/collector/checks_d/redisdb.py similarity index 99% rename from monagent/collector/checks_d/redisdb.py rename to monasca_agent/collector/checks_d/redisdb.py index 7e1440cb..b57497c0 100644 --- a/monagent/collector/checks_d/redisdb.py +++ b/monasca_agent/collector/checks_d/redisdb.py @@ -4,7 +4,7 @@ import re import time -from monagent.collector.checks import AgentCheck +from monasca_agent.collector.checks import AgentCheck class Redis(AgentCheck): diff --git a/monagent/collector/checks_d/riak.py b/monasca_agent/collector/checks_d/riak.py similarity index 98% rename from monagent/collector/checks_d/riak.py rename to monasca_agent/collector/checks_d/riak.py index ea6b3122..237b3d5b 100644 --- a/monagent/collector/checks_d/riak.py +++ b/monasca_agent/collector/checks_d/riak.py @@ -5,7 +5,7 @@ import json import socket import time -from monagent.collector.checks import AgentCheck +from monasca_agent.collector.checks import AgentCheck class Riak(AgentCheck): diff --git a/monagent/collector/checks_d/sqlserver.py b/monasca_agent/collector/checks_d/sqlserver.py similarity index 99% rename from monagent/collector/checks_d/sqlserver.py rename to monasca_agent/collector/checks_d/sqlserver.py index c23a5a48..44730a3b 100644 --- a/monagent/collector/checks_d/sqlserver.py +++ b/monasca_agent/collector/checks_d/sqlserver.py @@ -3,7 +3,7 @@ """ import traceback -from monagent.collector.checks import AgentCheck +from monasca_agent.collector.checks import AgentCheck ALL_INSTANCES = 'ALL' diff --git a/monagent/collector/checks_d/tcp_check.py b/monasca_agent/collector/checks_d/tcp_check.py similarity index 96% rename from monagent/collector/checks_d/tcp_check.py rename to monasca_agent/collector/checks_d/tcp_check.py index d4aa4c42..27c07e78 100644 --- a/monagent/collector/checks_d/tcp_check.py +++ b/monasca_agent/collector/checks_d/tcp_check.py @@ -1,9 +1,9 @@ import socket import time -from monagent.collector.checks.services_checks import EventType -from monagent.collector.checks.services_checks import ServicesCheck -from monagent.collector.checks.services_checks import Status +from monasca_agent.collector.checks.services_checks import EventType +from monasca_agent.collector.checks.services_checks import ServicesCheck +from monasca_agent.collector.checks.services_checks import Status class BadConfException(Exception): diff --git a/monagent/collector/checks_d/varnish.py b/monasca_agent/collector/checks_d/varnish.py similarity index 99% rename from monagent/collector/checks_d/varnish.py rename to monasca_agent/collector/checks_d/varnish.py index 4f893592..6a580602 100644 --- a/monagent/collector/checks_d/varnish.py +++ b/monasca_agent/collector/checks_d/varnish.py @@ -2,7 +2,7 @@ import re import subprocess import xml.parsers.expat # python 2.4 compatible -from monagent.collector.checks import AgentCheck +from monasca_agent.collector.checks import AgentCheck class Varnish(AgentCheck): diff --git a/monagent/collector/checks_d/win32_event_log.py b/monasca_agent/collector/checks_d/win32_event_log.py similarity index 99% rename from monagent/collector/checks_d/win32_event_log.py rename to monasca_agent/collector/checks_d/win32_event_log.py index 6da661a6..42697052 100644 --- a/monagent/collector/checks_d/win32_event_log.py +++ b/monasca_agent/collector/checks_d/win32_event_log.py @@ -8,7 +8,7 @@ try: except Exception: wmi = None -from monagent.collector.checks import AgentCheck +from monasca_agent.collector.checks import AgentCheck SOURCE_TYPE_NAME = 'event viewer' EVENT_TYPE = 'win32_log_event' diff --git a/monagent/collector/checks_d/wmi_check.py b/monasca_agent/collector/checks_d/wmi_check.py similarity index 98% rename from monagent/collector/checks_d/wmi_check.py rename to monasca_agent/collector/checks_d/wmi_check.py index fd0cb55e..9e667f8e 100644 --- a/monagent/collector/checks_d/wmi_check.py +++ b/monasca_agent/collector/checks_d/wmi_check.py @@ -9,7 +9,7 @@ try: except Exception: wmi = None -from monagent.collector.checks import AgentCheck +from monasca_agent.collector.checks import AgentCheck UP_METRIC = 'Up' SEARCH_WILDCARD = '*' diff --git a/monagent/collector/checks_d/zk.py b/monasca_agent/collector/checks_d/zk.py similarity index 99% rename from monagent/collector/checks_d/zk.py rename to monasca_agent/collector/checks_d/zk.py index 48ef073c..6d1d2cb7 100644 --- a/monagent/collector/checks_d/zk.py +++ b/monasca_agent/collector/checks_d/zk.py @@ -27,7 +27,7 @@ import socket from StringIO import StringIO import struct -from monagent.collector.checks import AgentCheck +from monasca_agent.collector.checks import AgentCheck class Zookeeper(AgentCheck): diff --git a/monagent/collector/daemon.py b/monasca_agent/collector/daemon.py similarity index 82% rename from monagent/collector/daemon.py rename to monasca_agent/collector/daemon.py index 6b924ea4..401956b3 100644 --- a/monagent/collector/daemon.py +++ b/monasca_agent/collector/daemon.py @@ -11,14 +11,14 @@ import time # Custom modules import checks.collector import jmxfetch -import monagent.common.check_status -import monagent.common.config -import monagent.common.daemon -import monagent.common.emitter -import monagent.common.util +import monasca_agent.common.check_status +import monasca_agent.common.config +import monasca_agent.common.daemon +import monasca_agent.common.emitter +import monasca_agent.common.util # set up logging before importing any other components -monagent.common.config.initialize_logging('collector') +monasca_agent.common.config.initialize_logging('collector') os.umask(0o22) # Check we're not using an old version of Python. We need 2.4 above because @@ -39,14 +39,14 @@ log = logging.getLogger('collector') # todo the collector has daemon code but is always run in foreground mode # from the supervisor, is there a reason for the daemon code then? -class CollectorDaemon(monagent.common.daemon.Daemon): +class CollectorDaemon(monasca_agent.common.daemon.Daemon): """The agent class is a daemon that runs the collector in a background process. """ def __init__(self, pidfile, autorestart, start_event=True): - monagent.common.daemon.Daemon.__init__(self, pidfile, autorestart=autorestart) + monasca_agent.common.daemon.Daemon.__init__(self, pidfile, autorestart=autorestart) self.run_forever = True self.collector = None self.start_event = start_event @@ -68,7 +68,7 @@ class CollectorDaemon(monagent.common.daemon.Daemon): def info(self, verbose=None): logging.getLogger().setLevel(logging.ERROR) - return monagent.common.check_status.CollectorStatus.print_latest_status(verbose=verbose) + return monasca_agent.common.check_status.CollectorStatus.print_latest_status(verbose=verbose) def run(self, config=None): """Main loop of the collector. @@ -85,15 +85,15 @@ class CollectorDaemon(monagent.common.daemon.Daemon): signal.signal(signal.SIGINT, self._handle_sigterm) # Save the agent start-up stats. - monagent.common.check_status.CollectorStatus().persist() + monasca_agent.common.check_status.CollectorStatus().persist() # Intialize the collector. if config is None: - config = monagent.common.config.get_config(parse_args=True) + config = monasca_agent.common.config.get_config(parse_args=True) # Load the checks_d checks - checksd = monagent.common.config.load_check_directory(config) - self.collector = checks.collector.Collector(config, monagent.common.emitter.http_emitter, checksd) + checksd = monasca_agent.common.config.load_check_directory(config) + self.collector = checks.collector.Collector(config, monasca_agent.common.emitter.http_emitter, checksd) # Configure the watchdog. check_frequency = int(config['check_freq']) @@ -147,7 +147,7 @@ class CollectorDaemon(monagent.common.daemon.Daemon): # Now clean-up. try: - monagent.common.check_status.CollectorStatus.remove_latest_status() + monasca_agent.common.check_status.CollectorStatus.remove_latest_status() except Exception: pass @@ -160,9 +160,9 @@ class CollectorDaemon(monagent.common.daemon.Daemon): def _get_watchdog(check_freq, agentConfig): watchdog = None if agentConfig.get("watchdog", True): - watchdog = monagent.common.util.Watchdog(check_freq * WATCHDOG_MULTIPLIER, - max_mem_mb=agentConfig.get('limit_memory_consumption', - None)) + watchdog = monasca_agent.common.util.Watchdog(check_freq * WATCHDOG_MULTIPLIER, + max_mem_mb=agentConfig.get('limit_memory_consumption', + None)) watchdog.reset() return watchdog @@ -175,12 +175,12 @@ class CollectorDaemon(monagent.common.daemon.Daemon): log.info("Running an auto-restart.") if self.collector: self.collector.stop() - sys.exit(monagent.common.daemon.AgentSupervisor.RESTART_EXIT_STATUS) + sys.exit(monasca_agent.common.daemon.AgentSupervisor.RESTART_EXIT_STATUS) def main(): - options, args = monagent.common.config.get_parsed_args() - agentConfig = monagent.common.config.get_config(options=options) + options, args = monasca_agent.common.config.get_parsed_args() + agentConfig = monasca_agent.common.config.get_config(options=options) # todo autorestart isn't used remove autorestart = agentConfig.get('autorestart', False) @@ -206,7 +206,7 @@ def main(): sys.stderr.write("Unknown command: %s\n" % command) return 3 - pid_file = monagent.common.util.PidFile('monasca-agent') + pid_file = monasca_agent.common.util.PidFile('monasca-agent') if options.clean: pid_file.clean() @@ -214,7 +214,7 @@ def main(): agent = CollectorDaemon(pid_file.get_path(), autorestart) if command in START_COMMANDS: - log.info('Agent version %s' % monagent.common.config.get_version()) + log.info('Agent version %s' % monasca_agent.common.config.get_version()) if 'start' == command: log.info('Start daemon') @@ -246,14 +246,14 @@ def main(): def parent_func(): agent.start_event = False - monagent.common.daemon.AgentSupervisor.start(parent_func, child_func) + monasca_agent.common.daemon.AgentSupervisor.start(parent_func, child_func) else: # Run in the standard foreground. agent.run(config=agentConfig) elif 'check' == command: check_name = args[1] - checks = monagent.common.config.load_check_directory(agentConfig) + checks = monasca_agent.common.config.load_check_directory(agentConfig) for check in checks['initialized_checks']: if check.name == check_name: check.run() @@ -268,7 +268,7 @@ def main(): elif 'check_all' == command: print("Loading check directory...") - checks = monagent.common.config.load_check_directory(agentConfig) + checks = monasca_agent.common.config.load_check_directory(agentConfig) print("...directory loaded.\n") for check in checks['initialized_checks']: print("#" * 80) @@ -279,12 +279,12 @@ def main(): print("#" * 80 + "\n\n") elif 'configcheck' == command or 'configtest' == command: - osname = monagent.common.util.get_os() + osname = monasca_agent.common.util.get_os() all_valid = True - for conf_path in glob.glob(os.path.join(monagent.common.config.get_confd_path(osname), "*.yaml")): + for conf_path in glob.glob(os.path.join(monasca_agent.common.config.get_confd_path(osname), "*.yaml")): basename = os.path.basename(conf_path) try: - monagent.common.config.check_yaml(conf_path) + monasca_agent.common.config.check_yaml(conf_path) except Exception as e: all_valid = False print("%s contains errors:\n %s" % (basename, e)) @@ -316,11 +316,11 @@ def main(): else: jmx_command = args[1] checks_list = args[2:] - confd_directory = monagent.common.config.get_confd_path(monagent.common.util.get_os()) + confd_directory = monasca_agent.common.config.get_confd_path(monasca_agent.common.util.get_os()) should_run = jmxfetch.JMXFetch.init( confd_directory, agentConfig, - monagent.common.config.get_logging_config(), + monasca_agent.common.config.get_logging_config(), 15, jmx_command, checks_list, diff --git a/monagent/collector/dogstream/__init__.py b/monasca_agent/collector/dogstream/__init__.py similarity index 100% rename from monagent/collector/dogstream/__init__.py rename to monasca_agent/collector/dogstream/__init__.py diff --git a/monagent/collector/dogstream/cassandra.py b/monasca_agent/collector/dogstream/cassandra.py similarity index 97% rename from monagent/collector/dogstream/cassandra.py rename to monasca_agent/collector/dogstream/cassandra.py index 35acfff1..2a8c6dd1 100644 --- a/monagent/collector/dogstream/cassandra.py +++ b/monasca_agent/collector/dogstream/cassandra.py @@ -1,7 +1,7 @@ from datetime import datetime import re -from monagent.collector.dogstream import common +from monasca_agent.collector.dogstream import common LOG4J_PRIORITY = [ diff --git a/monagent/collector/dogstream/common.py b/monasca_agent/collector/dogstream/common.py similarity index 100% rename from monagent/collector/dogstream/common.py rename to monasca_agent/collector/dogstream/common.py diff --git a/monagent/collector/dogstream/supervisord_log.py b/monasca_agent/collector/dogstream/supervisord_log.py similarity index 100% rename from monagent/collector/dogstream/supervisord_log.py rename to monasca_agent/collector/dogstream/supervisord_log.py diff --git a/monagent/collector/jmxfetch.py b/monasca_agent/collector/jmxfetch.py similarity index 98% rename from monagent/collector/jmxfetch.py rename to monasca_agent/collector/jmxfetch.py index 7a41ed8b..b756e36c 100644 --- a/monagent/collector/jmxfetch.py +++ b/monasca_agent/collector/jmxfetch.py @@ -8,7 +8,7 @@ import time import yaml -import monagent.common.util +import monasca_agent.common.util log = logging.getLogger(__name__) @@ -50,7 +50,7 @@ class InvalidJMXConfiguration(Exception): class JMXFetch(object): - pid_file = monagent.common.util.PidFile("jmxfetch") + pid_file = monasca_agent.common.util.PidFile("jmxfetch") pid_file_path = pid_file.get_path() @classmethod @@ -234,7 +234,7 @@ class JMXFetch(object): except Exception: return False - if monagent.common.util.get_os() != 'windows': + if monasca_agent.common.util.get_os() != 'windows': try: os.kill(pid, 0) # os.kill(pid, 0) will throw an exception if pid is not running @@ -290,7 +290,7 @@ class JMXFetch(object): @classmethod def get_path_to_jmxfetch(cls): - if monagent.common.util.get_os() != 'windows': + if monasca_agent.common.util.get_os() != 'windows': return os.path.realpath( os.path.join(os.path.abspath(__file__), "..", "../collector/checks", "libs", JMX_FETCH_JAR_NAME)) @@ -301,7 +301,7 @@ class JMXFetch(object): @classmethod def start(cls, confd_path, agentConfig, logging_config, path_to_java, java_run_opts, default_check_frequency, jmx_checks, command, reporter=None): - statsd_port = agentConfig.get('monstatsd_port', "8125") + statsd_port = agentConfig.get('monasca_statsd_port', "8125") if reporter is None: reporter = "statsd:%s" % str(statsd_port) diff --git a/monagent/collector/modules.py b/monasca_agent/collector/modules.py similarity index 100% rename from monagent/collector/modules.py rename to monasca_agent/collector/modules.py diff --git a/monagent/collector/virt/__init__.py b/monasca_agent/collector/virt/__init__.py similarity index 100% rename from monagent/collector/virt/__init__.py rename to monasca_agent/collector/virt/__init__.py diff --git a/monagent/collector/virt/hyperv/__init__.py b/monasca_agent/collector/virt/hyperv/__init__.py similarity index 100% rename from monagent/collector/virt/hyperv/__init__.py rename to monasca_agent/collector/virt/hyperv/__init__.py diff --git a/monagent/collector/virt/hyperv/inspector.py b/monasca_agent/collector/virt/hyperv/inspector.py similarity index 95% rename from monagent/collector/virt/hyperv/inspector.py rename to monasca_agent/collector/virt/hyperv/inspector.py index 81c37b73..b361dd4f 100644 --- a/monagent/collector/virt/hyperv/inspector.py +++ b/monasca_agent/collector/virt/hyperv/inspector.py @@ -18,8 +18,8 @@ from oslo.utils import units -from monagent.collector.virt.hyperv import utilsv2 -from monagent.collector.virt import inspector as virt_inspector +from monasca_agent.collector.virt.hyperv import utilsv2 +from monasca_agent.collector.virt import inspector as virt_inspector class HyperVInspector(virt_inspector.Inspector): diff --git a/monagent/collector/virt/hyperv/utilsv2.py b/monasca_agent/collector/virt/hyperv/utilsv2.py similarity index 99% rename from monagent/collector/virt/hyperv/utilsv2.py rename to monasca_agent/collector/virt/hyperv/utilsv2.py index 0973a5af..50417d17 100644 --- a/monagent/collector/virt/hyperv/utilsv2.py +++ b/monasca_agent/collector/virt/hyperv/utilsv2.py @@ -25,7 +25,7 @@ import sys if sys.platform == 'win32': import wmi -from monagent.collector.virt import inspector +from monasca_agent.collector.virt import inspector class HyperVException(inspector.InspectorException): diff --git a/monagent/collector/virt/inspector.py b/monasca_agent/collector/virt/inspector.py similarity index 99% rename from monagent/collector/virt/inspector.py rename to monasca_agent/collector/virt/inspector.py index 0777bfea..3ef22c2f 100644 --- a/monagent/collector/virt/inspector.py +++ b/monasca_agent/collector/virt/inspector.py @@ -215,7 +215,7 @@ class Inspector(object): def get_hypervisor_inspector(): try: - namespace = 'monagent.collector.virt' + namespace = 'monasca_agent.collector.virt' mgr = driver.DriverManager(namespace, cfg.CONF.hypervisor_inspector, invoke_on_load=True) diff --git a/monagent/collector/virt/libvirt/__init__.py b/monasca_agent/collector/virt/libvirt/__init__.py similarity index 100% rename from monagent/collector/virt/libvirt/__init__.py rename to monasca_agent/collector/virt/libvirt/__init__.py diff --git a/monagent/collector/virt/libvirt/inspector.py b/monasca_agent/collector/virt/libvirt/inspector.py similarity index 98% rename from monagent/collector/virt/libvirt/inspector.py rename to monasca_agent/collector/virt/libvirt/inspector.py index 6e3009a2..18e6665e 100644 --- a/monagent/collector/virt/libvirt/inspector.py +++ b/monasca_agent/collector/virt/libvirt/inspector.py @@ -20,7 +20,7 @@ from lxml import etree from oslo.config import cfg import six -from monagent.collector.virt import inspector as virt_inspector +from monasca_agent.collector.virt import inspector as virt_inspector libvirt = None diff --git a/monagent/collector/virt/vmware/__init__.py b/monasca_agent/collector/virt/vmware/__init__.py similarity index 100% rename from monagent/collector/virt/vmware/__init__.py rename to monasca_agent/collector/virt/vmware/__init__.py diff --git a/monagent/collector/virt/vmware/inspector.py b/monasca_agent/collector/virt/vmware/inspector.py similarity index 98% rename from monagent/collector/virt/vmware/inspector.py rename to monasca_agent/collector/virt/vmware/inspector.py index e8cc674e..6d23d37a 100644 --- a/monagent/collector/virt/vmware/inspector.py +++ b/monasca_agent/collector/virt/vmware/inspector.py @@ -19,8 +19,8 @@ from oslo.config import cfg from oslo.utils import units from oslo.vmware import api -from monagent.collector.virt import inspector as virt_inspector -from monagent.collector.virt.vmware import vsphere_operations +from monasca_agent.collector.virt import inspector as virt_inspector +from monasca_agent.collector.virt.vmware import vsphere_operations opt_group = cfg.OptGroup(name='vmware', diff --git a/monagent/collector/virt/vmware/vsphere_operations.py b/monasca_agent/collector/virt/vmware/vsphere_operations.py similarity index 100% rename from monagent/collector/virt/vmware/vsphere_operations.py rename to monasca_agent/collector/virt/vmware/vsphere_operations.py diff --git a/monagent/collector/virt/xenapi/__init__.py b/monasca_agent/collector/virt/xenapi/__init__.py similarity index 100% rename from monagent/collector/virt/xenapi/__init__.py rename to monasca_agent/collector/virt/xenapi/__init__.py diff --git a/monagent/collector/virt/xenapi/inspector.py b/monasca_agent/collector/virt/xenapi/inspector.py similarity index 99% rename from monagent/collector/virt/xenapi/inspector.py rename to monasca_agent/collector/virt/xenapi/inspector.py index 5124718c..4dbae5af 100644 --- a/monagent/collector/virt/xenapi/inspector.py +++ b/monasca_agent/collector/virt/xenapi/inspector.py @@ -24,7 +24,7 @@ except ImportError: api = None from ceilometer.compute.pollsters import util -from monagent.collector.virt import inspector as virt_inspector +from monasca_agent.collector.virt import inspector as virt_inspector opt_group = cfg.OptGroup(name='xenapi', title='Options for XenAPI') diff --git a/monagent/common/__init__.py b/monasca_agent/common/__init__.py similarity index 100% rename from monagent/common/__init__.py rename to monasca_agent/common/__init__.py diff --git a/monagent/common/aggregator.py b/monasca_agent/common/aggregator.py similarity index 98% rename from monagent/common/aggregator.py rename to monasca_agent/common/aggregator.py index 84b70268..0543e389 100644 --- a/monagent/common/aggregator.py +++ b/monasca_agent/common/aggregator.py @@ -1,9 +1,9 @@ -""" Aggregation classes used by the collector and monstatsd to batch messages sent to the forwarder. +""" Aggregation classes used by the collector and statsd to batch messages sent to the forwarder. """ import logging from time import time -from monagent.common.metrics import Gauge, BucketGauge, Counter, Histogram, Measurement, Set, Rate +from monasca_agent.common.metrics import Gauge, BucketGauge, Counter, Histogram, Measurement, Set, Rate log = logging.getLogger(__name__) diff --git a/monagent/common/check_status.py b/monasca_agent/common/check_status.py similarity index 99% rename from monagent/common/check_status.py rename to monasca_agent/common/check_status.py index 2e80e063..71cec66e 100644 --- a/monagent/common/check_status.py +++ b/monasca_agent/common/check_status.py @@ -512,9 +512,9 @@ class CollectorStatus(AgentStatus): return status_info -class MonstatsdStatus(AgentStatus): +class MonascaStatsdStatus(AgentStatus): - NAME = 'Monstatsd' + NAME = 'Monasca_Statsd' def __init__(self, flush_count=0, packet_count=0, packets_per_second=0, metric_count=0, event_count=0): diff --git a/monagent/common/config.py b/monasca_agent/common/config.py similarity index 96% rename from monagent/common/config.py rename to monasca_agent/common/config.py index 6e08c2de..60b2c68b 100644 --- a/monagent/common/config.py +++ b/monasca_agent/common/config.py @@ -25,7 +25,7 @@ except ImportError: # project from util import get_os -from monagent.collector.jmxfetch import JMXFetch, JMX_COLLECT_COMMAND +from monasca_agent.collector.jmxfetch import JMXFetch, JMX_COLLECT_COMMAND # CONSTANTS AGENT_CONF = "agent.conf" @@ -190,10 +190,10 @@ def get_config(parse_args=True, cfg_path=None, options=None): # General config agent_config = { 'check_freq': DEFAULT_CHECK_FREQUENCY, - 'monstatsd_interval': DEFAULT_STATSD_FREQUENCY, - 'monstatsd_agregator_bucket_size': DEFAULT_STATSD_BUCKET_SIZE, - 'monstatsd_normalize': 'yes', - 'monstatsd_port': 8125, + 'monasca_statsd_interval': DEFAULT_STATSD_FREQUENCY, + 'monasca_statsd_agregator_bucket_size': DEFAULT_STATSD_BUCKET_SIZE, + 'monasca_statsd_normalize': 'yes', + 'monasca_statsd_port': 8125, 'forwarder_url': 'http://localhost:17123', 'hostname': None, 'listen_port': None, @@ -202,8 +202,8 @@ def get_config(parse_args=True, cfg_path=None, options=None): 'additional_checksd': DEFAULT_CONFIG_DIR + '/checks_d/', } - monstatsd_interval = DEFAULT_STATSD_FREQUENCY - monstatsd_agregator_bucket_size = DEFAULT_STATSD_BUCKET_SIZE + monasca_statsd_interval = DEFAULT_STATSD_FREQUENCY + monasca_statsd_agregator_bucket_size = DEFAULT_STATSD_BUCKET_SIZE # Config handling try: @@ -258,14 +258,14 @@ def get_config(parse_args=True, cfg_path=None, options=None): if config.get('Main', 'watchdog').lower() in ('no', 'false'): agent_config['watchdog'] = False - # monstatsd config - monstatsd_defaults = { - 'monstatsd_port': 8125, - 'monstatsd_interval': monstatsd_interval, - 'monstatsd_agregator_bucket_size': monstatsd_agregator_bucket_size, - 'monstatsd_normalize': 'yes', + # monasca_statsd config + monasca_statsd_defaults = { + 'monasca_statsd_port': 8125, + 'monasca_statsd_interval': monasca_statsd_interval, + 'monasca_statsd_agregator_bucket_size': monasca_statsd_agregator_bucket_size, + 'monasca_statsd_normalize': 'yes', } - for key, value in monstatsd_defaults.iteritems(): + for key, value in monasca_statsd_defaults.iteritems(): if config.has_option('Main', key): agent_config[key] = config.get('Main', key) else: @@ -278,8 +278,8 @@ def get_config(parse_args=True, cfg_path=None, options=None): agent_config['statsd_forward_port'] = int(config.get('Main', 'statsd_forward_port')) # normalize 'yes'/'no' to boolean - monstatsd_defaults['monstatsd_normalize'] = _is_affirmative( - monstatsd_defaults['monstatsd_normalize']) + monasca_statsd_defaults['monasca_statsd_normalize'] = _is_affirmative( + monasca_statsd_defaults['monasca_statsd_normalize']) # Optional config # FIXME not the prettiest code ever... @@ -511,7 +511,7 @@ def load_check_directory(agent_config): ''' Return the initialized checks from checks_d, and a mapping of checks that failed to initialize. Only checks that have a configuration file in conf.d will be returned. ''' - from monagent.collector.checks import AgentCheck + from monasca_agent.collector.checks import AgentCheck initialized_checks = {} init_failed_checks = {} @@ -680,7 +680,7 @@ def get_logging_config(cfg_path=None): 'log_level': None, 'collector_log_file': DEFAULT_LOG_DIR + '/collector.log', 'forwarder_log_file': DEFAULT_LOG_DIR + '/forwarder.log', - 'monstatsd_log_file': DEFAULT_LOG_DIR + '/monstatsd.log', + 'statsd_log_file': DEFAULT_LOG_DIR + '/statsd.log', 'jmxfetch_log_file': DEFAULT_LOG_DIR + '/jmxfetch.log', 'log_to_event_viewer': False, 'log_to_syslog': True, diff --git a/monagent/common/daemon.py b/monasca_agent/common/daemon.py similarity index 100% rename from monagent/common/daemon.py rename to monasca_agent/common/daemon.py diff --git a/monagent/common/emitter.py b/monasca_agent/common/emitter.py similarity index 91% rename from monagent/common/emitter.py rename to monasca_agent/common/emitter.py index bbba779c..e685d05c 100644 --- a/monagent/common/emitter.py +++ b/monasca_agent/common/emitter.py @@ -2,7 +2,7 @@ from hashlib import md5 import json import urllib2 -from monagent.common.metrics import Measurement +from monasca_agent.common.metrics import Measurement def post_headers(payload): @@ -24,7 +24,7 @@ def http_emitter(message, log, url): partial_payload = [] for measurement in message: if not isinstance(measurement, Measurement): - log.error('Data was not in the form of a monagent.common.metrics.Measurement') + log.error('Data was not in the form of a monasca_agent.common.metrics.Measurement') continue # Measurements need their __dict__ encoded to avoid being expressed as a tuple partial_payload.append(measurement.__dict__) diff --git a/monagent/common/exceptions.py b/monasca_agent/common/exceptions.py similarity index 100% rename from monagent/common/exceptions.py rename to monasca_agent/common/exceptions.py diff --git a/monagent/common/keystone.py b/monasca_agent/common/keystone.py similarity index 100% rename from monagent/common/keystone.py rename to monasca_agent/common/keystone.py diff --git a/monagent/common/metrics.py b/monasca_agent/common/metrics.py similarity index 99% rename from monagent/common/metrics.py rename to monasca_agent/common/metrics.py index 7fd7d2bc..30b6e2fe 100644 --- a/monagent/common/metrics.py +++ b/monasca_agent/common/metrics.py @@ -4,7 +4,7 @@ from collections import namedtuple import logging from time import time -from monagent.common.exceptions import Infinity, UnknownValue +from monasca_agent.common.exceptions import Infinity, UnknownValue log = logging.getLogger(__name__) diff --git a/monagent/common/util.py b/monasca_agent/common/util.py similarity index 99% rename from monagent/common/util.py rename to monasca_agent/common/util.py index 190d2147..b4ba897d 100644 --- a/monagent/common/util.py +++ b/monasca_agent/common/util.py @@ -144,7 +144,7 @@ def get_hostname(config=None): # first, try the config if config is None: - from monagent.common.config import get_config + from monasca_agent.common.config import get_config config = get_config(parse_args=True) config_hostname = config.get('hostname') if config_hostname and is_valid_hostname(config_hostname): diff --git a/monagent/forwarder/__init__.py b/monasca_agent/forwarder/__init__.py similarity index 100% rename from monagent/forwarder/__init__.py rename to monasca_agent/forwarder/__init__.py diff --git a/monagent/forwarder/api/__init__.py b/monasca_agent/forwarder/api/__init__.py similarity index 100% rename from monagent/forwarder/api/__init__.py rename to monasca_agent/forwarder/api/__init__.py diff --git a/monagent/forwarder/api/mon.py b/monasca_agent/forwarder/api/mon.py similarity index 98% rename from monagent/forwarder/api/mon.py rename to monasca_agent/forwarder/api/mon.py index ea607874..b68a7396 100644 --- a/monagent/forwarder/api/mon.py +++ b/monasca_agent/forwarder/api/mon.py @@ -3,8 +3,8 @@ import logging from collections import deque from monascaclient import exc as exc, client -from monagent.common.keystone import Keystone -from monagent.common.util import get_hostname +from monasca_agent.common.keystone import Keystone +from monasca_agent.common.util import get_hostname import requests diff --git a/monagent/forwarder/daemon.py b/monasca_agent/forwarder/daemon.py similarity index 95% rename from monagent/forwarder/daemon.py rename to monasca_agent/forwarder/daemon.py index 4812c071..1a685a28 100644 --- a/monagent/forwarder/daemon.py +++ b/monasca_agent/forwarder/daemon.py @@ -11,11 +11,11 @@ """ # set up logging before importing any other components -from monagent.common.config import initialize_logging -from monagent.forwarder.api.mon import MonAPI +from monasca_agent.common.config import initialize_logging +from monasca_agent.forwarder.api.mon import MonAPI initialize_logging('forwarder') -from monagent.common.config import get_logging_config +from monasca_agent.common.config import get_logging_config import os os.umask(0o22) @@ -36,10 +36,10 @@ from tornado.escape import json_decode from tornado.options import define, parse_command_line, options # agent import -from monagent.common.check_status import ForwarderStatus -from monagent.common.config import get_config -from monagent.common.metrics import Measurement -from monagent.common.util import Watchdog, get_tornado_ioloop +from monasca_agent.common.check_status import ForwarderStatus +from monasca_agent.common.config import get_config +from monasca_agent.common.metrics import Measurement +from monasca_agent.common.util import Watchdog, get_tornado_ioloop from transaction import Transaction, TransactionManager log = logging.getLogger('forwarder') @@ -137,7 +137,7 @@ class AgentInputHandler(tornado.web.RequestHandler): """ # read the message it should be a list of - # monagent.common.metrics.Measurements expressed as a dict + # monasca_agent.common.metrics.Measurements expressed as a dict msg = tornado.escape.json_decode(self.request.body) try: measurements = [Measurement(**m) for m in msg] diff --git a/monagent/forwarder/transaction.py b/monasca_agent/forwarder/transaction.py similarity index 98% rename from monagent/forwarder/transaction.py rename to monasca_agent/forwarder/transaction.py index 940c60e9..b1a0f2ff 100644 --- a/monagent/forwarder/transaction.py +++ b/monasca_agent/forwarder/transaction.py @@ -6,8 +6,8 @@ import logging from operator import attrgetter # project -from monagent.common.check_status import ForwarderStatus -from monagent.common.util import get_tornado_ioloop, plural +from monasca_agent.common.check_status import ForwarderStatus +from monasca_agent.common.util import get_tornado_ioloop, plural log = logging.getLogger(__name__) diff --git a/monagent/monstatsd/__init__.py b/monasca_agent/statsd/__init__.py similarity index 100% rename from monagent/monstatsd/__init__.py rename to monasca_agent/statsd/__init__.py diff --git a/monagent/monstatsd/daemon.py b/monasca_agent/statsd/daemon.py similarity index 73% rename from monagent/monstatsd/daemon.py rename to monasca_agent/statsd/daemon.py index 795556b1..7ae81358 100644 --- a/monagent/monstatsd/daemon.py +++ b/monasca_agent/statsd/daemon.py @@ -4,11 +4,11 @@ A Python Statsd implementation with dimensions added """ # set up logging before importing any other components -from monagent.common.config import initialize_logging -from monagent.monstatsd.reporter import Reporter -from monagent.monstatsd.udp import Server +from monasca_agent.common.config import initialize_logging +from monasca_agent.statsd.reporter import Reporter +from monasca_agent.statsd.udp import Server -initialize_logging('monstatsd') +initialize_logging('monasca_statsd') import os os.umask(0o22) @@ -20,18 +20,18 @@ import signal import sys # project -from monagent.common.aggregator import MetricsBucketAggregator -from monagent.common.check_status import MonstatsdStatus -from monagent.common.config import get_config -from monagent.common.daemon import Daemon, AgentSupervisor -from monagent.common.util import PidFile, get_hostname +from monasca_agent.common.aggregator import MetricsBucketAggregator +from monasca_agent.common.check_status import MonascaStatsdStatus +from monasca_agent.common.config import get_config +from monasca_agent.common.daemon import Daemon, AgentSupervisor +from monasca_agent.common.util import PidFile, get_hostname -log = logging.getLogger('monstatsd') +log = logging.getLogger('monasca_statsd') -class Monstatsd(Daemon): +class MonascaStatsd(Daemon): - """ This class is the monstatsd daemon. """ + """ This class is the monasca_statsd daemon. """ def __init__(self, pid_file, server, reporter, autorestart): Daemon.__init__(self, pid_file, autorestart=autorestart) @@ -63,25 +63,25 @@ class Monstatsd(Daemon): # the reporting thread. self.reporter.stop() self.reporter.join() - log.info("Monstatsd is stopped") + log.info("monasca_statsd is stopped") # Restart if asked to restart if self.autorestart: sys.exit(AgentSupervisor.RESTART_EXIT_STATUS) def info(self): logging.getLogger().setLevel(logging.ERROR) - return MonstatsdStatus.print_latest_status() + return MonascaStatsdStatus.print_latest_status() -def init_monstatsd(config_path=None, use_watchdog=False): +def init_monasca_statsd(config_path=None, use_watchdog=False): """Configure the server and the reporting thread. """ c = get_config(parse_args=False, cfg_path=config_path) - log.debug("Configuration monstatsd") + log.debug("Configuration monasca_statsd") - port = c['monstatsd_port'] - interval = int(c['monstatsd_interval']) - aggregator_interval = int(c['monstatsd_agregator_bucket_size']) + port = c['monasca_statsd_port'] + interval = int(c['monasca_statsd_interval']) + aggregator_interval = int(c['monasca_statsd_agregator_bucket_size']) non_local_traffic = c['non_local_traffic'] forward_to_host = c.get('statsd_forward_host') forward_to_port = c.get('statsd_forward_port') @@ -119,14 +119,14 @@ def init_monstatsd(config_path=None, use_watchdog=False): def main(config_path=None): - """ The main entry point for the unix version of monstatsd. """ + """ The main entry point for the unix version of monasca_statsd. """ parser = optparse.OptionParser("%prog [start|stop|restart|status]") opts, args = parser.parse_args() - reporter, server, cnf = init_monstatsd(config_path, use_watchdog=True) - pid_file = PidFile('monstatsd') - daemon = Monstatsd(pid_file.get_path(), server, reporter, - cnf.get('autorestart', False)) + reporter, server, cnf = init_monasca_statsd(config_path, use_watchdog=True) + pid_file = PidFile('monasca_statsd') + daemon = monasca_statsd(pid_file.get_path(), server, reporter, + cnf.get('autorestart', False)) # If no args were passed in, run the server in the foreground. # todo does this need to be a daemon even when it basically always runs in the foreground, if not diff --git a/monagent/monstatsd/reporter.py b/monasca_agent/statsd/reporter.py similarity index 87% rename from monagent/monstatsd/reporter.py rename to monasca_agent/statsd/reporter.py index b8caa930..7ffc1eab 100644 --- a/monagent/monstatsd/reporter.py +++ b/monasca_agent/statsd/reporter.py @@ -1,12 +1,12 @@ 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') +from monasca_agent.common.check_status import MonascaStatsdStatus +from monasca_agent.common.emitter import http_emitter +from monasca_agent.common.util import plural +from monasca_agent.common.config import initialize_logging +initialize_logging('monasca_statsd') +log = logging.getLogger('monasca_statsd') WATCHDOG_TIMEOUT = 120 @@ -35,7 +35,7 @@ class Reporter(threading.Thread): self.watchdog = None if use_watchdog: - from monagent.common.util import Watchdog + from monasca_agent.common.util import Watchdog self.watchdog = Watchdog(WATCHDOG_TIMEOUT) self.api_host = api_host @@ -55,7 +55,7 @@ class Reporter(threading.Thread): log.debug("Watchdog enabled: %s" % bool(self.watchdog)) # Persist a start-up message. - MonstatsdStatus().persist() + MonascaStatsdStatus().persist() while not self.finished.isSet(): # Use camel case isSet for 2.4 support. self.finished.wait(self.interval) @@ -65,7 +65,7 @@ class Reporter(threading.Thread): # Clean up the status messages. log.debug("Stopped reporter") - MonstatsdStatus.remove_latest_status() + MonascaStatsdStatus.remove_latest_status() def flush(self): try: @@ -106,7 +106,7 @@ class Reporter(threading.Thread): # Persist a status message. packet_count = self.aggregator.total_count packets_per_second = self.aggregator.packets_per_second(self.interval) - MonstatsdStatus( + MonascaStatsdStatus( flush_count=self.flush_count, packet_count=packet_count, packets_per_second=packets_per_second, diff --git a/monagent/monstatsd/udp.py b/monasca_agent/statsd/udp.py similarity index 98% rename from monagent/monstatsd/udp.py rename to monasca_agent/statsd/udp.py index e5a6f7c9..f17397a3 100644 --- a/monagent/monstatsd/udp.py +++ b/monasca_agent/statsd/udp.py @@ -2,9 +2,9 @@ import ast import logging import select import socket -from monagent.common.config import initialize_logging -initialize_logging('monstatsd') -log = logging.getLogger('monstatsd') +from monasca_agent.common.config import initialize_logging +initialize_logging('monasca_statsd') +log = logging.getLogger('monasca_statsd') UDP_SOCKET_TIMEOUT = 5 diff --git a/monagent/win32/__init__.py b/monasca_agent/win32/__init__.py similarity index 100% rename from monagent/win32/__init__.py rename to monasca_agent/win32/__init__.py diff --git a/monagent/win32/agent.py b/monasca_agent/win32/agent.py similarity index 76% rename from monagent/win32/agent.py rename to monasca_agent/win32/agent.py index 5d13d6fe..2fe8d1e1 100644 --- a/monagent/win32/agent.py +++ b/monasca_agent/win32/agent.py @@ -1,8 +1,8 @@ # set up logging before importing any other components from config import initialize_logging -from monagent.pup import pup +from monasca_agent.pup import pup from collector import modules -from monstatsd import dogstatsd +from monasca_agent.statsd import daemon initialize_logging('collector') @@ -21,16 +21,16 @@ from ddagent import Application from win32.common import handle_exe_click from collector.jmxfetch import JMXFetch -from monagent.common.config import get_config, load_check_directory, set_win32_cert_path +from monasca_agent.common.config import get_config, load_check_directory, set_win32_cert_path log = logging.getLogger(__name__) RESTART_INTERVAL = 24 * 60 * 60 # Defaults to 1 day class AgentSvc(win32serviceutil.ServiceFramework): - _svc_name_ = "DatadogAgent" - _svc_display_name_ = "Datadog Agent" - _svc_description_ = "Sends metrics to Datadog" + _svc_name_ = "MonascaAgent" + _svc_display_name_ = "Monasca Agent" + _svc_description_ = "Sends metrics to Monasca" def __init__(self, args): win32serviceutil.ServiceFramework.__init__(self, args) @@ -50,10 +50,9 @@ class AgentSvc(win32serviceutil.ServiceFramework): # Keep a list of running processes so we can start/end as needed. # Processes will start started in order and stopped in reverse order. self.procs = { - 'forwarder': DDForwarder(config), - 'collector': DDAgent(agentConfig), - 'dogstatsd': DogstatsdProcess(config), - 'pup': PupProcess(config), + 'monasca-forwarder': MonascaForwarder(config), + 'monasca-collector': MonascaCollector(agentConfig), + 'monasca-statsd': MonascaStatsd(config), } def SvcStop(self): @@ -107,10 +106,10 @@ class AgentSvc(win32serviceutil.ServiceFramework): time.sleep(1) -class DDAgent(multiprocessing.Process): +class MonascaCollector(multiprocessing.Process): def __init__(self, agentConfig, start_event=True): - multiprocessing.Process.__init__(self, name='ddagent') + multiprocessing.Process.__init__(self, name='monasca-collector') self.config = agentConfig self.start_event = start_event # FIXME: `running` flag should be handled by the service @@ -118,7 +117,7 @@ class DDAgent(multiprocessing.Process): self.is_enabled = True def run(self): - log.debug("Windows Service - Starting collector") + log.debug("Windows Service - Starting monasca-collector") emitters = self.get_emitters() self.collector = Collector(self.config, emitters) @@ -131,7 +130,7 @@ class DDAgent(multiprocessing.Process): time.sleep(self.config['check_freq']) def stop(self): - log.debug("Windows Service - Stopping collector") + log.debug("Windows Service - Stopping monasca-collector") self.collector.stop() if JMXFetch.is_running(): JMXFetch.stop() @@ -149,15 +148,15 @@ class DDAgent(multiprocessing.Process): return emitters -class DDForwarder(multiprocessing.Process): +class MonascaForwarder(multiprocessing.Process): def __init__(self, agentConfig): - multiprocessing.Process.__init__(self, name='ddforwarder') + multiprocessing.Process.__init__(self, name='monasca-forwarder') self.config = agentConfig self.is_enabled = True def run(self): - log.debug("Windows Service - Starting forwarder") + log.debug("Windows Service - Starting monasca-forwarder") set_win32_cert_path() port = self.config.get('listen_port', 17123) if port is None: @@ -169,48 +168,30 @@ class DDForwarder(multiprocessing.Process): self.forwarder.run() def stop(self): - log.debug("Windows Service - Stopping forwarder") + log.debug("Windows Service - Stopping monasca-forwarder") self.forwarder.stop() -class DogstatsdProcess(multiprocessing.Process): +class MonascaStatsdProcess(multiprocessing.Process): def __init__(self, agentConfig): - multiprocessing.Process.__init__(self, name='dogstatsd') + multiprocessing.Process.__init__(self, name='monasca-statsd') self.config = agentConfig self.is_enabled = True def run(self): - log.debug("Windows Service - Starting Monstatsd server") - self.reporter, self.server, _ = dogstatsd.init() + log.debug("Windows Service - Starting monasca-statsd server") + self.reporter, self.server, _ = daemon.init_monasca_statsd() self.reporter.start() self.server.start() def stop(self): - log.debug("Windows Service - Stopping Monstatsd server") + log.debug("Windows Service - Stopping monasca-statsd server") self.server.stop() self.reporter.stop() self.reporter.join() -class PupProcess(multiprocessing.Process): - - def __init__(self, agentConfig): - multiprocessing.Process.__init__(self, name='pup') - self.config = agentConfig - self.is_enabled = self.config.get('use_web_info_page', True) - - def run(self): - self.pup = pup - if self.is_enabled: - log.debug("Windows Service - Starting Pup") - self.pup.run_pup(self.config) - - def stop(self): - if self.is_enabled: - log.debug("Windows Service - Stopping Pup") - self.pup.stop() - if __name__ == '__main__': multiprocessing.freeze_support() if len(sys.argv) == 1: diff --git a/monagent/win32/common.py b/monasca_agent/win32/common.py similarity index 100% rename from monagent/win32/common.py rename to monasca_agent/win32/common.py diff --git a/monagent/win32/gui.py b/monasca_agent/win32/gui.py similarity index 100% rename from monagent/win32/gui.py rename to monasca_agent/win32/gui.py diff --git a/monagent/win32/shell.py b/monasca_agent/win32/shell.py similarity index 100% rename from monagent/win32/shell.py rename to monasca_agent/win32/shell.py diff --git a/monsetup/README.md b/monasca_setup/README.md similarity index 100% rename from monsetup/README.md rename to monasca_setup/README.md diff --git a/monsetup/__init__.py b/monasca_setup/__init__.py similarity index 100% rename from monsetup/__init__.py rename to monasca_setup/__init__.py diff --git a/monsetup/agent_config.py b/monasca_setup/agent_config.py similarity index 100% rename from monsetup/agent_config.py rename to monasca_setup/agent_config.py diff --git a/monsetup/detection/__init__.py b/monasca_setup/detection/__init__.py similarity index 100% rename from monsetup/detection/__init__.py rename to monasca_setup/detection/__init__.py diff --git a/monsetup/detection/plugin.py b/monasca_setup/detection/plugin.py similarity index 100% rename from monsetup/detection/plugin.py rename to monasca_setup/detection/plugin.py diff --git a/monsetup/detection/plugins/__init__.py b/monasca_setup/detection/plugins/__init__.py similarity index 100% rename from monsetup/detection/plugins/__init__.py rename to monasca_setup/detection/plugins/__init__.py diff --git a/monsetup/detection/plugins/ceilometer.py b/monasca_setup/detection/plugins/ceilometer.py similarity index 91% rename from monsetup/detection/plugins/ceilometer.py rename to monasca_setup/detection/plugins/ceilometer.py index f11526f9..17044e27 100644 --- a/monsetup/detection/plugins/ceilometer.py +++ b/monasca_setup/detection/plugins/ceilometer.py @@ -1,7 +1,7 @@ -import monsetup.detection +import monasca_setup.detection -class Ceilometer(monsetup.detection.ServicePlugin): +class Ceilometer(monasca_setup.detection.ServicePlugin): """Detect Ceilometer daemons and setup configuration to monitor them.""" diff --git a/monsetup/detection/plugins/cinder.py b/monasca_setup/detection/plugins/cinder.py similarity index 87% rename from monsetup/detection/plugins/cinder.py rename to monasca_setup/detection/plugins/cinder.py index fd0d4b31..0a3e9cbe 100644 --- a/monsetup/detection/plugins/cinder.py +++ b/monasca_setup/detection/plugins/cinder.py @@ -1,7 +1,7 @@ -import monsetup.detection +import monasca_setup.detection -class Cinder(monsetup.detection.ServicePlugin): +class Cinder(monasca_setup.detection.ServicePlugin): """Detect Cinder daemons and setup configuration to monitor them.""" diff --git a/monsetup/detection/plugins/glance.py b/monasca_setup/detection/plugins/glance.py similarity index 86% rename from monsetup/detection/plugins/glance.py rename to monasca_setup/detection/plugins/glance.py index 78040637..d312430a 100644 --- a/monsetup/detection/plugins/glance.py +++ b/monasca_setup/detection/plugins/glance.py @@ -1,7 +1,7 @@ -import monsetup.detection +import monasca_setup.detection -class Glance(monsetup.detection.ServicePlugin): +class Glance(monasca_setup.detection.ServicePlugin): """Detect Glance daemons and setup configuration to monitor them.""" diff --git a/monsetup/detection/plugins/kafka_consumer.py b/monasca_setup/detection/plugins/kafka_consumer.py similarity index 96% rename from monsetup/detection/plugins/kafka_consumer.py rename to monasca_setup/detection/plugins/kafka_consumer.py index 2fbc8819..b60d5a84 100644 --- a/monsetup/detection/plugins/kafka_consumer.py +++ b/monasca_setup/detection/plugins/kafka_consumer.py @@ -2,9 +2,9 @@ import logging import re from subprocess import CalledProcessError, check_output -from monsetup.detection import Plugin, find_process_cmdline, watch_process -from monsetup.detection.utils import find_addr_listening_on_port -from monsetup import agent_config +from monasca_setup.detection import Plugin, find_process_cmdline, watch_process +from monasca_setup.detection.utils import find_addr_listening_on_port +from monasca_setup import agent_config log = logging.getLogger(__name__) diff --git a/monsetup/detection/plugins/keystone.py b/monasca_setup/detection/plugins/keystone.py similarity index 85% rename from monsetup/detection/plugins/keystone.py rename to monasca_setup/detection/plugins/keystone.py index df638005..5f419203 100644 --- a/monsetup/detection/plugins/keystone.py +++ b/monasca_setup/detection/plugins/keystone.py @@ -1,7 +1,7 @@ -import monsetup.detection +import monasca_setup.detection -class Keystone(monsetup.detection.ServicePlugin): +class Keystone(monasca_setup.detection.ServicePlugin): """Detect Keystone daemons and setup configuration to monitor them. diff --git a/monsetup/detection/plugins/libvirt.py b/monasca_setup/detection/plugins/libvirt.py similarity index 89% rename from monsetup/detection/plugins/libvirt.py rename to monasca_setup/detection/plugins/libvirt.py index 3554a684..87fa7ef9 100644 --- a/monsetup/detection/plugins/libvirt.py +++ b/monasca_setup/detection/plugins/libvirt.py @@ -1,8 +1,8 @@ import logging import os.path import ConfigParser -import monsetup.detection -import monsetup.agent_config +import monasca_setup.detection +import monasca_setup.agent_config log = logging.getLogger(__name__) @@ -16,20 +16,20 @@ nova_refresh = 60 * 60 * 4 # Four hours vm_probation = 60 * 5 # Five minutes -class Libvirt(monsetup.detection.Plugin): +class Libvirt(monasca_setup.detection.Plugin): """Configures VM monitoring through Nova""" def _detect(self): """Run detection, set self.available True if the service is detected. """ - if (monsetup.detection.find_process_name('nova-api') is not None and + if (monasca_setup.detection.find_process_name('nova-api') is not None and os.path.isfile(nova_conf)): self.available = True def build_config(self): """Build the config as a Plugins object and return back. """ - config = monsetup.agent_config.Plugins() + config = monasca_setup.agent_config.Plugins() if self.dependencies_installed(): nova_cfg = ConfigParser.SafeConfigParser() @@ -62,7 +62,7 @@ class Libvirt(monsetup.detection.Plugin): import time import yaml import novaclient.v3.client - import monagent.collector.virt.inspector + import monasca_agent.collector.virt.inspector except ImportError: log.warn("\tDependencies not satisfied; plugin not configured.") return False diff --git a/monsetup/detection/plugins/mon.py b/monasca_setup/detection/plugins/mon.py similarity index 82% rename from monsetup/detection/plugins/mon.py rename to monasca_setup/detection/plugins/mon.py index 2a5ee307..119d769e 100644 --- a/monsetup/detection/plugins/mon.py +++ b/monasca_setup/detection/plugins/mon.py @@ -6,20 +6,20 @@ import logging -import monsetup.agent_config -import monsetup.detection +import monasca_setup.agent_config +import monasca_setup.detection log = logging.getLogger(__name__) -class MonPersister(monsetup.detection.Plugin): +class MonPersister(monasca_setup.detection.Plugin): """Detect mon_persister and setup monitoring. """ def _detect(self): """Run detection, set self.available True if the service is detected. """ - if monsetup.detection.find_process_cmdline('mon-persister') is not None: + if monasca_setup.detection.find_process_cmdline('mon-persister') is not None: self.available = True def build_config(self): @@ -36,13 +36,13 @@ class MonPersister(monsetup.detection.Plugin): return True -class MonAPI(monsetup.detection.Plugin): +class MonAPI(monasca_setup.detection.Plugin): """Detect mon_api and setup monitoring. """ def _detect(self): """Run detection, set self.available True if the service is detected.""" - monasca_api = monsetup.detection.find_process_cmdline('monasca-api') + monasca_api = monasca_setup.detection.find_process_cmdline('monasca-api') if monasca_api is not None: # monasca-api can show up in urls and be an arg to this setup program, check port also for conn in monasca_api.connections('inet'): @@ -64,7 +64,7 @@ class MonAPI(monsetup.detection.Plugin): return True -class MonThresh(monsetup.detection.Plugin): +class MonThresh(monasca_setup.detection.Plugin): """Detect the running mon-thresh and monitor. @@ -74,7 +74,7 @@ class MonThresh(monsetup.detection.Plugin): """Run detection, set self.available True if the service is detected. """ - if monsetup.detection.find_process_cmdline('mon-thresh') is not None: + if monasca_setup.detection.find_process_cmdline('mon-thresh') is not None: self.available = True def build_config(self): @@ -82,7 +82,7 @@ class MonThresh(monsetup.detection.Plugin): """ log.info("\tWatching the mon-thresh process.") - return monsetup.detection.watch_process(['mon-thresh']) + return monasca_setup.detection.watch_process(['mon-thresh']) def dependencies_installed(self): return True @@ -92,7 +92,7 @@ def dropwizard_health_check(name, url): """Setup a dropwizard heathcheck to be watched by the http_check plugin. """ - config = monsetup.agent_config.Plugins() + config = monasca_setup.agent_config.Plugins() config['http_check'] = {'init_config': None, 'instances': [{'name': name, 'url': url, diff --git a/monsetup/detection/plugins/mysql.py b/monasca_setup/detection/plugins/mysql.py similarity index 91% rename from monsetup/detection/plugins/mysql.py rename to monasca_setup/detection/plugins/mysql.py index f8ba9f9e..e5fb17b5 100644 --- a/monsetup/detection/plugins/mysql.py +++ b/monasca_setup/detection/plugins/mysql.py @@ -1,14 +1,14 @@ import logging -import monsetup.agent_config -import monsetup.detection +import monasca_setup.agent_config +import monasca_setup.detection log = logging.getLogger(__name__) mysql_conf = '/root/.my.cnf' -class MySQL(monsetup.detection.Plugin): +class MySQL(monasca_setup.detection.Plugin): """Detect MySQL daemons and setup configuration to monitor them. @@ -23,16 +23,16 @@ class MySQL(monsetup.detection.Plugin): """Run detection, set self.available True if the service is detected. """ - if monsetup.detection.find_process_name('mysqld') is not None: + if monasca_setup.detection.find_process_name('mysqld') is not None: self.available = True def build_config(self): """Build the config as a Plugins object and return. """ - config = monsetup.agent_config.Plugins() + config = monasca_setup.agent_config.Plugins() # First watch the process - config.merge(monsetup.detection.watch_process(['mysqld'])) + config.merge(monasca_setup.detection.watch_process(['mysqld'])) log.info("\tWatching the mysqld process.") # Attempt login, requires either an empty root password from localhost diff --git a/monsetup/detection/plugins/network.py b/monasca_setup/detection/plugins/network.py similarity index 91% rename from monsetup/detection/plugins/network.py rename to monasca_setup/detection/plugins/network.py index 669397e1..5e4a7db2 100644 --- a/monsetup/detection/plugins/network.py +++ b/monasca_setup/detection/plugins/network.py @@ -2,8 +2,8 @@ import os import yaml -from monsetup.detection import Plugin -from monsetup import agent_config +from monasca_setup.detection import Plugin +from monasca_setup import agent_config class Network(Plugin): diff --git a/monsetup/detection/plugins/neutron.py b/monasca_setup/detection/plugins/neutron.py similarity index 89% rename from monsetup/detection/plugins/neutron.py rename to monasca_setup/detection/plugins/neutron.py index c6792f44..19fd3bb4 100644 --- a/monsetup/detection/plugins/neutron.py +++ b/monasca_setup/detection/plugins/neutron.py @@ -1,7 +1,7 @@ -import monsetup.detection +import monasca_setup.detection -class Neutron(monsetup.detection.ServicePlugin): +class Neutron(monasca_setup.detection.ServicePlugin): """Detect Neutron daemons and setup configuration to monitor them. diff --git a/monsetup/detection/plugins/nova.py b/monasca_setup/detection/plugins/nova.py similarity index 90% rename from monsetup/detection/plugins/nova.py rename to monasca_setup/detection/plugins/nova.py index b859e04e..48724567 100644 --- a/monsetup/detection/plugins/nova.py +++ b/monasca_setup/detection/plugins/nova.py @@ -1,7 +1,7 @@ -import monsetup.detection +import monasca_setup.detection -class Nova(monsetup.detection.ServicePlugin): +class Nova(monasca_setup.detection.ServicePlugin): """Detect Nova daemons and setup configuration to monitor them. diff --git a/monsetup/detection/plugins/postfix.py b/monasca_setup/detection/plugins/postfix.py similarity index 78% rename from monsetup/detection/plugins/postfix.py rename to monasca_setup/detection/plugins/postfix.py index 78246d0b..bd22f9fb 100644 --- a/monsetup/detection/plugins/postfix.py +++ b/monasca_setup/detection/plugins/postfix.py @@ -2,11 +2,11 @@ import os import yaml -import monsetup.agent_config -import monsetup.detection +import monasca_setup.agent_config +import monasca_setup.detection -class Postfix(monsetup.detection.Plugin): +class Postfix(monasca_setup.detection.Plugin): """If postfix is running install the default config. @@ -18,7 +18,7 @@ class Postfix(monsetup.detection.Plugin): """Run detection, set self.available True if the service is detected. """ - if monsetup.detection.find_process_name('postfix') is not None: + if monasca_setup.detection.find_process_name('postfix') is not None: self.available = True def build_config(self): @@ -29,7 +29,7 @@ class Postfix(monsetup.detection.Plugin): # plugin is the exception not the rule with open(os.path.join(self.template_dir, 'conf.d/postfix.yaml.example'), 'r') as postfix_template: default_net_config = yaml.load(postfix_template.read()) - config = monsetup.agent_config.Plugins() + config = monasca_setup.agent_config.Plugins() config['postfix'] = default_net_config return config diff --git a/monsetup/detection/plugins/rabbitmq.py b/monasca_setup/detection/plugins/rabbitmq.py similarity index 93% rename from monsetup/detection/plugins/rabbitmq.py rename to monasca_setup/detection/plugins/rabbitmq.py index cd2cce8d..6ed4e89e 100644 --- a/monsetup/detection/plugins/rabbitmq.py +++ b/monasca_setup/detection/plugins/rabbitmq.py @@ -2,8 +2,8 @@ import logging import urllib2 -import monsetup.agent_config -import monsetup.detection +import monasca_setup.agent_config +import monasca_setup.detection log = logging.getLogger(__name__) @@ -11,7 +11,7 @@ rabbit_conf = '/root/.rabbitmq.cnf' rabbitmq_api_url = 'http://localhost:15672/api' -class RabbitMQ(monsetup.detection.Plugin): +class RabbitMQ(monasca_setup.detection.Plugin): """Detect RabbitMQ daemons and setup configuration to monitor them. @@ -29,16 +29,16 @@ class RabbitMQ(monsetup.detection.Plugin): """Run detection, set self.available True if the service is detected. """ - if monsetup.detection.find_process_cmdline('rabbitmq-server') is not None: + if monasca_setup.detection.find_process_cmdline('rabbitmq-server') is not None: self.available = True def build_config(self): """Build the config as a Plugins object and return. """ - config = monsetup.agent_config.Plugins() + config = monasca_setup.agent_config.Plugins() # First watch the process - config.merge(monsetup.detection.watch_process(['rabbitmq-server'])) + config.merge(monasca_setup.detection.watch_process(['rabbitmq-server'])) log.info("\tWatching the rabbitmq-server process.") # Attempt login, requires either an empty root password from localhost diff --git a/monsetup/detection/plugins/swift.py b/monasca_setup/detection/plugins/swift.py similarity index 92% rename from monsetup/detection/plugins/swift.py rename to monasca_setup/detection/plugins/swift.py index 2fa40e1c..3ab96e24 100644 --- a/monsetup/detection/plugins/swift.py +++ b/monasca_setup/detection/plugins/swift.py @@ -1,7 +1,7 @@ -import monsetup.detection +import monasca_setup.detection -class Swift(monsetup.detection.ServicePlugin): +class Swift(monasca_setup.detection.ServicePlugin): """Detect Swift daemons and setup configuration to monitor them. diff --git a/monsetup/detection/plugins/zookeeper.py b/monasca_setup/detection/plugins/zookeeper.py similarity index 73% rename from monsetup/detection/plugins/zookeeper.py rename to monasca_setup/detection/plugins/zookeeper.py index 6ffdc152..173090f3 100644 --- a/monsetup/detection/plugins/zookeeper.py +++ b/monasca_setup/detection/plugins/zookeeper.py @@ -3,13 +3,13 @@ import os import yaml -import monsetup.agent_config -import monsetup.detection +import monasca_setup.agent_config +import monasca_setup.detection log = logging.getLogger(__name__) -class Zookeeper(monsetup.detection.Plugin): +class Zookeeper(monasca_setup.detection.Plugin): """Detect Zookeeper daemons and setup configuration to monitor them. @@ -19,17 +19,17 @@ class Zookeeper(monsetup.detection.Plugin): """Run detection, set self.available True if the service is detected. """ - if monsetup.detection.find_process_cmdline('org.apache.zookeeper') is not None: + if monasca_setup.detection.find_process_cmdline('org.apache.zookeeper') is not None: self.available = True def build_config(self): """Build the config as a Plugins object and return. """ - config = monsetup.agent_config.Plugins() + config = monasca_setup.agent_config.Plugins() # First watch the process log.info("\tWatching the zookeeper process.") - config.merge(monsetup.detection.watch_process(['zookeeper'])) + config.merge(monasca_setup.detection.watch_process(['zookeeper'])) log.info("\tEnabling the zookeeper plugin") with open(os.path.join(self.template_dir, 'conf.d/zk.yaml.example'), 'r') as zk_template: diff --git a/monsetup/detection/service_plugin.py b/monasca_setup/detection/service_plugin.py similarity index 90% rename from monsetup/detection/service_plugin.py rename to monasca_setup/detection/service_plugin.py index 8330604e..5d7c8c14 100644 --- a/monsetup/detection/service_plugin.py +++ b/monasca_setup/detection/service_plugin.py @@ -2,10 +2,10 @@ import logging from plugin import Plugin -from monsetup import agent_config -from monsetup.detection import find_process_cmdline -from monsetup.detection import service_api_check -from monsetup.detection import watch_process +from monasca_setup import agent_config +from monasca_setup.detection import find_process_cmdline +from monasca_setup.detection import service_api_check +from monasca_setup.detection import watch_process log = logging.getLogger(__name__) diff --git a/monsetup/detection/utils.py b/monasca_setup/detection/utils.py similarity index 98% rename from monsetup/detection/utils.py rename to monasca_setup/detection/utils.py index f58fbbe5..dbca4c35 100644 --- a/monsetup/detection/utils.py +++ b/monasca_setup/detection/utils.py @@ -2,7 +2,7 @@ """ import psutil -from monsetup import agent_config +from monasca_setup import agent_config def find_process_cmdline(search_string): diff --git a/monsetup/main.py b/monasca_setup/main.py similarity index 100% rename from monsetup/main.py rename to monasca_setup/main.py diff --git a/monsetup/service/__init__.py b/monasca_setup/service/__init__.py similarity index 100% rename from monsetup/service/__init__.py rename to monasca_setup/service/__init__.py diff --git a/monsetup/service/service.py b/monasca_setup/service/service.py similarity index 100% rename from monsetup/service/service.py rename to monasca_setup/service/service.py diff --git a/monsetup/service/sysv.py b/monasca_setup/service/sysv.py similarity index 100% rename from monsetup/service/sysv.py rename to monasca_setup/service/sysv.py diff --git a/packaging/Makefile b/packaging/Makefile index b67e7306..68c5372b 100644 --- a/packaging/Makefile +++ b/packaging/Makefile @@ -10,7 +10,7 @@ SRC=../ ROOT=root BUILD_NUMBER ?= 0 -VERSION=`PYTHONPATH=$(SRC) python -c "from monagent.common.config import get_version; print get_version()"` +VERSION=`PYTHONPATH=$(SRC) python -c "from monasca_agent.common.config import get_version; print get_version()"` FPM_BUILD=fpm --epoch 1 -s dir -e -C $(BUILD) \ -a all -m "HP Cloud Monitoring " \ @@ -34,7 +34,7 @@ clean: # root directory. source: mkdir -p $(ROOT) - cp -r $(SRC)/monagent $(ROOT)/ + cp -r $(SRC)/monasca_agent $(ROOT)/ cp -r $(SRC)/conf.d $(ROOT)/ cp -r $(SRC)/LICENSE* $(ROOT)/ cp -r $(SRC)/agent.conf.template $(ROOT)/ @@ -54,9 +54,9 @@ install_full: source # Install the source to usr/share cp -r $(ROOT)/* $(BUILD)/usr/share/monasca/agent # Install the common executables. - 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 + ln -sf ../share/monasca/agent/monasca_agent/statsd/daemon.py $(BUILD)/usr/bin/monasca-statsd + ln -sf ../share/monasca/agent/monasca_agent/forwarder/daemon.py $(BUILD)/usr/bin/monasca-forwarder + ln -sf ../share/monasca/agent/monasca_agent/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 diff --git a/packaging/monasca-agent-deb/monasca-agent.init b/packaging/monasca-agent-deb/monasca-agent.init index 0a15d174..d9ab16ba 100755 --- a/packaging/monasca-agent-deb/monasca-agent.init +++ b/packaging/monasca-agent-deb/monasca-agent.init @@ -16,7 +16,7 @@ export PYTHONPATH=$PYTHONPATH:/usr/monasca/agent/ AGENTPATH="/usr/local/bin/monasca-collector" AGENTCONF="/etc/monasca/agent/agent.conf" -MONSTATSDPATH="/usr/local/bin/monasca-statsd" +MONASCASTATSDPATH="/usr/local/bin/monasca-statsd" AGENTUSER="monasca-agent" FORWARDERPATH="/usr/local/bin/monasca-forwarder" NAME="monasca-agent" @@ -125,11 +125,11 @@ case "$1" in # (right now only monasca-agent supports additional flags) su $AGENTUSER -c "$AGENTPATH info $@" COLLECTOR_RETURN=$? - su $AGENTUSER -c "$MONSTATSDPATH info" - MONSTATSD_RETURN=$? + su $AGENTUSER -c "$MONASCASTATSDPATH info" + MONASCASTATSD_RETURN=$? su $AGENTUSER -c "$FORWARDERPATH info" FORWARDER_RETURN=$? - exit $(($COLLECTOR_RETURN+$MONSTATSD_RETURN+$FORWARDER_RETURN)) + exit $(($COLLECTOR_RETURN+$MONASCASTATSD_RETURN+$FORWARDER_RETURN)) ;; status) diff --git a/packaging/monasca-agent-deb/supervisor.conf b/packaging/monasca-agent-deb/supervisor.conf index 58a555dd..260c1cd5 100644 --- a/packaging/monasca-agent-deb/supervisor.conf +++ b/packaging/monasca-agent-deb/supervisor.conf @@ -35,7 +35,7 @@ startsecs=3 priority=998 user=monasca-agent -[program:monstatsd] +[program:statsd] command=/usr/bin/monasca-statsd stdout_logfile=NONE stderr_logfile=NONE @@ -44,4 +44,4 @@ priority=998 user=monasca-agent [group:monasca-agent] -programs=forwarder,collector,monstatsd +programs=forwarder,collector,statsd diff --git a/packaging/monasca-agent.init b/packaging/monasca-agent.init index 15149a0c..cf40e8f2 100755 --- a/packaging/monasca-agent.init +++ b/packaging/monasca-agent.init @@ -16,7 +16,7 @@ PATH=$PATH:/sbin # add the location of start-stop-daemon on Debian AGENTPATH="/usr/local/bin/monasca-collector" AGENTCONF="/etc/monasca/agent/agent.conf" -MONSTATSDPATH="/usr/local/bin/monasca-statsd" +MONASCASTATSDPATH="/usr/local/bin/monasca-statsd" AGENTUSER="monasca-agent" FORWARDERPATH="/usr/local/bin/monasca-forwarder" NAME="monasca-agent" @@ -125,11 +125,11 @@ case "$1" in # (right now only monasca-agent supports additional flags) su $AGENTUSER -c "$AGENTPATH info $@" COLLECTOR_RETURN=$? - su $AGENTUSER -c "$MONSTATSDPATH info" - MONSTATSD_RETURN=$? + su $AGENTUSER -c "$MONASCASTATSDPATH info" + MONASCASTATSD_RETURN=$? su $AGENTUSER -c "$FORWARDERPATH info" FORWARDER_RETURN=$? - exit $(($COLLECTOR_RETURN+$MONSTATSD_RETURN+$FORWARDER_RETURN)) + exit $(($COLLECTOR_RETURN+$MONASCASTATSD_RETURN+$FORWARDER_RETURN)) ;; status) diff --git a/packaging/supervisor.conf b/packaging/supervisor.conf index 9c2d8274..b6131ead 100644 --- a/packaging/supervisor.conf +++ b/packaging/supervisor.conf @@ -33,7 +33,7 @@ startsecs=3 priority=998 user=monasca-agent -[program:monstatsd] +[program:statsd] command=/usr/local/bin/monasca-statsd stdout_logfile=NONE stderr_logfile=NONE @@ -42,4 +42,4 @@ priority=998 user=monasca-agent [group:monasca-agent] -programs=forwarder,collector,monstatsd +programs=forwarder,collector,statsd diff --git a/setup.cfg b/setup.cfg index d0f51723..cc68d617 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,8 +17,8 @@ classifier= [files] packages = - monagent - monsetup + monasca_agent + monasca_setup data_files= share/monasca/agent = agent.conf.template @@ -28,15 +28,15 @@ data_files= [entry_points] console_scripts = - monasca-forwarder = monagent.forwarder.daemon:main - monasca-collector = monagent.collector.daemon:main - monasca-statsd = monagent.monstatsd.daemon:main - monasca-setup = monsetup.main:main -monagent.collector.virt = - libvirt = monagent.collector.virt.libvirt.inspector:LibvirtInspector - hyperv = monagent.collector.virt.hyperv.inspector:HyperVInspector - vsphere = monagent.collector.virt.vmware.inspector:VsphereInspector - xenapi = monagent.collector.virt.xenapi.inspector:XenapiInspector + monasca-forwarder = monasca_agent.forwarder.daemon:main + monasca-collector = monasca_agent.collector.daemon:main + monasca-statsd = monasca_agent.statsd.daemon:main + monasca-setup = monasca_setup.main:main +monasca_agent.collector.virt = + libvirt = monasca_agent.collector.virt.libvirt.inspector:LibvirtInspector + hyperv = monasca_agent.collector.virt.hyperv.inspector:HyperVInspector + vsphere = monasca_agent.collector.virt.vmware.inspector:VsphereInspector + xenapi = monasca_agent.collector.virt.xenapi.inspector:XenapiInspector [global] diff --git a/tests/__init__.py b/tests/__init__.py index af7efdec..1ba08e18 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,4 +1,4 @@ import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '../monagent')) +sys.path.append(os.path.join(os.path.dirname(__file__), '../monasca_agent')) diff --git a/tests/common.py b/tests/common.py index ac4737d8..d6e17646 100644 --- a/tests/common.py +++ b/tests/common.py @@ -3,9 +3,9 @@ import inspect import os import signal -from monagent.collector.checks import AgentCheck -from monagent.common.config import get_checksd_path -from monagent.common.util import get_os +from monasca_agent.collector.checks import AgentCheck +from monasca_agent.common.config import get_checksd_path +from monasca_agent.common.util import get_os def load_check(name, config, agent_config): diff --git a/tests/functional/dogstatsd_functional.py b/tests/functional/monascastatsd_functional.py similarity index 100% rename from tests/functional/dogstatsd_functional.py rename to tests/functional/monascastatsd_functional.py diff --git a/tests/performance/benchmark_aggregator.py b/tests/performance/benchmark_aggregator.py index e6f75d26..8eed5615 100644 --- a/tests/performance/benchmark_aggregator.py +++ b/tests/performance/benchmark_aggregator.py @@ -3,7 +3,7 @@ Performance tests for the agent/dogstatsd metrics aggregator. """ -from monagent.common.aggregator import MetricsAggregator +from monasca_agent.common.aggregator import MetricsAggregator class TestAggregatorPerf(object): diff --git a/tests/test_cassandra_jmx.py b/tests/test_cassandra_jmx.py index a1889c1a..b43063ed 100644 --- a/tests/test_cassandra_jmx.py +++ b/tests/test_cassandra_jmx.py @@ -5,11 +5,11 @@ import os from nose.plugins.skip import SkipTest -from monagent.common.aggregator import MetricsAggregator -from monagent.monstatsd import Server -from monagent.common.util import PidFile -from monagent.common.config import get_logging_config -from monagent.collector.jmxfetch import JMXFetch +from monasca_agent.common.aggregator import MetricsAggregator +from monasca_agent.statsd import Server +from monasca_agent.common.util import PidFile +from monasca_agent.common.config import get_logging_config +from monasca_agent.collector.jmxfetch import JMXFetch STATSD_PORT = 8121 diff --git a/tests/test_check_status.py b/tests/test_check_status.py index d25f6f32..1e87f819 100644 --- a/tests/test_check_status.py +++ b/tests/test_check_status.py @@ -1,7 +1,7 @@ import nose.tools as nt -from monagent.collector.checks import AgentCheck -from monagent.common.check_status import STATUS_OK, STATUS_ERROR, InstanceStatus, CheckStatus, CollectorStatus +from monasca_agent.collector.checks import AgentCheck +from monasca_agent.common.check_status import STATUS_OK, STATUS_ERROR, InstanceStatus, CheckStatus, CollectorStatus class DummyAgentCheck(AgentCheck): diff --git a/tests/test_common.py b/tests/test_common.py index 2a3cadb7..777c96bf 100644 --- a/tests/test_common.py +++ b/tests/test_common.py @@ -2,9 +2,9 @@ import time import unittest import logging logger = logging.getLogger() -from monagent.common.exceptions import UnknownValue, CheckException, Infinity -from monagent.collector.checks import Check -from monagent.common.aggregator import MetricsAggregator +from monasca_agent.common.exceptions import UnknownValue, CheckException, Infinity +from monasca_agent.collector.checks import Check +from monasca_agent.common.aggregator import MetricsAggregator class TestCore(unittest.TestCase): diff --git a/tests/test_config.py b/tests/test_config.py index e220c949..1c089bf5 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -3,8 +3,8 @@ import unittest import os.path import tempfile -from monagent.common.config import get_config -from monagent.common.util import PidFile, is_valid_hostname +from monasca_agent.common.config import get_config +from monasca_agent.common.util import PidFile, is_valid_hostname class TestConfig(unittest.TestCase): diff --git a/tests/test_java_jmx.py b/tests/test_java_jmx.py index 4abb0914..7c0a8847 100644 --- a/tests/test_java_jmx.py +++ b/tests/test_java_jmx.py @@ -5,11 +5,11 @@ import os from nose.plugins.skip import SkipTest -from monagent.common.aggregator import MetricsAggregator -from monagent.monstatsd import Server -from monagent.common.util import PidFile -from monagent.common.config import get_logging_config -from monagent.collector.jmxfetch import JMXFetch +from monasca_agent.common.aggregator import MetricsAggregator +from monasca_agent.statsd import Server +from monasca_agent.common.util import PidFile +from monasca_agent.common.config import get_logging_config +from monasca_agent.collector.jmxfetch import JMXFetch STATSD_PORT = 8129 diff --git a/tests/test_monstatsd.py b/tests/test_monstatsd.py index 98d2b807..1fd9a96f 100644 --- a/tests/test_monstatsd.py +++ b/tests/test_monstatsd.py @@ -4,10 +4,10 @@ import unittest import nose.tools as nt -from monagent.common.aggregator import MetricsAggregator +from monasca_agent.common.aggregator import MetricsAggregator -class TestUnitMonStatsd(unittest.TestCase): +class TestUnitMonascaStatsd(unittest.TestCase): @staticmethod def sort_metrics(metrics): @@ -413,7 +413,7 @@ class TestUnitMonStatsd(unittest.TestCase): def test_event_title(self): stats = MetricsAggregator('myhost') stats.submit_packets('_e{0,4}:|text') - stats.submit_packets(u'_e{9,4}:2intitulé|text') + stats.submit_packets(u'_e{9,4}:2intitul��|text') stats.submit_packets('_e{14,4}:3title content|text') stats.submit_packets('_e{14,4}:4title|content|text') stats.submit_packets('_e{13,4}:5title\\ntitle|text') # \n stays escaped @@ -424,7 +424,7 @@ class TestUnitMonStatsd(unittest.TestCase): first, second, third, fourth, fifth = events nt.assert_equal(first['title'], '') - nt.assert_equal(second['title'], u'2intitulé') + nt.assert_equal(second['title'], u'2intitul��') nt.assert_equal(third['title'], '3title content') nt.assert_equal(fourth['title'], '4title|content') nt.assert_equal(fifth['title'], '5title\\ntitle') @@ -434,7 +434,7 @@ class TestUnitMonStatsd(unittest.TestCase): stats.submit_packets('_e{2,0}:t1|') stats.submit_packets('_e{2,12}:t2|text|content') stats.submit_packets('_e{2,23}:t3|First line\\nSecond line') # \n is a newline - stats.submit_packets(u'_e{2,19}:t4|♬ †øU †øU ¥ºu T0µ ♪') # utf-8 compliant + stats.submit_packets(u'_e{2,19}:t4|��� �����U �����U ����u T0�� ���') # utf-8 compliant events = self.sort_events(stats.flush_events()) @@ -444,7 +444,7 @@ class TestUnitMonStatsd(unittest.TestCase): nt.assert_equal(first['text'], '') nt.assert_equal(second['text'], 'text|content') nt.assert_equal(third['text'], 'First line\nSecond line') - nt.assert_equal(fourth['text'], u'♬ †øU †øU ¥ºu T0µ ♪') + nt.assert_equal(fourth['text'], u'��� �����U �����U ����u T0�� ���') if __name__ == "__main__": diff --git a/tests/test_solr.py b/tests/test_solr.py index 4d717e43..11d7adca 100644 --- a/tests/test_solr.py +++ b/tests/test_solr.py @@ -5,11 +5,11 @@ import os from nose.plugins.skip import SkipTest -from monagent.common.aggregator import MetricsAggregator -from monagent.monstatsd import Server -from monagent.common.util import PidFile -from monagent.common.config import get_logging_config -from monagent.collector.jmxfetch import JMXFetch +from monasca_agent.common.aggregator import MetricsAggregator +from monasca_agent.statsd import Server +from monasca_agent.common.util import PidFile +from monasca_agent.common.config import get_logging_config +from monasca_agent.collector.jmxfetch import JMXFetch STATSD_PORT = 8127 diff --git a/tests/test_system.py b/tests/test_system.py index 1c4c7810..a73c5530 100644 --- a/tests/test_system.py +++ b/tests/test_system.py @@ -8,10 +8,10 @@ logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger(__file__) from common import get_check -from monagent.collector.checks.system.unix import Cpu -from monagent.collector.checks.system.unix import Disk -from monagent.collector.checks.system.unix import IO -from monagent.collector.checks.system.unix import Memory +from monasca_agent.collector.checks.system.unix import Cpu +from monasca_agent.collector.checks.system.unix import Disk +from monasca_agent.collector.checks.system.unix import IO +from monasca_agent.collector.checks.system.unix import Memory class TestSystem(unittest.TestCase): diff --git a/tests/test_tomcat.py b/tests/test_tomcat.py index 3620f86d..6428d542 100644 --- a/tests/test_tomcat.py +++ b/tests/test_tomcat.py @@ -5,11 +5,11 @@ import os from nose.plugins.skip import SkipTest -from monagent.common.aggregator import MetricsAggregator -from monagent.monstatsd import Server -from monagent.common.util import PidFile -from monagent.common.config import get_logging_config -from monagent.collector.jmxfetch import JMXFetch +from monasca_agent.common.aggregator import MetricsAggregator +from monasca_agent.statsd import Server +from monasca_agent.common.util import PidFile +from monasca_agent.common.config import get_logging_config +from monasca_agent.collector.jmxfetch import JMXFetch STATSD_PORT = 8126 diff --git a/tests/test_transaction.py b/tests/test_transaction.py index 24d011b7..f6c42daa 100644 --- a/tests/test_transaction.py +++ b/tests/test_transaction.py @@ -1,8 +1,8 @@ import unittest from datetime import timedelta, datetime -from monagent.forwarder.transaction import Transaction, TransactionManager -from monagent.forwarder import MAX_QUEUE_SIZE, THROTTLING_DELAY +from monasca_agent.forwarder.transaction import Transaction, TransactionManager +from monasca_agent.forwarder import MAX_QUEUE_SIZE, THROTTLING_DELAY class memTransaction(Transaction): diff --git a/tests/test_watchdog.py b/tests/test_watchdog.py index b02038ec..9d434e27 100644 --- a/tests/test_watchdog.py +++ b/tests/test_watchdog.py @@ -6,9 +6,9 @@ from random import random, randrange import urllib as url import time -sys.path.append(os.path.join(os.path.dirname(__file__), '../monagent')) -from monagent.collector.daemon import CollectorDaemon -from monagent.common.util import Watchdog +sys.path.append(os.path.join(os.path.dirname(__file__), '../monasca_agent')) +from monasca_agent.collector.daemon import CollectorDaemon +from monasca_agent.common.util import Watchdog class TestWatchdog(unittest.TestCase): diff --git a/tests/test_win32.py b/tests/test_win32.py index d17890dc..ac9a3bb3 100644 --- a/tests/test_win32.py +++ b/tests/test_win32.py @@ -8,7 +8,7 @@ import sys # from nose.plugins.attrib import attr # project -from monagent.collector import checks as w32 +from monasca_agent.collector import checks as w32 from nose.plugins.skip import SkipTest logging.basicConfig(level=logging.DEBUG)