summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJulien Danjou <julien@danjou.info>2016-12-12 19:06:30 +0100
committerJulien Danjou <julien@danjou.info>2017-01-06 16:33:53 +0100
commit8d23f431ab0bd638edbf2197e56bea68d7b06a21 (patch)
treec35c4e6574c401aeb59a71ed345d82d42be5346f /tools
parent407b726fc2ba76a7a149a8722b7cf9b09d8dc0d3 (diff)
downloadceilometer-8d23f431ab0bd638edbf2197e56bea68d7b06a21.tar.gz
Remove events storage and API
This now has been moved to Panko. Change-Id: I179eb0d436752e3bb8abaed714664cf74f5615e6
Diffstat (limited to 'tools')
-rwxr-xr-xtools/ceilometer-test-event.py83
-rwxr-xr-xtools/make_test_event_data.py116
-rwxr-xr-xtools/test_hbase_table_utils.py3
3 files changed, 0 insertions, 202 deletions
diff --git a/tools/ceilometer-test-event.py b/tools/ceilometer-test-event.py
deleted file mode 100755
index dedc7ac0..00000000
--- a/tools/ceilometer-test-event.py
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2013 Rackspace Hosting.
-#
-# 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
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-"""Command line tool help you debug your event definitions.
-
-Feed it a list of test notifications in json format, and it will show
-you what events will be generated.
-"""
-
-import json
-import sys
-
-from oslo_config import cfg
-from stevedore import extension
-
-from ceilometer.event import converter
-from ceilometer import service
-
-
-cfg.CONF.register_cli_opts([
- cfg.StrOpt('input-file',
- short='i',
- help='File to read test notifications from.'
- ' (Containing a json list of notifications.)'
- ' defaults to stdin.'),
- cfg.StrOpt('output-file',
- short='o',
- help='File to write results to. Defaults to stdout.'),
-])
-
-TYPES = {1: 'text',
- 2: 'int',
- 3: 'float',
- 4: 'datetime'}
-
-
-service.prepare_service()
-
-output_file = cfg.CONF.output_file
-input_file = cfg.CONF.input_file
-
-if output_file is None:
- out = sys.stdout
-else:
- out = open(output_file, 'w')
-
-if input_file is None:
- notifications = json.load(sys.stdin)
-else:
- with open(input_file, 'r') as f:
- notifications = json.load(f)
-
-out.write("Definitions file: %s\n" % cfg.CONF.event.definitions_cfg_file)
-out.write("Notifications tested: %s\n" % len(notifications))
-
-event_converter = converter.setup_events(
- extension.ExtensionManager(
- namespace='ceilometer.event.trait_plugin'))
-
-for notification in notifications:
- event = event_converter.to_event(notification)
- if event is None:
- out.write("Dropped notification: %s\n" %
- notification['message_id'])
- continue
- out.write("Event: %s at %s\n" % (event.event_type, event.generated))
- for trait in event.traits:
- dtype = TYPES[trait.dtype]
- out.write(" Trait: name: %s, type: %s, value: %s\n" % (
- trait.name, dtype, trait.value))
diff --git a/tools/make_test_event_data.py b/tools/make_test_event_data.py
deleted file mode 100755
index 1df6db4f..00000000
--- a/tools/make_test_event_data.py
+++ /dev/null
@@ -1,116 +0,0 @@
-#!/usr/bin/env python
-#
-# 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
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-"""Command line tool for creating event test data for Ceilometer.
-
-Usage:
-
-Generate testing data for e.g. for default time span
-
-source .tox/py27/bin/activate
-./tools/make_test_event_data.py --event_types 3
-"""
-import argparse
-import datetime
-import random
-import uuid
-
-from oslo_config import cfg
-from oslo_utils import timeutils
-
-from ceilometer.event.storage import models
-from ceilometer import storage
-
-
-def make_test_data(conn, start, end, interval, event_types):
-
- # Compute start and end timestamps for the new data.
- if isinstance(start, datetime.datetime):
- timestamp = start
- else:
- timestamp = timeutils.parse_strtime(start)
-
- if not isinstance(end, datetime.datetime):
- end = timeutils.parse_strtime(end)
-
- increment = datetime.timedelta(minutes=interval)
-
- print('Adding new events')
- n = 0
- while timestamp <= end:
- data = []
- for i in range(event_types):
- traits = [models.Trait('id1_%d' % i, 1, str(uuid.uuid4())),
- models.Trait('id2_%d' % i, 2, random.randint(1, 10)),
- models.Trait('id3_%d' % i, 3, random.random()),
- models.Trait('id4_%d' % i, 4, timestamp)]
- data.append(models.Event(str(uuid.uuid4()),
- 'event_type%d' % i,
- timestamp,
- traits,
- {}))
- n += 1
- conn.record_events(data)
- timestamp = timestamp + increment
- print('Added %d new events' % n)
-
-
-def main():
- cfg.CONF([], project='ceilometer')
-
- parser = argparse.ArgumentParser(
- description='generate event data',
- )
- parser.add_argument(
- '--interval',
- default=10,
- type=int,
- help='The period between events, in minutes.',
- )
- parser.add_argument(
- '--start',
- default=31,
- type=int,
- help='The number of days in the past to start timestamps.',
- )
- parser.add_argument(
- '--end',
- default=2,
- type=int,
- help='The number of days into the future to continue timestamps.',
- )
- parser.add_argument(
- '--event_types',
- default=3,
- type=int,
- help='The number of unique event_types.',
- )
- args = parser.parse_args()
-
- # Connect to the event database
- conn = storage.get_connection_from_config(cfg.CONF, 'event')
-
- # Compute the correct time span
- start = datetime.datetime.utcnow() - datetime.timedelta(days=args.start)
- end = datetime.datetime.utcnow() + datetime.timedelta(days=args.end)
-
- make_test_data(conn=conn,
- start=start,
- end=end,
- interval=args.interval,
- event_types=args.event_types)
-
-
-if __name__ == '__main__':
- main()
diff --git a/tools/test_hbase_table_utils.py b/tools/test_hbase_table_utils.py
index 10294e31..3a8b08fa 100755
--- a/tools/test_hbase_table_utils.py
+++ b/tools/test_hbase_table_utils.py
@@ -27,14 +27,11 @@ def main(argv):
(os.getenv("CEILOMETER_TEST_STORAGE_URL"),
os.getenv("CEILOMETER_TEST_HBASE_TABLE_PREFIX", "test")))
conn = storage.get_connection(url, 'ceilometer.metering.storage')
- event_conn = storage.get_connection(url, 'ceilometer.event.storage')
for arg in argv:
if arg == "--upgrade":
conn.upgrade()
- event_conn.upgrade()
if arg == "--clear":
conn.clear()
- event_conn.clear()
if __name__ == '__main__':