Puppet Class: prometheus::service_reload

Defined in:
manifests/service_reload.pp

Summary

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

Overview



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

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|none)$/ => "service ${init_selector} reload",
      /^(sysv|sles)$/    => "/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,
    }
  }
}