]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/hardware/recipes/default.rb
Restart postgres exporter when the configuration changes
[chef.git] / cookbooks / hardware / recipes / default.rb
index c5b5ac226ef6d42c51a9c717d5e347ea0660da7f..711fa45712420f6a8d0302671f3d32dcc5acfbda 100644 (file)
@@ -20,6 +20,7 @@
 include_recipe "apt"
 include_recipe "git"
 include_recipe "munin"
+include_recipe "prometheus"
 include_recipe "sysfs"
 include_recipe "tools"
 
@@ -140,6 +141,7 @@ if File.exist?("/etc/default/grub")
   execute "update-grub" do
     action :nothing
     command "/usr/sbin/update-grub"
+    not_if { ENV["TEST_KITCHEN"] }
   end
 
   template "/etc/default/grub" do
@@ -450,6 +452,18 @@ if disks.count.positive?
       conf_variables :disk => disk
     end
   end
+
+  template "/etc/prometheus/collectors/smart.devices" do
+    source "smart.devices.erb"
+    owner "root"
+    group "root"
+    mode "644"
+    variables :disks => disks
+  end
+
+  prometheus_collector "smart" do
+    interval "15m"
+  end
 else
   service "smartd" do
     action [:stop, :disable]