]> git.openstreetmap.org Git - chef.git/commitdiff
Ignore unconnected IPMI sensors on gorynych
authorTom Hughes <tom@compton.nu>
Thu, 21 Jan 2021 18:36:53 +0000 (18:36 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 21 Jan 2021 18:42:56 +0000 (18:42 +0000)
cookbooks/hardware/attributes/default.rb
cookbooks/hardware/recipes/default.rb
cookbooks/hardware/templates/default/ipmi_local.yml.erb [new file with mode: 0644]
roles/gorynych.rb

index fdf843d63bca4ace317d6f36b3d6fc1616d6b0e6..c7b16060842e618fd1ae752ec12534a3d902a723 100644 (file)
@@ -1,6 +1,7 @@
 default[:hardware][:modules] = %w[lp]
 default[:hardware][:grub][:cmdline] = %w[nomodeset]
 default[:hardware][:sensors] = {}
+default[:hardware][:ipmi][:excluded_sensors] = []
 
 if node[:dmi] && node[:dmi][:system]
   case node[:dmi][:system][:manufacturer]
index 271e26754497350b6c67cb5fb3a38cf79dbeb0d4..df7af6e504beadd8078fc1ed8afdc7ac434bd643 100644 (file)
@@ -178,8 +178,17 @@ if node[:kernel][:modules].include?("ipmi_si")
   package "ipmitool"
   package "freeipmi-tools"
 
+  template "/etc/prometheus/ipmi_local.yml" do
+    source "ipmi_local.yml.erb"
+    owner "root"
+    group "root"
+    mode "644"
+  end
+
   prometheus_exporter "ipmi" do
     port 9290
+    options "--config.file=/etc/prometheus/ipmi_local.yml"
+    subscribes :restart, "template[/etc/prometheus/ipmi_local.yml]"
   end
 end
 
diff --git a/cookbooks/hardware/templates/default/ipmi_local.yml.erb b/cookbooks/hardware/templates/default/ipmi_local.yml.erb
new file mode 100644 (file)
index 0000000..4250a62
--- /dev/null
@@ -0,0 +1,13 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+modules:
+  default:
+    collectors:
+      - bmc
+      - ipmi
+      - dcmi
+      - chassis
+    exclude_sensor_ids:
+<% node[:hardware][:ipmi][:excluded_sensors].each do |sensor| -%>
+      - <%= sensor %>
+<% end -%>
index 5a172a5461abc6bc4d8fa1e70406acb980228fc0..c57c56e0f871920edac5826f63b7cbec3ed17c38 100644 (file)
@@ -3,6 +3,9 @@ description "Master role applied to gorynych"
 
 default_attributes(
   :hardware => {
+    :ipmi => {
+      :excluded_sensors => [3, 4]
+    },
     :shm_size => "20g"
   },
   :munin => {