Puppet Class: prometheus::service_reload

Defined in:
manifests/service_reload.pp

Overview

This class implements prometheus service reload without restarting the whole service when a config changes



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'manifests/service_reload.pp', line 4

class prometheus::service_reload() {

  if $prometheus::server::manage_service == true {
    $init_selector = $prometheus::run_service::init_selector

    $prometheus_reload = $prometheus::server::init_style ? {
      'systemd' => "systemctl reload-or-restart ${init_selector}",
      'upstart' => "service ${init_selector} reload",
      '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,
      path        => [ '/usr/bin', '/bin', '/usr/sbin', '/sbin' ],
      refreshonly => true,
    }
  }
}