From: Tom Hughes Date: Sun, 24 Jan 2021 19:27:24 +0000 (+0000) Subject: Ignore disconnected fans on errol X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/2644c33f556000f2c1eabe316784921af50be10c Ignore disconnected fans on errol --- diff --git a/cookbooks/hardware/attributes/default.rb b/cookbooks/hardware/attributes/default.rb index c7b160608..bbe44348e 100644 --- a/cookbooks/hardware/attributes/default.rb +++ b/cookbooks/hardware/attributes/default.rb @@ -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] diff --git a/cookbooks/prometheus/metadata.rb b/cookbooks/prometheus/metadata.rb index 2ac7f9bf7..0d635560a 100644 --- a/cookbooks/prometheus/metadata.rb +++ b/cookbooks/prometheus/metadata.rb @@ -9,5 +9,6 @@ supports "ubuntu" depends "apache" depends "apt" depends "git" +depends "hardware" depends "networking" depends "timescaledb" diff --git a/cookbooks/prometheus/recipes/default.rb b/cookbooks/prometheus/recipes/default.rb index 4011e05bd..2ad1d69aa 100644 --- a/cookbooks/prometheus/recipes/default.rb +++ b/cookbooks/prometheus/recipes/default.rb @@ -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 diff --git a/roles/tyan-s7010.rb b/roles/tyan-s7010.rb index ef08ff121..fb1cd1b91 100644 --- a/roles/tyan-s7010.rb +++ b/roles/tyan-s7010.rb @@ -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] },