From 43e07a393d338ac18d0fd73afe00c72ab88a83ec Mon Sep 17 00:00:00 2001
From: Julien Danjou <julien@danjou.info>
Date: Thu, 13 Aug 2015 14:00:03 +0200
Subject: [PATCH] polling: remove deprecated agents

We have deprecated the agents for a while now in favor of the
ceilometer-polling tool, let's update the doc for good and remove them.

Depends-On: I4a2a982d4153a31971a5f1a1b504b96ce29236f9
Change-Id: I7447ba4f408c95b0acf1b809504ce16fff1c6e21
---
 ceilometer/cmd/eventlet/polling.py |  19 +---
 devstack/plugin.sh                 |   8 +-
 devstack/upgrade/upgrade.sh        |   9 +-
 doc/source/install/manual.rst      | 151 +++++++----------------------
 setup.cfg                          |   3 -
 5 files changed, 50 insertions(+), 140 deletions(-)

diff --git a/ceilometer/cmd/eventlet/polling.py b/ceilometer/cmd/eventlet/polling.py
index 5da9d87821..1055711eb4 100644
--- a/ceilometer/cmd/eventlet/polling.py
+++ b/ceilometer/cmd/eventlet/polling.py
@@ -1,6 +1,6 @@
 # -*- encoding: utf-8 -*-
 #
-# Copyright 2014 OpenStack Foundation
+# Copyright 2014-2015 OpenStack Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License"); you may
 # not use this file except in compliance with the License. You may obtain
@@ -75,20 +75,3 @@ def main():
     service.prepare_service()
     os_service.launch(CONF, manager.AgentManager(CONF.polling_namespaces,
                                                  CONF.pollster_list)).wait()
