From ef56fdd676408a1068dd9b666fb2cf57b518fd04 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Mon, 24 Jan 2011 13:07:47 -0500 Subject: 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. --- manifests/nrpe/base.pp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 manifests/nrpe/base.pp (limited to 'manifests/nrpe/base.pp') 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"] + } +} -- cgit v1.2.3 From c9de09ece4508db6b216abd0f74f07ea7befe906 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Tue, 1 Feb 2011 16:21:20 -0500 Subject: nrpe FreeBSD compatibility Make some changes to ensure compatibility of the nrpe resources with FreeBSD. * Use group 0 instead of 'root' * capitalize values for testing $operatingsystem * override arguments for the nrpe service so that FreeBSD can find the init script --- manifests/nrpe/base.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/nrpe/base.pp') diff --git a/manifests/nrpe/base.pp b/manifests/nrpe/base.pp index 6e39d7e..d96dc3f 100644 --- a/manifests/nrpe/base.pp +++ b/manifests/nrpe/base.pp @@ -15,7 +15,7 @@ class nagios::nrpe::base { file { "$nagios_nrpe_cfgdir/nrpe.cfg": content => template('nagios/nrpe/nrpe.cfg'), - owner => root, group => root, mode => 644; + owner => root, group => 0, mode => 644; } # default commands -- cgit v1.2.3 From 7d9843fae4c939670f005661d5867578d0a0827e Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Tue, 15 Feb 2011 19:11:01 -0500 Subject: Avoid the "libnagios-plugin-perl" package for lenny This package doesn't exist on lenny. --- manifests/nrpe/base.pp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'manifests/nrpe/base.pp') diff --git a/manifests/nrpe/base.pp b/manifests/nrpe/base.pp index d96dc3f..8636760 100644 --- a/manifests/nrpe/base.pp +++ b/manifests/nrpe/base.pp @@ -1,18 +1,21 @@ 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 } + # Special-case lenny. the package doesn't exist + if $lsbdistcodename != 'lenny' { + package { "libnagios-plugin-perl": ensure => present; } + } file { [ $nagios_nrpe_cfgdir, "$nagios_nrpe_cfgdir/nrpe.d" ]: ensure => directory } + if $nagios_nrpe_dont_blame == '' { $nagios_nrpe_dont_blame = 1 } file { "$nagios_nrpe_cfgdir/nrpe.cfg": content => template('nagios/nrpe/nrpe.cfg'), owner => root, group => 0, mode => 644; -- cgit v1.2.3 From 7fb80fbecfa5a186846a2909bd1d6ada32ba21e1 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Wed, 27 Apr 2011 15:46:58 -0400 Subject: Define check_load as a function of the nb of cpus The "check_load" nagios check should not be hardcoded to some arbitrary value. The thresholds should rather be adjusted in function of how many CPUs are present in the server. The factors were chosen by prior experience but could be adjusted if needed. Factors for warning thresholds (where N is the nb of cpus): * 1min : 5 * N * 5mins : 4 * N * 15mins : 3 * N Factors for critical thresholds: * 1min : 10 * N * 5mins : 9 * N * 15mins : 8 * N --- manifests/nrpe/base.pp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'manifests/nrpe/base.pp') diff --git a/manifests/nrpe/base.pp b/manifests/nrpe/base.pp index 8636760..1d26849 100644 --- a/manifests/nrpe/base.pp +++ b/manifests/nrpe/base.pp @@ -23,9 +23,21 @@ class nagios::nrpe::base { # default commands nagios::nrpe::command { "basic_nrpe": - source => [ "puppet:///modules/site-nagios/configs/nrpe/nrpe_commands.cfg", + source => [ "puppet:///modules/site-nagios/configs/nrpe/nrpe_commands.${fqdn}.cfg", + "puppet:///modules/site-nagios/configs/nrpe/nrpe_commands.cfg", "puppet:///modules/nagios/nrpe/nrpe_commands.cfg" ], } + # the check for load should be customized for each server based on number + # of CPUs and the type of activity. + $warning_1_threshold = 5 * $processorcount + $warning_5_threshold = 4 * $processorcount + $warning_15_threshold = 3 * $processorcount + $critical_1_threshold = 10 * $processorcount + $critical_5_threshold = 9 * $processorcount + $critical_15_threshold = 8 * $processorcount + nagios::nrpe::command { "check_load": + command_line => "/usr/lib/nagios/plugins/check_load -w ${warning_1_threshold},${warning_5_threshold},${warning_15_threshold} -c ${critical_1_threshold},${critical_5_threshold},${critical_15_threshold}", + } service { "nagios-nrpe-server": ensure => running, -- cgit v1.2.3 From ba5ef8e555e16f9fb6a5e6bb8f8d5bf3c12c1827 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Thu, 26 May 2011 15:58:26 -0400 Subject: nrpe: bump up multipliers for check_load The CPU checks were fireing way too often. Bump up the multipliers to reduce the number of alerts. --- manifests/nrpe/base.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'manifests/nrpe/base.pp') diff --git a/manifests/nrpe/base.pp b/manifests/nrpe/base.pp index 1d26849..c14692e 100644 --- a/manifests/nrpe/base.pp +++ b/manifests/nrpe/base.pp @@ -29,9 +29,9 @@ class nagios::nrpe::base { } # the check for load should be customized for each server based on number # of CPUs and the type of activity. - $warning_1_threshold = 5 * $processorcount - $warning_5_threshold = 4 * $processorcount - $warning_15_threshold = 3 * $processorcount + $warning_1_threshold = 7 * $processorcount + $warning_5_threshold = 6 * $processorcount + $warning_15_threshold = 5 * $processorcount $critical_1_threshold = 10 * $processorcount $critical_5_threshold = 9 * $processorcount $critical_15_threshold = 8 * $processorcount -- cgit v1.2.3 From c2391b7a83d8be4343622458b852bf90bd3919b6 Mon Sep 17 00:00:00 2001 From: Antoine Beaupre Date: Thu, 28 Jul 2011 13:23:52 -0400 Subject: default processorcount to 1 if it is not present --- manifests/nrpe/base.pp | 1 + 1 file changed, 1 insertion(+) (limited to 'manifests/nrpe/base.pp') diff --git a/manifests/nrpe/base.pp b/manifests/nrpe/base.pp index c14692e..f0c76b1 100644 --- a/manifests/nrpe/base.pp +++ b/manifests/nrpe/base.pp @@ -1,6 +1,7 @@ class nagios::nrpe::base { if $nagios_nrpe_cfgdir == '' { $nagios_nrpe_cfgdir = '/etc/nagios' } + if $processorcount == '' { $processorcount = 1 } package { "nagios-nrpe-server": ensure => present; "nagios-plugins-basic": ensure => present; -- cgit v1.2.3 From e335357ad435c3bd9648d1763a229fd3a6077a8f Mon Sep 17 00:00:00 2001 From: Antoine Beaupre Date: Thu, 28 Jul 2011 13:33:58 -0400 Subject: make the nrpe service depend on the package --- manifests/nrpe/base.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'manifests/nrpe/base.pp') diff --git a/manifests/nrpe/base.pp b/manifests/nrpe/base.pp index f0c76b1..f1809d7 100644 --- a/manifests/nrpe/base.pp +++ b/manifests/nrpe/base.pp @@ -44,6 +44,7 @@ class nagios::nrpe::base { ensure => running, enable => true, pattern => "nrpe", - subscribe => File["$nagios_nrpe_cfgdir/nrpe.cfg"] + subscribe => File["$nagios_nrpe_cfgdir/nrpe.cfg"], + require => Package["nagios-nrpe-server"], } } -- cgit v1.2.3 From 8f24f259caa75f78ed501377c95c0a6fab0ebb11 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Mon, 7 Nov 2011 12:07:28 -0500 Subject: Fix NRPE for FreeBSD Plugins are found under another directory. The pid file must be changed to /var/spool/nagios/nrpe2.pid, since this place is writable by the daemon, and the rc script expects the pid file to be found there. Use a pattern instead of the rc script status command. --- manifests/nrpe/base.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/nrpe/base.pp') diff --git a/manifests/nrpe/base.pp b/manifests/nrpe/base.pp index f1809d7..17abb04 100644 --- a/manifests/nrpe/base.pp +++ b/manifests/nrpe/base.pp @@ -37,7 +37,7 @@ class nagios::nrpe::base { $critical_5_threshold = 9 * $processorcount $critical_15_threshold = 8 * $processorcount nagios::nrpe::command { "check_load": - command_line => "/usr/lib/nagios/plugins/check_load -w ${warning_1_threshold},${warning_5_threshold},${warning_15_threshold} -c ${critical_1_threshold},${critical_5_threshold},${critical_15_threshold}", + command_line => "${nagios_plugin_dir}/check_load -w ${warning_1_threshold},${warning_5_threshold},${warning_15_threshold} -c ${critical_1_threshold},${critical_5_threshold},${critical_15_threshold}", } service { "nagios-nrpe-server": -- cgit v1.2.3