diff --git a/site-cookbooks/kosmos_prometheus/recipes/alertmanager.rb b/site-cookbooks/kosmos_prometheus/recipes/alertmanager.rb index 1984732..4ed73ca 100644 --- a/site-cookbooks/kosmos_prometheus/recipes/alertmanager.rb +++ b/site-cookbooks/kosmos_prometheus/recipes/alertmanager.rb @@ -11,6 +11,13 @@ prometheus_alertmanager_install "alertmanager" do end prometheus_alertmanager_config "alertmanager" + +execute "restart alertmanager config" do + command "systemctl restart alertmanager.service" + action :nothing + subscribes :run, "template[/opt/prometheus/alertmanager.yml]", :delayed +end + prometheus_alertmanager_service "alertmanager" firewall_rule "prometheus alertmanager" do diff --git a/site-cookbooks/kosmos_prometheus/recipes/server.rb b/site-cookbooks/kosmos_prometheus/recipes/server.rb index 16867c2..3256944 100644 --- a/site-cookbooks/kosmos_prometheus/recipes/server.rb +++ b/site-cookbooks/kosmos_prometheus/recipes/server.rb @@ -23,6 +23,14 @@ prometheus_job "node" do target "localhost:9100" end +with_run_context :root do + execute "reload prometheus config" do + command "systemctl reload prometheus.service" + action :nothing + subscribes :run, "template[/opt/prometheus/prometheus.yml]", :delayed + end +end + prometheus_service "prometheus" do cli_options({ "config.file" => "/opt/prometheus/prometheus.yml",