From 0c44654a47fb46d7a236e633e12a640b6e5eaae9 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Tue, 6 Aug 2024 22:43:07 +1000 Subject: [PATCH] feat: auto restart puppetdb - found several times the puppetdb service locks up after a week of active time - restart the puppetdb nightly to prevent lock ups --- site/profiles/manifests/puppet/puppetdb_api.pp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/site/profiles/manifests/puppet/puppetdb_api.pp b/site/profiles/manifests/puppet/puppetdb_api.pp index 8c2177e..bdf7532 100644 --- a/site/profiles/manifests/puppet/puppetdb_api.pp +++ b/site/profiles/manifests/puppet/puppetdb_api.pp @@ -24,6 +24,19 @@ class profiles::puppet::puppetdb_api ( contain ::puppetdb::server + # generate the minute for the cron job using fqdn_rand + $random_minute = fqdn_rand(60) + + # create cron task to restart the puppetdb service daily at 3am + cron { 'restart_puppetdb': + ensure => 'present', + user => 'root', + command => '/bin/systemctl restart puppetdb', + minute => $random_minute, + hour => '3', + require => Service['puppetdb'], + } + class { 'prometheus::puppetdb_exporter': puppetdb_url => "http://${listen_address}:8080/pdb/query", export_scrape_job => true,