forked from voxpupuli/puppet-prometheus
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented service reload for Prometheus
With this commit all the configuration files that can be reload on-the-fly like prometheus.yml and alerts rules do not trigger a full service restart like they did til now. I left the possibility to choose if a change to a command-line flag should or not restart prometheus (thus applying the change on puppet run) with the already existing flag (still true by default).
- Loading branch information
Showing
4 changed files
with
44 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# This class implements prometheus service reload | ||
# without restarting the whole service when a config | ||
# changes | ||
class prometheus::service_reload() { | ||
|
||
if $prometheus::manage_service == true { | ||
$init_selector = $prometheus::run_service::init_selector | ||
|
||
$prometheus_reload = $prometheus::init_style ? { | ||
'systemd' => "systemctl reload ${init_selector}", | ||
'upstart' => "upstart reload ${init_selector}", | ||
'sysv' => "/etc/init.d/${init_selector} reload", | ||
'sles' => "/etc/init.d/${init_selector} reload", | ||
'debian' => "/etc/init.d/${init_selector} reload", | ||
'launchd' => "launchctl stop ${init_selector} && launchctl start ${init_selector}", | ||
} | ||
|
||
exec { 'prometheus-reload': | ||
command => $prometheus_reload, | ||
refreshonly => true, | ||
} | ||
} | ||
} |