From d0d3d20e1411511cccdf6fa3ae63164f2868221d Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 20 Oct 2010 21:17:16 +0200 Subject: add nagios_check_ssh_hostname to tweak the hostname which whould be monitored, as this one might actually differ --- manifests/init.pp | 13 ++++++++++--- manifests/nagios.pp | 9 +++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'manifests') diff --git a/manifests/init.pp b/manifests/init.pp index 449f09f..54f822a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -201,8 +201,7 @@ class sshd { } if $sshd_port != '' { $sshd_ports = [ $sshd_port ] - } - elsif ! $sshd_ports { + } elsif ! $sshd_ports { $sshd_ports = [ 22 ] } case $sshd_authorized_keys_file { @@ -235,7 +234,15 @@ class sshd { if $use_nagios { case $nagios_check_ssh { false: { info("We don't do nagioschecks for ssh on ${fqdn}" ) } - default: { sshd::nagios{$sshd_ports:} } + default: { + sshd::nagios{$sshd_ports: + check_hostname => $nagios_check_ssh_hostname ? { + '' => 'absent', + undef => 'absent', + default => $nagios_check_ssh_hostname + } + } + } } } diff --git a/manifests/nagios.pp b/manifests/nagios.pp index 5a5a5ed..890810e 100644 --- a/manifests/nagios.pp +++ b/manifests/nagios.pp @@ -1,3 +1,8 @@ -define sshd::nagios { - nagios::service{ "ssh_port_${name}": check_command => "check_ssh_port!$name" } +define sshd::nagios( + $check_hostname = 'absent' +) { + case $check_hostname { + 'absent': { nagios::service{ "ssh_port_${name}": check_command => "check_ssh_port!$name" } } + default: { nagios::service{"ssh_port_host_${name}_${check_hostname}": check_command => "check_ssh_port_host!${name}!${check_hostname}" } } + } } -- cgit v1.2.3