From 6326fbc9ca5caff07ba662c331922205b3a77716 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Wed, 11 Jun 2014 13:52:34 +0000 Subject: [PATCH] Use munin to monitor temperature sensors on some hosts (those having a /sys/devices/virtual/thermal/thermal_zone0/temp for now) --- modules/debian-org/lib/facter/system-hw.rb | 11 +++++++++++ modules/hardware/manifests/init.pp | 2 ++ modules/hardware/manifests/sensors.pp | 6 ++++++ 3 files changed, 19 insertions(+) create mode 100644 modules/hardware/manifests/sensors.pp diff --git a/modules/debian-org/lib/facter/system-hw.rb b/modules/debian-org/lib/facter/system-hw.rb index aa50185ea..0b36e5feb 100644 --- a/modules/debian-org/lib/facter/system-hw.rb +++ b/modules/debian-org/lib/facter/system-hw.rb @@ -8,3 +8,14 @@ Facter.add("systemproductname") do end end end + +Facter.add("hw_can_temp_sensors") do + confine :kernel => :linux + setcode do + if FileTest.exist?("/sys/devices/virtual/thermal/thermal_zone0/temp") + true + else + '' + end + end +end diff --git a/modules/hardware/manifests/init.pp b/modules/hardware/manifests/init.pp index 0e3de20f8..8b9da9d4d 100644 --- a/modules/hardware/manifests/init.pp +++ b/modules/hardware/manifests/init.pp @@ -6,4 +6,6 @@ class hardware { content => "Package: hp-health\nPin: version 8.6*\nPin-Priority: 1100\n" } } + + include hardware::sensors } diff --git a/modules/hardware/manifests/sensors.pp b/modules/hardware/manifests/sensors.pp new file mode 100644 index 000000000..b52b95e85 --- /dev/null +++ b/modules/hardware/manifests/sensors.pp @@ -0,0 +1,6 @@ +class hardware::sensors { + if $::hw_can_temp_sensors { + package { 'lm-sensors': ensure => installed, } + munin::check { 'sensors_temp': script => 'sensors_' } + } +} -- 2.20.1