summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--files/facter/acpi_available.rb10
-rw-r--r--manifests/plugin.pp14
2 files changed, 21 insertions, 3 deletions
diff --git a/files/facter/acpi_available.rb b/files/facter/acpi_available.rb
new file mode 100644
index 0000000..45e5288
--- /dev/null
+++ b/files/facter/acpi_available.rb
@@ -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
diff --git a/manifests/plugin.pp b/manifests/plugin.pp
index 3b1e80a..e875ddb 100644
--- a/manifests/plugin.pp
+++ b/manifests/plugin.pp
@@ -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
}