Ask Your Question
8

How to clean up old ceilometer data ?

asked 2014-06-09 04:36:55 -0600

Hi,

i have installed ceilometer on my controller node and today I check that mongodb database size is 11 GB. I want to cleanup old data, how can I do ? There is a procedure/method ?

Thanks.

Salvo.

edit retag flag offensive close merge delete

4 answers

Sort by » oldest newest most voted
2

answered 2015-09-09 15:55:11 -0600

*Recreating the Ceilometer DB seems extreme to clean up data.

*I believe TTL will only delete old records from this point on not historical records.

Log in and see if the TTL modification actually decreased the size with the following commands.

mongo -u ceilometer -p {PASSWORD} ceilometer

show collections;

db.stats()

db.meter.stats()

db.resource.stats()

db.meter.getIndexes()

db.resource.getIndexes()

To configure TTL you’ll need to: update Ceilometer config on every controller node “/etc/ceilometer/ceilometer.conf” and set the “time_to_live” parameter to “86400” (1 day). or whatever period is suitable.

Next step you need is to setup cron job for ceilometer-expirer script:

run “crontab -e” in CLI, paste

0 0 * * * ceilometer-expirer --config-file /etc/ceilometer/ceilometer.conf

and save.

Then restart ceilometer-collector service on all controller nodes:

You can also manually remove a meter post a certain date with this command

db.meter.remove({"timestamp":{"$lt":ISODate("2015-03-31T19:00:40")}})
edit flag offensive delete link more
5

answered 2014-08-14 17:42:42 -0600

fgorbat gravatar image

updated 2014-08-14 17:44:33 -0600

hey,

Here is the procedure:
1. Drop ceilometer db by:

mongo --eval "db.dropDatabase();"

2. Stop mongo db

service mongod stop

3. Remove the data files from the disk

rm -f /var/lib/mongodb/ceilometer.*

4. Start mongo

service mongod start

Note: Validate correct startup by service mongod status

5. Recreate ceilometer db

mongo --host controller --eval '
db = db.getSiblingDB("ceilometer");
db.addUser({user: "ceilometer",
            pwd: "CEILOMETER_DBPASS",
            roles: [ "readWrite", "dbAdmin" ]})'

6. Restart ceilometer services

service openstack-ceilometer-api restart
service openstack-ceilometer-notification restart
service openstack-ceilometer-central restart
service openstack-ceilometer-collector restart
service openstack-ceilometer-alarm-evaluator restart
service openstack-ceilometer-alarm-notifier restart
edit flag offensive delete link more

Comments

Do these instructions change if you have a 3 node mongoDB setup?

Jet gravatar imageJet ( 2015-04-15 15:17:22 -0600 )edit
1

answered 2015-09-09 10:21:18 -0600

Hi,

I have another solution in configuration of ceilometer. If you open ceilometer.conf file you can found this code:

# number of seconds that samples are kept in the database for
# (<= 0 means forever) (integer value)
time_to_live=604800

By default the time_to_live is set to 0 that means forever! I have set the value to 604800 ( 7 days x 24 hours x 60 minute x 60 second ) and now my database does not grow.

edit flag offensive delete link more

Comments

Nice option.

mark gravatar imagemark ( 2015-10-08 00:24:29 -0600 )edit
0

answered 2017-11-14 02:35:53 -0600

AbuAyesha gravatar image

After changing the configuration for TTL with required time. Is that fine if we restart openstack ceilometer service

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

6 followers

Stats

Asked: 2014-06-09 04:36:55 -0600

Seen: 7,357 times

Last updated: Nov 14