]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/influx: Set a default retention of 8 weeks on database
authorWido den Hollander <wido@42on.com>
Wed, 31 Jan 2018 13:36:21 +0000 (14:36 +0100)
committerWido den Hollander <wido@42on.com>
Tue, 20 Feb 2018 08:20:18 +0000 (09:20 +0100)
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 <wido@42on.com>
src/pybind/mgr/influx/module.py

index d2cce6347507a812322a35b4e269757f0132702e..ff498095944cf0879e5b9ddefac69e70c7bcf083 100644 (file)
@@ -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': {