diff --git a/ceilometer/event/converter.py b/ceilometer/event/converter.py index 4bf514b9b8..eae980d44b 100644 --- a/ceilometer/event/converter.py +++ b/ceilometer/event/converter.py @@ -13,6 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. +import os from oslo_config import cfg from oslo_log import log from oslo_utils import fnmatch @@ -25,7 +26,10 @@ from ceilometer.i18n import _ OPTS = [ cfg.StrOpt('definitions_cfg_file', - default="event_definitions.yaml", + default=os.path.abspath( + os.path.join( + os.path.split(os.path.dirname(__file__))[0], + "pipeline", "data", "event_definitions.yaml")), help="Configuration file for event definitions." ), cfg.BoolOpt('drop_unmatched_notifications', diff --git a/ceilometer/pipeline.py b/ceilometer/pipeline.py index d39afc8228..1b3300d1ff 100644 --- a/ceilometer/pipeline.py +++ b/ceilometer/pipeline.py @@ -37,11 +37,17 @@ from ceilometer import sample as sample_util OPTS = [ cfg.StrOpt('pipeline_cfg_file', - default="pipeline.yaml", + default=os.path.abspath( + os.path.join( + os.path.dirname(__file__), + "pipeline", "data", "pipeline.yaml")), help="Configuration file for pipeline definition." ), cfg.StrOpt('event_pipeline_cfg_file', - default="event_pipeline.yaml", + default=os.path.abspath( + os.path.join( + os.path.dirname(__file__), + "pipeline", "data", "event_pipeline.yaml")), help="Configuration file for event pipeline definition." ), cfg.BoolOpt('refresh_pipeline_cfg', diff --git a/etc/ceilometer/event_definitions.yaml b/ceilometer/pipeline/data/event_definitions.yaml similarity index 100% rename from etc/ceilometer/event_definitions.yaml rename to ceilometer/pipeline/data/event_definitions.yaml diff --git a/etc/ceilometer/event_pipeline.yaml b/ceilometer/pipeline/data/event_pipeline.yaml similarity index 100% rename from etc/ceilometer/event_pipeline.yaml rename to ceilometer/pipeline/data/event_pipeline.yaml diff --git a/etc/ceilometer/pipeline.yaml b/ceilometer/pipeline/data/pipeline.yaml similarity index 100% rename from etc/ceilometer/pipeline.yaml rename to ceilometer/pipeline/data/pipeline.yaml diff --git a/ceilometer/tests/db.py b/ceilometer/tests/db.py index 462eff1ab6..46b11d8d0b 100644 --- a/ceilometer/tests/db.py +++ b/ceilometer/tests/db.py @@ -186,10 +186,6 @@ class TestBase(test_base.BaseTestCase): # tests work even if ceilometer is not installed globally on # the system. self.CONF.import_opt('pipeline_cfg_file', 'ceilometer.pipeline') - self.CONF.set_override( - 'pipeline_cfg_file', - self.path_get('etc/ceilometer/pipeline.yaml') - ) def tearDown(self): self.conn.clear() diff --git a/ceilometer/tests/functional/test_bin.py b/ceilometer/tests/functional/test_bin.py index 3949946b53..1cd4b165ea 100644 --- a/ceilometer/tests/functional/test_bin.py +++ b/ceilometer/tests/functional/test_bin.py @@ -86,7 +86,8 @@ class BinTestCase(base.BaseTestCase): class BinSendSampleTestCase(base.BaseTestCase): def setUp(self): super(BinSendSampleTestCase, self).setUp() - pipeline_cfg_file = self.path_get('etc/ceilometer/pipeline.yaml') + pipeline_cfg_file = self.path_get( + 'ceilometer/pipeline/data/pipeline.yaml') content = ("[DEFAULT]\n" "transport_url = fake://\n" "pipeline_cfg_file={0}\n".format(pipeline_cfg_file)) diff --git a/ceilometer/tests/functional/test_notification.py b/ceilometer/tests/functional/test_notification.py index 7139956bf8..e64dd15aae 100644 --- a/ceilometer/tests/functional/test_notification.py +++ b/ceilometer/tests/functional/test_notification.py @@ -241,10 +241,7 @@ class BaseRealNotification(tests_base.BaseTestCase): self.CONF.set_override("event_pipeline_cfg_file", ev_pipeline_cfg_file) - self.CONF.set_override( - "definitions_cfg_file", - self.path_get('etc/ceilometer/event_definitions.yaml'), - group='event') + self.publisher = test_publisher.TestPublisher(self.CONF, "") def _check_notification_service(self): diff --git a/ceilometer/tests/unit/test_decoupled_pipeline.py b/ceilometer/tests/unit/test_decoupled_pipeline.py index 4c9e064150..a8db848360 100644 --- a/ceilometer/tests/unit/test_decoupled_pipeline.py +++ b/ceilometer/tests/unit/test_decoupled_pipeline.py @@ -204,7 +204,7 @@ class TestDecoupledPipeline(pipeline_base.BasePipelineTestCase): def _do_test_rate_of_change_in_boilerplate_pipeline_cfg(self, index, meters, units): - with open('etc/ceilometer/pipeline.yaml') as fap: + with open('ceilometer/pipeline/data/pipeline.yaml') as fap: data = fap.read() pipeline_cfg = yaml.safe_load(data) for s in pipeline_cfg['sinks']: diff --git a/devstack/plugin.sh b/devstack/plugin.sh index ee0165f2f0..8e3802f767 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -270,14 +270,14 @@ function _ceilometer_configure_storage_backend { fi if [ "$CEILOMETER_BACKEND" = 'mysql' ] || [ "$CEILOMETER_BACKEND" = 'postgresql' ] || [ "$CEILOMETER_BACKEND" = 'mongodb' ]; then - sed -i 's/gnocchi:\/\//database:\/\//g' $CEILOMETER_CONF_DIR/event_pipeline.yaml $CEILOMETER_CONF_DIR/pipeline.yaml + sed -i 's/gnocchi:\/\//database:\/\//g' $CEILOMETER_DIR/ceilometer/pipeline/data/event_pipeline.yaml $CEILOMETER_DIR/ceilometer/pipeline/data/pipeline.yaml fi # configure panko if is_service_enabled panko-api; then iniadd $CEILOMETER_CONF DEFAULT event_dispatchers panko if ! grep -q 'panko' $CEILOMETER_CONF_DIR/event_pipeline.yaml ; then - echo ' - direct://?dispatcher=panko' >> $CEILOMETER_CONF_DIR/event_pipeline.yaml + echo ' - direct://?dispatcher=panko' >> $CEILOMETER_DIR/ceilometer/pipeline/data/event_pipeline.yaml fi fi @@ -310,8 +310,7 @@ function configure_ceilometer { # with rootwrap installation done elsewhere and also clobber # ceilometer.conf settings that have already been made. # Anyway, explicit is better than implicit. - for conffile in policy.json api_paste.ini pipeline.yaml polling.yaml \ - event_definitions.yaml event_pipeline.yaml; do + for conffile in policy.json api_paste.ini polling.yaml; do cp $CEILOMETER_DIR/etc/ceilometer/$conffile $CEILOMETER_CONF_DIR done diff --git a/doc/source/install/custom.rst b/doc/source/install/custom.rst index f5e5e6cc7d..a67a555095 100644 --- a/doc/source/install/custom.rst +++ b/doc/source/install/custom.rst @@ -153,6 +153,20 @@ configuration settings should be added:: If gnocchi dispatcher is enabled, Ceilometer api calls will return a 410 with an empty result. The Gnocchi Api should be used instead to access the data. +Custom pipeline +=============== + +The paths of all pipeline files including ``pipeline.yaml`` and ``event_pipeline.yaml`` +are located to ceilometer/pipeline/data by default. And it's possible to set the +path through ``pipeline_cfg_file`` being assigned to another one in ``ceilometer.conf``. + +Ceilometer allow users to customize pipeline files. Before that, copy the following +yaml files:: + + $ cp ceilometer/pipeline/data/*.yaml /etc/ceilometer + +Then you can add configurations according to the former section. + Efficient polling ================= diff --git a/doc/source/install/manual.rst b/doc/source/install/manual.rst index 8987dcab31..19e0b2367c 100644 --- a/doc/source/install/manual.rst +++ b/doc/source/install/manual.rst @@ -114,7 +114,6 @@ Installing the notification agent to their final location:: $ mkdir -p /etc/ceilometer - $ cp etc/ceilometer/*.yaml /etc/ceilometer $ cp etc/ceilometer/ceilometer.conf /etc/ceilometer 5. Edit ``/etc/ceilometer/ceilometer.conf`` @@ -192,7 +191,6 @@ Installing the Polling Agent to their final location:: $ mkdir -p /etc/ceilometer - $ cp etc/ceilometer/*.yaml /etc/ceilometer $ cp etc/ceilometer/ceilometer.conf /etc/ceilometer/ceilometer.conf 5. Configure messaging by editing ``/etc/ceilometer/ceilometer.conf``:: diff --git a/releasenotes/notes/ship-yaml-files-33aa5852bedba7f0.yaml b/releasenotes/notes/ship-yaml-files-33aa5852bedba7f0.yaml new file mode 100644 index 0000000000..91c706acb2 --- /dev/null +++ b/releasenotes/notes/ship-yaml-files-33aa5852bedba7f0.yaml @@ -0,0 +1,7 @@ +--- +other: + - | + Ship YAML files to ceilometer/pipeline/data/ make it convenient + to update all the files on upgrade. Users can copy yaml files from + /usr/share/ceilometer and customise their own files located in + /etc/ceilometer/.