]> git.openstreetmap.org Git - chef.git/commitdiff
Ignore disconnected fans on errol
authorTom Hughes <tom@compton.nu>
Sun, 24 Jan 2021 19:27:24 +0000 (19:27 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 24 Jan 2021 22:42:45 +0000 (22:42 +0000)
cookbooks/hardware/attributes/default.rb
cookbooks/prometheus/metadata.rb
cookbooks/prometheus/recipes/default.rb
roles/tyan-s7010.rb

index c7b16060842e618fd1ae752ec12534a3d902a723..bbe44348e69f5f852af112d4f25a3993560acc36 100644 (file)
@@ -1,6 +1,7 @@
 default[:hardware][:modules] = %w[lp]
 default[:hardware][:grub][:cmdline] = %w[nomodeset]
 default[:hardware][:sensors] = {}
+default[:hardware][:hwmon] = {}
 default[:hardware][:ipmi][:excluded_sensors] = []
 
 if node[:dmi] && node[:dmi][:system]
index 2ac7f9bf70dc1b4f8c87f5001ba10559a4767b0b..0d635560a766f67fc53380a41d523cf5a891f6cb 100644 (file)
@@ -9,5 +9,6 @@ supports          "ubuntu"
 depends           "apache"
 depends           "apt"
 depends           "git"
+depends           "hardware"
 depends           "networking"
 depends           "timescaledb"
index 4011e05bde465cc3c9426a70ab6289b468996ea2..2ad1d69aa7934eb0098f177721f0ce2032a1e966 100644 (file)
@@ -87,6 +87,20 @@ template "/var/lib/prometheus/node-exporter/chef.prom" do
   mode "644"
 end
 
+metric_relabel = []
+
+node[:hardware][:hwmon].each do |chip, details|
+  next unless details[:ignore]
+
+  sensors = details[:ignore].join("|")
+
+  metric_relabel << {
+    :source_labels => "chip,sensor",
+    :regex => "#{chip};(#{sensors})",
+    :action => "drop"
+  }
+end
+
 prometheus_exporter "node" do
   port 9100
   options %w[
@@ -97,4 +111,5 @@ prometheus_exporter "node" do
     --collector.systemd
     --collector.tcpstat
   ]
+  metric_relabel metric_relabel
 end
index ef08ff121b3878ce0947b7b277c9d181941723df..fb1cd1b9163e9e0f143fdaf25b6d7fb9c616fba9 100644 (file)
@@ -3,6 +3,11 @@ description "Role applied to machines using the Tyan S7010 motherboard"
 
 default_attributes(
   :hardware => {
+    :hwmon => {
+      "i2c_0_0_002f" => {
+        :ignore => %w[fan3 fan4 fan5 fan6 fan7 fan8 fan9 fan10 fan11 fan12]
+      }
+    },
     :ipmi => {
       :excluded_sensors => [13, 14, 15, 16, 17, 18, 19, 20]
     },