summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2010-07-01 04:17:29 +0200
committermh <mh@immerda.ch>2010-07-01 04:17:29 +0200
commit694b811204b35f8f30f5f6bcefe3435d83c43705 (patch)
tree48a8b2c2c806bef488ae243e7231adc6c45cb227
parent481a621f2411fc6cb87521760897f5c5c6f47ea9 (diff)
parent41571b20b23d7313c192e233ec9b76a89af05354 (diff)
Merge branch 'koumbit'
-rw-r--r--files/configs/Debian/nagios.cfg1
l---------files/configs/Debian/private/resource.cfg.amd641
l---------[-rw-r--r--]files/configs/Debian/private/resource.cfg.x86_6432
-rw-r--r--files/htpasswd.users0
-rw-r--r--lib/facter/mountpoints.rb50
-rw-r--r--manifests/apache.pp2
6 files changed, 54 insertions, 32 deletions
diff --git a/files/configs/Debian/nagios.cfg b/files/configs/Debian/nagios.cfg
index 377da6b..8eae393 100644
--- a/files/configs/Debian/nagios.cfg
+++ b/files/configs/Debian/nagios.cfg
@@ -20,6 +20,7 @@ log_file=/var/log/nagios3/nagios.log
# host groups, contacts, contact groups, services, etc.
# You can split your object definitions across several config files
# if you wish (as shown below), or keep them all in a single config file.
+cfg_file=/etc/nagios3/commands.cfg
# Puppet-managed configuration files
cfg_dir=/etc/nagios3/conf.d
diff --git a/files/configs/Debian/private/resource.cfg.amd64 b/files/configs/Debian/private/resource.cfg.amd64
new file mode 120000
index 0000000..4d5f0a3
--- /dev/null
+++ b/files/configs/Debian/private/resource.cfg.amd64
@@ -0,0 +1 @@
+resource.cfg.i386 \ No newline at end of file
diff --git a/files/configs/Debian/private/resource.cfg.x86_64 b/files/configs/Debian/private/resource.cfg.x86_64
index 3ed732b..4d5f0a3 100644..120000
--- a/files/configs/Debian/private/resource.cfg.x86_64
+++ b/files/configs/Debian/private/resource.cfg.x86_64
@@ -1,31 +1 @@
-###########################################################################
-#
-# RESOURCE.CFG - Resource File for Nagios
-#
-# You can define $USERx$ macros in this file, which can in turn be used
-# in command definitions in your host config file(s). $USERx$ macros are
-# useful for storing sensitive information such as usernames, passwords,
-# etc. They are also handy for specifying the path to plugins and
-# event handlers - if you decide to move the plugins or event handlers to
-# a different directory in the future, you can just update one or two
-# $USERx$ macros, instead of modifying a lot of command definitions.
-#
-# The CGIs will not attempt to read the contents of resource files, so
-# you can set restrictive permissions (600 or 660) on them.
-#
-# Nagios supports up to 32 $USERx$ macros ($USER1$ through $USER32$)
-#
-# Resource files may also be used to store configuration directives for
-# external data sources like MySQL...
-#
-###########################################################################
-
-# Sets $USER1$ to be the path to the plugins
-$USER1$=/usr/lib/nagios/plugins
-
-# Sets $USER2$ to be the path to event handlers
-#$USER2$=/usr/lib/nagios/plugins/eventhandlers
-
-# Store some usernames and passwords (hidden from the CGIs)
-#$USER3$=someuser
-#$USER4$=somepassword
+resource.cfg.i386 \ No newline at end of file
diff --git a/files/htpasswd.users b/files/htpasswd.users
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/files/htpasswd.users
diff --git a/lib/facter/mountpoints.rb b/lib/facter/mountpoints.rb
new file mode 100644
index 0000000..c51e6e6
--- /dev/null
+++ b/lib/facter/mountpoints.rb
@@ -0,0 +1,50 @@
+begin
+
+ mountpoints = []
+ # we show devices, but we avoid outputing duplicate devices
+ devices = []
+ Facter.add("mountpoints") do
+ ignorefs = ["NFS", "nfs", "nfs4", "nfsd", "afs", "binfmt_misc", "proc", "smbfs",
+ "autofs", "iso9660", "ncpfs", "coda", "devpts", "ftpfs", "devfs",
+ "mfs", "shfs", "sysfs", "cifs", "lustre_lite", "tmpfs", "usbfs", "udf",
+ "fusectl", "fuse.snapshotfs", "rpc_pipefs"]
+ begin
+ require 'filesystem'
+ rescue Exception => e
+ confine :kernel => :linux
+ ENV["PATH"]="/bin:/sbin:/usr/bin:/usr/sbin"
+ fs_source = nil
+ if FileTest.exists?("/etc/mtab")
+ fs_source = "/etc/mtab"
+ elsif FileTest.exists?("/proc/mounts")
+ fs_source = "/proc/mounts"
+ end
+
+ mounts = File.read(fs_source).split("\n")
+ mounts.each do |mount|
+ mount = mount.split(" ")
+ if ((not ignorefs.include?(mount[2])) && (mount[3] !~ /bind/) && (not devices.include?(mount[0])) && (not mountpoints.include?(mount[1])))
+ mountpoints.push(mount[1])
+ end
+ devices.push(mount[0]) if not devices.include?(mount[0])
+ end
+ else
+ FileSystem.mounts.each do |m|
+ if ((not ignorefs.include?(m.fstype)) && (m.options !~ /bind/) && !devices.include?(mount[0]))
+ mountpoints.push(m.mount)
+ end
+ devices.push(m.mount) if not devices.include?(m.mount)
+ end
+ end
+ setcode do
+ mountpoints.join(",")
+ end
+ end
+ Facter.add("devices") do
+ setcode do
+ devices.join(",")
+ end
+ end
+
+rescue Exception => e
+end
diff --git a/manifests/apache.pp b/manifests/apache.pp
index 36994f8..c00b1d9 100644
--- a/manifests/apache.pp
+++ b/manifests/apache.pp
@@ -1,4 +1,4 @@
-class nagios::apache {
+class nagios::apache inherits ::apache {
$nagios_httpd = 'apache'
include nagios
}