summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2009-02-02 23:55:49 +0000
committermh <mh@immerda.ch>2009-02-02 23:55:49 +0000
commitc28cf8df17ffe761337daa4cc3098032c315398b (patch)
treef30836c4ff19c1615af742cf4c1ead3b18a1792e
parent732d514f65f46f10736f300e54325f8da9fd9125 (diff)
correct naming
-rw-r--r--manifests/defines.pp35
-rw-r--r--manifests/init.pp2
2 files changed, 31 insertions, 6 deletions
diff --git a/manifests/defines.pp b/manifests/defines.pp
index 7dede0e..c473f73 100644
--- a/manifests/defines.pp
+++ b/manifests/defines.pp
@@ -1,6 +1,7 @@
# manifests/defines.pp
define nagios::host(
+ $ensure = present,
$ip = $fqdn,
$nagios_alias = $hostname,
$check_command = 'check-host-alive',
@@ -22,7 +23,7 @@ define nagios::host(
}
@@nagios_host { $name:
- ensure => present,
+ ensure => $ensure,
address => $ip,
alias => $nagios_alias,
check_command => $check_command,
@@ -39,8 +40,15 @@ define nagios::host(
# this will define a host which isn't managed by puppet.
# a ping serivce is automatically added
-define nagios::extra_host($ip, $nagios_alias, $use = 'generic-host', $parents = 'localhost' ) {
+define nagios::extra_host(
+ $ensure = present,
+ $ip,
+ $nagios_alias,
+ $use = 'generic-host',
+ $parents = 'localhost'
+) {
nagios::host{$name:
+ ensure => $ensure,
ip => $ip,
nagios_alias => $nagios_alias,
use => $use,
@@ -48,6 +56,7 @@ define nagios::extra_host($ip, $nagios_alias, $use = 'generic-host', $parents =
}
nagios::service { "check_ping_${name}":
+ ensure => $ensure,
host_name => $name,
check_command => 'check_ping!100.0,20%!500.0,60%',
host_name => $name,
@@ -56,14 +65,19 @@ define nagios::extra_host($ip, $nagios_alias, $use = 'generic-host', $parents =
}
# just a wrapper to make the notify more easy
-define nagios::command( $command_line ){
+define nagios::command(
+ $ensure = present,
+ $command_line
+){
nagios_command{$name:
+ ensure => $ensure,
command_line => $command_line,
notify => Service[nagios],
}
}
define nagios::service(
+ $ensure = present,
$check_command,
$host_name = $fqdn,
$use = 'generic-service',
@@ -86,6 +100,7 @@ define nagios::service(
default => $nagios_contact_groups_in
}
@@nagios_service {$name:
+ ensure => $ensure,
check_command => $check_command,
use => $use,
host_name => $host_name,
@@ -109,13 +124,16 @@ define nagios::service(
}
}
-define nagios::service::ping(){
+define nagios::service::ping(
+ $ensure = present
+){
$real_nagios_ping_rate = $nagios_ping_rate ? {
'' => '!100.0,20%!500.0,60%',
default => $nagios_ping_rate
}
nagios::service{ "check_ping_${hostname}":
+ ensure => $ensure,
check_command => "check_ping${real_nagios_ping_rate}",
}
}
@@ -126,6 +144,7 @@ define nagios::service::ping(){
# - force: http is permanent redirect to https
# - only: check only https
define nagios::service::http(
+ $ensure = present,
$check_domain = 'absent',
$check_url = '/',
$check_code = 'OK',
@@ -138,11 +157,13 @@ define nagios::service::http(
case $ssl_mode {
'force',true,'only': {
nagios::service{"https_${name}_${check_code}_${hostname}":
+ ensure => $ensure,
check_command => "check_https_url_regex!${real_check_domain}!${check_url}!'${check_code}'",
}
case $ssl_mode {
'force': {
nagios::service{"httprd_${name}_${hostname}":
+ ensure => $ensure,
check_command => "check_http_url_regex!${real_check_domain}!${check_url}!'301'",
}
}
@@ -152,18 +173,22 @@ define nagios::service::http(
case $ssl_mode {
false,true: {
nagios::service{"http_${name}_${check_code}_${hostname}":
+ ensure => $ensure,
check_command => "check_http_url_regex!${real_check_domain}!${check_url}!'${check_code}'",
}
}
}
}
-define nagios::plugin(){
+define nagios::plugin(
+ $ensure = present
+){
file{$name:
path => $hardwaremodel ? {
'x86_64' => "/usr/lib64/nagios/plugins/$name",
default => "/usr/lib/nagios/plugins/$name",
},
+ ensure => $ensure,
source => "puppet://$server/nagios/plugins/$name",
require => Package['nagios-plugins'],
owner => root, group => 0, mode => 0755;
diff --git a/manifests/init.pp b/manifests/init.pp
index 38f57ed..27923d0 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -125,7 +125,7 @@ class nagios::base {
command_line => '$USER1$/check_tcp -p 706 -H $ARG1$';
check_jabber:
command_line => '$USER1$/check_jabber -H $ARG1$';
- check_jabber:
+ check_jabber_login:
command_line => '$USER1$/check_jabber_login $ARG1$ $ARG2$',
require => Nagios::Plugin['check_jabber_login'];
}