From: Wido den Hollander Date: Wed, 31 Jan 2018 13:36:21 +0000 (+0100) Subject: mgr/influx: Set a default retention of 8 weeks on database X-Git-Tag: v13.1.0~483^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d743b11ee62a8a2585607cc56b1d8e8ade2c3e58;p=ceph.git mgr/influx: Set a default retention of 8 weeks on database Without a retention policy it is up to the administrator to set a retention policy on the data. This can easily be forgotten resulting in a ever growing InfluxDB database. Users can change the retention policy if they want to afterwards, this is just the default policy set by the InfluxDB module when it initially creates the database. Signed-off-by: Wido den Hollander --- diff --git a/src/pybind/mgr/influx/module.py b/src/pybind/mgr/influx/module.py index d2cce634750..ff498095944 100644 --- a/src/pybind/mgr/influx/module.py +++ b/src/pybind/mgr/influx/module.py @@ -230,6 +230,9 @@ class Module(MgrModule): "'%s'", self.config['database'], self.config['username']) client.create_database(self.config['database']) + client.create_retention_policy(name='8_weeks', duration='8w', + replication='1', default=True, + database=self.config['database']) else: self.set_health_checks({ 'MGR_INFLUX_SEND_FAILED': {