From 988a88f4e62065b45c8e32f6f915e052ff394003 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 20 Oct 2010 20:56:15 +0200 Subject: move define to own class --- manifests/nagios.pp | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 manifests/nagios.pp (limited to 'manifests/nagios.pp') diff --git a/manifests/nagios.pp b/manifests/nagios.pp new file mode 100644 index 0000000..5a5a5ed --- /dev/null +++ b/manifests/nagios.pp @@ -0,0 +1,3 @@ +define sshd::nagios { + nagios::service{ "ssh_port_${name}": check_command => "check_ssh_port!$name" } +} -- cgit v1.2.3 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/nagios.pp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'manifests/nagios.pp') 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 From eec9e7242525cd9909c0c54cdb7515047bac4407 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 20 Oct 2010 22:57:15 +0200 Subject: extend sshd::nagios with ensure param --- manifests/nagios.pp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'manifests/nagios.pp') diff --git a/manifests/nagios.pp b/manifests/nagios.pp index 890810e..1500a09 100644 --- a/manifests/nagios.pp +++ b/manifests/nagios.pp @@ -1,8 +1,19 @@ define sshd::nagios( + $ensure = 'present', $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}" } } + 'absent': { + nagios::service{"ssh_port_${name}": + ensure => $esnure, + check_command => "check_ssh_port!$name" + } + } + default: { + nagios::service{"ssh_port_host_${name}_${check_hostname}": + ensure => $esnure, + check_command => "check_ssh_port_host!${name}!${check_hostname}" + } + } } } -- cgit v1.2.3 From 28342ba418ede266526aaaad5c89834883b4b16e Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 20 Oct 2010 23:12:43 +0200 Subject: introduce that port also can't be the name, fix ensure problem --- manifests/nagios.pp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'manifests/nagios.pp') diff --git a/manifests/nagios.pp b/manifests/nagios.pp index 1500a09..4971f65 100644 --- a/manifests/nagios.pp +++ b/manifests/nagios.pp @@ -1,18 +1,23 @@ define sshd::nagios( + $port = 'absent', $ensure = 'present', $check_hostname = 'absent' ) { + $real_port = $port ? { + 'absent' => $name, + default => $port, + } case $check_hostname { 'absent': { nagios::service{"ssh_port_${name}": - ensure => $esnure, - check_command => "check_ssh_port!$name" + ensure => $ensure, + check_command => "check_ssh_port!$port" } } default: { - nagios::service{"ssh_port_host_${name}_${check_hostname}": - ensure => $esnure, - check_command => "check_ssh_port_host!${name}!${check_hostname}" + nagios::service{"ssh_port_host_${name}": + ensure => $ensure, + check_command => "check_ssh_port_host!${port}!${check_hostname}" } } } -- cgit v1.2.3 From 3200c182e1e272d49b1b3347c544a94e655e1142 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 21 Oct 2010 02:49:11 +0200 Subject: use realport --- manifests/nagios.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'manifests/nagios.pp') diff --git a/manifests/nagios.pp b/manifests/nagios.pp index 4971f65..7742cdb 100644 --- a/manifests/nagios.pp +++ b/manifests/nagios.pp @@ -11,13 +11,13 @@ define sshd::nagios( 'absent': { nagios::service{"ssh_port_${name}": ensure => $ensure, - check_command => "check_ssh_port!$port" + check_command => "check_ssh_port!$real_port" } } default: { nagios::service{"ssh_port_host_${name}": ensure => $ensure, - check_command => "check_ssh_port_host!${port}!${check_hostname}" + check_command => "check_ssh_port_host!${real_port}!${check_hostname}" } } } -- cgit v1.2.3