summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Filion <gabriel@koumbit.org>2011-01-24 13:07:47 -0500
committerGabriel Filion <lelutin@gmail.com>2012-04-09 23:47:32 -0400
commitef56fdd676408a1068dd9b666fb2cf57b518fd04 (patch)
tree6a4aab52d0fd98da6060d241f7fb9c4d8ff7bcec
parent1c36e5c9188636aa7e5d093e2330356b24832ada (diff)
Add NRPE support for FreeBSD
Configuration needs to be placed in a different directory in FreeBSD. Some packages are not named the same under FreeBSD. Some packages are not available under FreeBSD. Migrate those to a new nagios::nrpe::linux class so that FreeBSD does not take them into account.
-rw-r--r--manifests/nrpe.pp44
-rw-r--r--manifests/nrpe/base.pp33
-rw-r--r--manifests/nrpe/freebsd.pp10
-rw-r--r--manifests/nrpe/linux.pp9
4 files changed, 64 insertions, 32 deletions
diff --git a/manifests/nrpe.pp b/manifests/nrpe.pp
index ff22441..fe75708 100644
--- a/manifests/nrpe.pp
+++ b/manifests/nrpe.pp
@@ -1,37 +1,17 @@
class nagios::nrpe {
- if $nagios_nrpe_cfgdir == '' { $nagios_nrpe_cfgdir = '/etc/nagios' }
+ case $operatingsystem {
+ 'freebsd': {
+ if $nagios_nrpe_cfgdir == '' { $nagios_nrpe_cfgdir = '/usr/local/etc' }
- package { "nagios-nrpe-server": ensure => latest;
- "nagios-plugins-basic": ensure => latest;
- "nagios-plugins-standard": ensure => latest;
- "libnagios-plugin-perl": ensure => present;
- "libwww-perl": ensure => present; # für check_apache
- "ksh": ensure => present; # für check_cpustats.sh
- "sysstat": ensure => present; # für check_cpustats.sh
- }
-
- file { [ $nagios_nrpe_cfgdir, "$nagios_nrpe_cfgdir/nrpe.d" ]:
- ensure => directory }
-
- file { "$nagios_nrpe_cfgdir/nrpe.cfg":
- content => template('nagios/nrpe/nrpe.cfg'),
- owner => root, group => root, mode => 644;
- }
-
- # default commands
- file { "$nagios_nrpe_cfgdir/nrpe.d/nrpe_commands.cfg":
- source => [ "puppet:///site-nagios/nrpe/nrpe_commands.cfg",
- "puppet:///nagios/nrpe/nrpe_commands.cfg" ],
- owner => root, group => root, mode => 644;
- }
-
- service { "nagios-nrpe-server":
- ensure => running,
- enable => true,
- pattern => "nrpe",
- subscribe => [ File["$nagios_nrpe_cfgdir/nrpe.cfg"],
- File["$nagios_nrpe_cfgdir/nrpe.d/nrpe_commands.cfg"] ]
- }
+ include nagios::nrpe::freebsd
+ }
+ default: {
+ case $kernel {
+ linux: { include nagios::nrpe::linux }
+ default: { include nagios::nrpe::base }
+ }
+ }
+ }
}
diff --git a/manifests/nrpe/base.pp b/manifests/nrpe/base.pp
new file mode 100644
index 0000000..6e39d7e
--- /dev/null
+++ b/manifests/nrpe/base.pp
@@ -0,0 +1,33 @@
+class nagios::nrpe::base {
+
+ if $nagios_nrpe_cfgdir == '' { $nagios_nrpe_cfgdir = '/etc/nagios' }
+ if $nagios_nrpe_dont_blame == '' { $nagios_nrpe_dont_blame = 1 }
+
+ package { "nagios-nrpe-server": ensure => present;
+ "nagios-plugins-basic": ensure => present;
+ "libnagios-plugin-perl": ensure => present;
+ "libwww-perl": ensure => present; # for check_apache
+ }
+
+
+ file { [ $nagios_nrpe_cfgdir, "$nagios_nrpe_cfgdir/nrpe.d" ]:
+ ensure => directory }
+
+ file { "$nagios_nrpe_cfgdir/nrpe.cfg":
+ content => template('nagios/nrpe/nrpe.cfg'),
+ owner => root, group => root, mode => 644;
+ }
+
+ # default commands
+ nagios::nrpe::command { "basic_nrpe":
+ source => [ "puppet:///modules/site-nagios/configs/nrpe/nrpe_commands.cfg",
+ "puppet:///modules/nagios/nrpe/nrpe_commands.cfg" ],
+ }
+
+ service { "nagios-nrpe-server":
+ ensure => running,
+ enable => true,
+ pattern => "nrpe",
+ subscribe => File["$nagios_nrpe_cfgdir/nrpe.cfg"]
+ }
+}
diff --git a/manifests/nrpe/freebsd.pp b/manifests/nrpe/freebsd.pp
new file mode 100644
index 0000000..3e1e0e1
--- /dev/null
+++ b/manifests/nrpe/freebsd.pp
@@ -0,0 +1,10 @@
+class nagios::nrpe::freebsd inherits nagios::nrpe::base {
+
+ Package["nagios-nrpe-server"] { name => "nrpe2" }
+ Package["nagios-plugins-basic"] { name => "nagios-plugins" }
+ Package["libnagios-plugin-perl"] { name => "p5-Nagios-Plugin" }
+ Package["libwww-perl"] { name => "p5-libwww" }
+
+ # TODO check_cpustats.sh is probably not working as of now. the package 'sysstat' is not available under FreeBSD
+
+}
diff --git a/manifests/nrpe/linux.pp b/manifests/nrpe/linux.pp
new file mode 100644
index 0000000..14e007f
--- /dev/null
+++ b/manifests/nrpe/linux.pp
@@ -0,0 +1,9 @@
+class nagios::nrpe::linux inherits nagios::nrpe::base {
+
+ package {
+ "nagios-plugins-standard": ensure => present;
+ "ksh": ensure => present; # for check_cpustats.sh
+ "sysstat": ensure => present; # for check_cpustats.sh
+ }
+
+}