X-Git-Url: https://git.openstreetmap.org/chef.git/blobdiff_plain/aeaa46f3071de018b5c5e0f5678cb5b4082e3ddc..9917940ecf5a76f484fcab9f49f41d2bdf4c69f3:/cookbooks/hardware/recipes/default.rb diff --git a/cookbooks/hardware/recipes/default.rb b/cookbooks/hardware/recipes/default.rb index 6e155f04f..711fa4571 100644 --- a/cookbooks/hardware/recipes/default.rb +++ b/cookbooks/hardware/recipes/default.rb @@ -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 @@ -402,6 +404,13 @@ disks = disks.compact.uniq if disks.count.positive? package "smartmontools" + template "/etc/cron.daily/update-smart-drivedb" do + source "update-smart-drivedb.erb" + owner "root" + group "root" + mode "755" + end + template "/usr/local/bin/smartd-mailer" do source "smartd-mailer.erb" owner "root" @@ -424,7 +433,7 @@ if disks.count.positive? mode "644" end - service "smartd" do + service "smartmontools" do action [:enable, :start] subscribes :reload, "template[/etc/smartd.conf]" subscribes :restart, "template[/etc/default/smartmontools]" @@ -443,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]