Use munin to monitor temperature sensors on some hosts (those having a /sys/devices...
authorPeter Palfrader <peter@palfrader.org>
Wed, 11 Jun 2014 13:52:34 +0000 (13:52 +0000)
committerPeter Palfrader <peter@palfrader.org>
Wed, 11 Jun 2014 13:52:34 +0000 (13:52 +0000)
modules/debian-org/lib/facter/system-hw.rb
modules/hardware/manifests/init.pp
modules/hardware/manifests/sensors.pp [new file with mode: 0644]

index aa50185..0b36e5f 100644 (file)
@@ -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
index 0e3de20..8b9da9d 100644 (file)
@@ -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 (file)
index 0000000..b52b95e
--- /dev/null
@@ -0,0 +1,6 @@
+class hardware::sensors {
+       if $::hw_can_temp_sensors {
+               package { 'lm-sensors': ensure => installed, }
+               munin::check { 'sensors_temp': script => 'sensors_' }
+       }
+}