Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

(SUP-2137) To add parameters to configure telegraf database retention policy #188

Merged
merged 1 commit into from
Oct 11, 2021
Merged

(SUP-2137) To add parameters to configure telegraf database retention policy #188

merged 1 commit into from
Oct 11, 2021

Conversation

henrywangpuppet
Copy link
Contributor

@henrywangpuppet henrywangpuppet commented Sep 27, 2021

Updated in latest comments

@henrywangpuppet henrywangpuppet added the enhancement New feature or request label Sep 27, 2021
@henrywangpuppet henrywangpuppet requested a review from a team as a code owner September 27, 2021 08:24
@puppet-community-rangefinder
Copy link

puppet_metrics_dashboard is a class

that may have no external impact to Forge modules.

puppet_metrics_dashboard::post_start_configs is a class

that may have no external impact to Forge modules.

This module is declared in 0 of 578 indexed public Puppetfiles.


These results were generated with Rangefinder, a tool that helps predict the downstream impact of breaking changes to elements used in Puppet modules. You can run this on the command line to get a full report.

Exact matches are those that we can positively identify via namespace and the declaring modules' metadata. Non-namespaced items, such as Puppet 3.x functions, will always be reported as near matches only.

@henrywangpuppet
Copy link
Contributor Author

Update coding to make it simpler, in general, this PR:
Add a new parameter Optional[String[1]] $telegraf_db_retention_duration = undef,
Once set up a value, for example 6w, the puppet agent run will setup a retention policy for the database telegraf is using:

[root@pe-201981-agent-2 log]# puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Info: Caching catalog for pe-201981-agent-2.puppetdebug.vlan
Info: Applying configuration version '1632987795'
Notice: /Stage[main]/Puppet_metrics_dashboard::Post_start_configs/Exec[create default telegraf database retention policy]/returns: executed successfully
Notice: Applied catalog in 0.50 seconds
[root@pe-201981-agent-2 log]#

In the corresponding database, a retention policy telegraf_default is added with the duration specified:

> show retention policies on telegraf;
name             duration  shardGroupDuration replicaN default
----             --------  ------------------ -------- -------
autogen          0s        168h0m0s           1        false
telegraf_default 1008h0m0s 24h0m0s            1        true

Resetting the parameter to undef will remove the policy:

[root@pe-201981-agent-2 log]# puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Info: Caching catalog for pe-201981-agent-2.puppetdebug.vlan
Info: Applying configuration version '1632987795'
Notice: /Stage[main]/Puppet_metrics_dashboard::Post_start_configs/Exec[drop existing retention policy if ever created]/returns: executed successfully
Notice: Applied catalog in 0.51 seconds
> show retention policies on telegraf;
name    duration shardGroupDuration replicaN default
----    -------- ------------------ -------- -------
autogen 0s       168h0m0s           1        false

Lab implemented this pr:

PE 10.32.47.152 - Node Group: MetricsDashboardTest-2
Dashboard: 10.32.47.92

@MartyEwings MartyEwings requested a review from coreymbe October 8, 2021 11:28
@coreymbe
Copy link
Contributor

Finished testing these changes out late last week. Everything LGTM!

@coreymbe coreymbe merged commit b3a6c06 into puppetlabs:main Oct 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants