From edba34ca1f6867c6af9dd90d78c6d5be0d5a7232 Mon Sep 17 00:00:00 2001 From: Timo Makinen Date: Thu, 7 May 2015 22:31:44 +0300 Subject: [PATCH] nagios: Disable swap monitoring if host has no swap. --- nagios/manifests/target.pp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/nagios/manifests/target.pp b/nagios/manifests/target.pp index 0b44cbd..a824dd6 100644 --- a/nagios/manifests/target.pp +++ b/nagios/manifests/target.pp @@ -491,13 +491,15 @@ class nagios::target::nrpe inherits nagios::target { default => "nagios-plugins-load", } } - nagios::target::nrpe::service { "check_swap -w 75% -c 50%": - description => "Swap", - package => $::operatingsystem ? { - "openbsd" => undef, - "debian" => "nagios-plugins-basic", - "ubuntu" => "nagios-plugins-basic", - default => "nagios-plugins-swap", + if regsubst($::swapsize, '^([0-9]+)\..*', '\1') != 0 { + nagios::target::nrpe::service { "check_swap -w 75% -c 50%": + description => "Swap", + package => $::operatingsystem ? { + "openbsd" => undef, + "debian" => "nagios-plugins-basic", + "ubuntu" => "nagios-plugins-basic", + default => "nagios-plugins-swap", + } } }