-
-
-# todo(dbelova): remove it someday. Needed for backward compatibility
-def main_compute():
-    service.prepare_service()
-    os_service.launch(CONF, manager.AgentManager(['compute'])).wait()
-
-
-# todo(dbelova): remove it someday. Needed for backward compatibility
-def main_central():
-    service.prepare_service()
-    os_service.launch(CONF, manager.AgentManager(['central'])).wait()
-
-
-def main_ipmi():
-    service.prepare_service()
-    os_service.launch(CONF, manager.AgentManager(['ipmi'])).wait()
diff --git a/devstack/plugin.sh b/devstack/plugin.sh
index 020fb43800..2878854e4a 100644
--- a/devstack/plugin.sh
+++ b/devstack/plugin.sh
@@ -340,9 +340,9 @@ function install_ceilometerclient {
 
 # start_ceilometer() - Start running processes, including screen
 function start_ceilometer {
-    run_process ceilometer-acentral "$CEILOMETER_BIN_DIR/ceilometer-agent-central --config-file $CEILOMETER_CONF"
+    run_process ceilometer-acentral "$CEILOMETER_BIN_DIR/ceilometer-polling --polling-namespaces central --config-file $CEILOMETER_CONF"
     run_process ceilometer-anotification "$CEILOMETER_BIN_DIR/ceilometer-agent-notification --config-file $CEILOMETER_CONF"
-    run_process ceilometer-aipmi "$CEILOMETER_BIN_DIR/ceilometer-agent-ipmi --config-file $CEILOMETER_CONF"
+    run_process ceilometer-aipmi "$CEILOMETER_BIN_DIR/ceilometer-polling --polling-namespaces ipmi --config-file $CEILOMETER_CONF"
 
     if [[ "$CEILOMETER_USE_MOD_WSGI" == "False" ]]; then
         run_process ceilometer-api "$CEILOMETER_BIN_DIR/ceilometer-api -d -v --log-dir=$CEILOMETER_API_LOG_DIR --config-file $CEILOMETER_CONF"
@@ -360,10 +360,10 @@ function start_ceilometer {
     # Start the compute agent late to allow time for the collector to
     # fully wake up and connect to the message bus. See bug #1355809
     if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then
-        run_process ceilometer-acompute "$CEILOMETER_BIN_DIR/ceilometer-agent-compute --config-file $CEILOMETER_CONF" $LIBVIRT_GROUP
+        run_process ceilometer-acompute "$CEILOMETER_BIN_DIR/ceilometer-polling --polling-namespaces compute --config-file $CEILOMETER_CONF" $LIBVIRT_GROUP
     fi
     if [[ "$VIRT_DRIVER" = 'vsphere' ]]; then
-        run_process ceilometer-acompute "$CEILOMETER_BIN_DIR/ceilometer-agent-compute --config-file $CEILOMETER_CONF"
+        run_process ceilometer-acompute "$CEILOMETER_BIN_DIR/ceilometer-polling --polling-namespaces compute --config-file $CEILOMETER_CONF"
     fi
 
     # Only die on API if it was actually intended to be turned on
diff --git a/devstack/upgrade/upgrade.sh b/devstack/upgrade/upgrade.sh
index 6f8260117a..78f1703122 100755
--- a/devstack/upgrade/upgrade.sh
+++ b/devstack/upgrade/upgrade.sh
@@ -74,7 +74,14 @@ $CEILOMETER_BIN_DIR/ceilometer-dbsync || die $LINENO "DB sync error"
 start_ceilometer
 
 # Note these are process names, not service names
-ensure_services_started ceilometer-agent-ipmi ceilometer-agent-compute ceilometer-agent-central ceilometer-agent-notification ceilometer-alarm-evaluator ceilometer-alarm-notifier ceilometer-api ceilometer-collector
+ensure_services_started "ceilometer-polling --polling-namespaces compute" \
+                        "ceilometer-polling --polling-namespaces central" \
+                        "ceilometer-polling --polling-namespaces ipmi" \
+                        ceilometer-agent-notification \
+                        ceilometer-alarm-evaluator \
+                        ceilometer-alarm-notifier \
+                        ceilometer-api \
+                        ceilometer-collector
 
 # Save mongodb state (replace with snapshot)
 if grep -q 'connection *= *mongo' /etc/ceilometer/ceilometer.conf; then
diff --git a/doc/source/install/manual.rst b/doc/source/install/manual.rst
index a2dcbb09ea..e8bfb34132 100644
--- a/doc/source/install/manual.rst
+++ b/doc/source/install/manual.rst
@@ -125,7 +125,16 @@ Installing the notification agent
    to ``cinder.openstack.common.notifier.rpc_notifier`` and
    ``control_exchange`` to ``cinder``, before restarting the service.
 
-3. In order to retrieve object store statistics, ceilometer needs
+3. If you want to be able to retrieve instance samples, you need to instruct
+   Nova to send notifications to the bus by setting these values::
+
+      # nova-compute configuration for ceilometer
+      instance_usage_audit=True
+      instance_usage_audit_period=hour
+      notify_on_state_change=vm_and_task_state
+      notification_driver=nova.openstack.common.notifier.rpc_notifier
+
+4. In order to retrieve object store statistics, ceilometer needs
    access to swift with ``ResellerAdmin`` role. You should give this
    role to your ``os_username`` user for tenant ``os_tenant_name``:
 
@@ -165,18 +174,18 @@ Installing the notification agent
         Please make sure that ceilometer's logging directory (if it's configured)
         is read and write accessible for the user swift is started by.
 
-4. Clone the ceilometer git repository to the management server::
+5. Clone the ceilometer git repository to the management server::
 
    $ cd /opt/stack
    $ git clone https://git.openstack.org/openstack/ceilometer.git
 
-5. As a user with ``root`` permissions or ``sudo`` privileges, run the
+6. As a user with ``root`` permissions or ``sudo`` privileges, run the
    ceilometer installer::
 
    $ cd ceilometer
    $ sudo python setup.py install
 
-6. Copy the sample configuration files from the source tree
+7. Copy the sample configuration files from the source tree
    to their final location.
 
    ::
@@ -186,7 +195,7 @@ Installing the notification agent
       $ cp etc/ceilometer/*.yaml /etc/ceilometer
       $ cp etc/ceilometer/ceilometer.conf.sample /etc/ceilometer/ceilometer.conf
 
-7. Edit ``/etc/ceilometer/ceilometer.conf``
+8. Edit ``/etc/ceilometer/ceilometer.conf``
 
    1. Configure RPC
 
@@ -215,7 +224,7 @@ Installing the notification agent
    Refer to :doc:`/configuration` for details about any other options
    you might want to modify before starting the service.
 
-8. Start the notification daemon.
+9. Start the notification daemon.
 
    ::
 
@@ -300,90 +309,7 @@ Installing the collector
       or other tool for maintaining a long-running program in the
       background.
 
-
-Installing the Compute Agent
-============================
-
-.. index::
-   double: installing; compute agent
-
-.. note:: The compute agent must be installed on each nova compute node.
-
-1. Configure nova.
-
-   The ``nova`` compute service needs the following configuration to
-   be set in ``nova.conf``::
-
-      # nova-compute configuration for ceilometer
-      instance_usage_audit=True
-      instance_usage_audit_period=hour
-      notify_on_state_change=vm_and_task_state
-      notification_driver=nova.openstack.common.notifier.rpc_notifier
-
-2. Clone the ceilometer git repository to the server::
-
-   $ cd /opt/stack
-   $ git clone https://git.openstack.org/openstack/ceilometer.git
-
-3. As a user with ``root`` permissions or ``sudo`` privileges, run the
-   ceilometer installer::
-
-   $ cd ceilometer
-   $ sudo python setup.py install
-
-4. Copy the sample configuration files from the source tree
-   to their final location.
-
-   ::
-
-      $ mkdir -p /etc/ceilometer
-      $ cp etc/ceilometer/*.json /etc/ceilometer
-      $ cp etc/ceilometer/*.yaml /etc/ceilometer
-      $ cp etc/ceilometer/ceilometer.conf.sample /etc/ceilometer/ceilometer.conf
-
-5. Edit ``/etc/ceilometer/ceilometer.conf``
-
-   1. Configure RPC
-
-      Set the RPC-related options correctly so ceilometer's daemons
-      can communicate with each other and receive notifications from
-      the other projects.
-
-      In particular, look for the ``*_control_exchange`` options and
-      make sure the names are correct. If you did not change the
-      ``control_exchange`` settings for the other components, the
-      defaults should be correct.
-
-      .. note::
-
-         Ceilometer makes extensive use of the messaging bus, but has
-         not yet been tested with ZeroMQ. We recommend using Rabbit or
-         qpid for now.
-
-   2. Set the ``telemetry_secret`` value.
-
-      Set the ``telemetry_secret`` value to a large, random, value. Use
-      the same value in all ceilometer configuration files, on all
-      nodes, so that messages passing between the nodes can be
-      validated.
-
-   Refer to :doc:`/configuration` for details about any other options
-   you might want to modify before starting the service.
-
-6. Start the agent.
-
-   ::
-
-     $ ceilometer-agent-compute
-
-   .. note::
-
-      The default development configuration of the agent logs to
-      stderr, so you may want to run this step using a screen session
-      or other tool for maintaining a long-running program in the
-      background.
-
-Installing the Central Agent
+Installing the Polling Agent
 ============================
 
 .. index::
@@ -391,8 +317,9 @@ Installing the Central Agent
 
 .. note::
 
-   The central agent needs to be able to talk to keystone and any of
-   the services being polled for updates.
+   The polling agent needs to be able to talk to Keystone and any of
+   the services being polled for updates. It also needs to run on your compute
+   nodes to poll instances.
 
 1. Clone the ceilometer git repository to the server::
 
@@ -416,30 +343,20 @@ Installing the Central Agent
       $ cp etc/ceilometer/ceilometer.conf.sample /etc/ceilometer/ceilometer.conf
 
 4. Edit ``/etc/ceilometer/ceilometer.conf``
+   Set the RPC-related options correctly so ceilometer's daemons
+   can communicate with each other and receive notifications from
+   the other projects.
 
-   1. Configure RPC
+   In particular, look for the ``*_control_exchange`` options and
+   make sure the names are correct. If you did not change the
+   ``control_exchange`` settings for the other components, the
+   defaults should be correct.
 
-      Set the RPC-related options correctly so ceilometer's daemons
-      can communicate with each other and receive notifications from
-      the other projects.
+   .. note::
 
-      In particular, look for the ``*_control_exchange`` options and
-      make sure the names are correct. If you did not change the
-      ``control_exchange`` settings for the other components, the
-      defaults should be correct.
-
-      .. note::
-
-         Ceilometer makes extensive use of the messaging bus, but has
-         not yet been tested with ZeroMQ. We recommend using Rabbit or
-         qpid for now.
-
-   2. Set the ``telemetry_secret`` value.
-
-      Set the ``telemetry_secret`` value to a large, random, value. Use
-      the same value in all ceilometer configuration files, on all
-      nodes, so that messages passing between the nodes can be
-      validated.
+      Ceilometer makes extensive use of the messaging bus, but has
+      not yet been tested with ZeroMQ. We recommend using Rabbit or
+      qpid for now.
 
    Refer to :doc:`/configuration` for details about any other options
    you might want to modify before starting the service.
@@ -448,7 +365,13 @@ Installing the Central Agent
 
    ::
 
-    $ ceilometer-agent-central
+    $ ceilometer-polling
+
+6. By default, the polling agent polls the `compute` and `central` namespaces.
+   You can specify which namespace to poll in the `ceilometer.conf`
+   configuration file or on the command line::
+
+     $ ceilometer-polling --polling-namespaces central,ipmi
 
 
 Installing the API Server
diff --git a/setup.cfg b/setup.cfg
index a2ed03dfac..df3d9351a2 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -270,11 +270,8 @@ ceilometer.event.trait_plugin =
 
 console_scripts =
     ceilometer-api = ceilometer.cmd.api:main
-    ceilometer-agent-central = ceilometer.cmd.eventlet.polling:main_central
-    ceilometer-agent-compute = ceilometer.cmd.eventlet.polling:main_compute
     ceilometer-polling = ceilometer.cmd.eventlet.polling:main
     ceilometer-agent-notification = ceilometer.cmd.eventlet.agent_notification:main
-    ceilometer-agent-ipmi = ceilometer.cmd.eventlet.polling:main_ipmi
     ceilometer-send-sample = ceilometer.cmd.eventlet.sample:send_sample
     ceilometer-dbsync = ceilometer.cmd.eventlet.storage:dbsync
     ceilometer-expirer = ceilometer.cmd.eventlet.storage:expirer