more munin enhancements
authordavid <david@f03ff2f1-f02d-0410-970d-b9634babeaa1>
Tue, 7 Aug 2007 18:40:25 +0000 (18:40 +0000)
committerdavid <david@f03ff2f1-f02d-0410-970d-b9634babeaa1>
Tue, 7 Aug 2007 18:40:25 +0000 (18:40 +0000)
git-svn-id: http://club.black.co.at:82/svn/manifests/trunk@181 f03ff2f1-f02d-0410-970d-b9634babeaa1

files/facter/acpi_available.rb [new file with mode: 0644]
manifests/plugin.pp

diff --git a/files/facter/acpi_available.rb b/files/facter/acpi_available.rb
new file mode 100644 (file)
index 0000000..45e5288
--- /dev/null
@@ -0,0 +1,10 @@
+# return whether acpi is available -- used for desiding whether to install the munin plugin
+Facter.add("acpi_available") do
+       setcode do
+               if `acpi -t -B -A 2>/dev/null`.match(/\d/).nil? 
+                       "false"
+               else
+                       "true"
+               end
+       end
+end
index 3b1e80a..e875ddb 100644 (file)
@@ -81,9 +81,13 @@ class munin::plugins::base {
                        notify => Service[munin-node];
        }
 
-       puppet::fact{ interfaces:
-               source => "puppet://$servername/munin/facter/interfaces.rb",
-               require => Package[iproute],
+       puppet::fact{
+               interfaces:
+                       source => "puppet://$servername/munin/facter/interfaces.rb",
+                       require => Package[iproute];
+               acpi_available:
+                       source => "puppet://$servername/munin/facter/acpi_available.rb",
+                       require => Package[acpi];
        }
 }
 
@@ -110,6 +114,10 @@ class munin::plugins::linux inherits munin::plugins::base {
                        ensure => present;
        }
 
+       if $acpi_available {
+               plugin { acpi: }
+       }
+
        include munin::plugins::interfaces
 }