From 23e3ddf1daa52d46c40d540d25218195997e8524 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 6 Apr 2011 10:44:58 +0200 Subject: try to fix nagios::plugin problem We have a serious problem with the concept that we had up to now if you start adding more than one nagios server. This is an attempt to fix it, with certain drawbacks, such as that you have to list all the nagios plugins in the nagios modules. This will be subject of further discussion. --- files/plugins/check_jabber_login | 30 ++++++++++++++++++++++++++++++ manifests/base.pp | 3 --- manifests/defaults/plugins.pp | 6 ++++-- manifests/plugin.pp | 2 +- manifests/plugin/deploy.pp | 6 +++--- 5 files changed, 38 insertions(+), 9 deletions(-) create mode 100644 files/plugins/check_jabber_login diff --git a/files/plugins/check_jabber_login b/files/plugins/check_jabber_login new file mode 100644 index 0000000..dac0e1f --- /dev/null +++ b/files/plugins/check_jabber_login @@ -0,0 +1,30 @@ +#!/usr/bin/env ruby +require 'rubygems' +require 'xmpp4r' + + +def usage + puts "#{$0} jabberid password" + exit 3 +end + +usage unless ARGV.size == 2 + +begin + my_client = Jabber::Client.new(ARGV[0]) + my_client.connect + my_client.auth(ARGV[1]) +rescue Jabber::ClientAuthenticationFailure => detail + puts "CRITICAL: Login Error" + exit 2 +rescue Errno::ECONNREFUSED => detail + puts "CRITICAL: Connection refused" + exit 2 +rescue SocketError => detail + puts "CRITICAL: Socket Error" + exit 2 +#rescue +# puts "CRITICAL: Unknown Error" +# exit 2 +end +puts "OK: Login for #{ARGV[0]} successfull" diff --git a/manifests/base.pp b/manifests/base.pp index 8b96308..0068cd5 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -71,8 +71,6 @@ class nagios::base { notify => Service['nagios'], mode => '0750', owner => root, group => nagios; } - Package <<| tag == 'nagios::plugin::deploy::package' |>> - File <<| tag == 'nagios::plugin::deploy::file' |>> Nagios_command <<||>> Nagios_contactgroup <<||>> Nagios_contact <<||>> @@ -87,7 +85,6 @@ class nagios::base { Nagios_serviceextinfo <<||>> Nagios_service <<||>> Nagios_timeperiod <<||>> - File <<| tag == 'nagios_plugin' |>> Nagios_command <||> { target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_command.cfg", diff --git a/manifests/defaults/plugins.pp b/manifests/defaults/plugins.pp index 18f8161..b713354 100644 --- a/manifests/defaults/plugins.pp +++ b/manifests/defaults/plugins.pp @@ -1,5 +1,4 @@ class nagios::defaults::plugins { - nagios::plugin { 'check_mysql_health': source => 'nagios/plugins/check_mysql_health'; @@ -7,6 +6,9 @@ class nagios::defaults::plugins { source => 'nagios/plugins/check_dns2'; 'check_dnsbl': source => 'nagios/plugins/check_dnsbl'; + 'check_jabber_login': + source => 'nagios/plugins/check_jabber_login'; } - + # for check_jabber_login + require rubygems::xmpp4r } diff --git a/manifests/plugin.pp b/manifests/plugin.pp index abaa6e5..c2e7676 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -2,7 +2,7 @@ define nagios::plugin( $source = 'absent', $ensure = present ){ - @@file{$name: + file{$name: path => $hardwaremodel ? { 'x86_64' => "/usr/lib64/nagios/plugins/$name", default => "/usr/lib/nagios/plugins/$name", diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 75f87d7..96fea41 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -10,14 +10,14 @@ define nagios::plugin::deploy($source = '', $ensure = 'present', $config = '', $ } if !defined(Package[$require_package]) { - @@package { $require_package: + package { $require_package: ensure => installed, tag => "nagios::plugin::deploy::package"; } } include nagios::plugin::scriptpaths - @@file { "nagios_plugin_${name}": + file { "nagios_plugin_${name}": path => "$nagios::plugin::scriptpaths::script_path/${name}", source => "puppet://$server/modules/$real_source", mode => 0755, owner => root, group => 0, @@ -26,5 +26,5 @@ define nagios::plugin::deploy($source = '', $ensure = 'present', $config = '', $ } # register the plugin - @@nagios::plugin{$name: ensure => $ensure, require => Package['nagios-plugins'] } + nagios::plugin{$name: ensure => $ensure, require => Package['nagios-plugins'] } } -- cgit v1.2.3 From 10390a88051ea4e3ad0ded1cbf0cb93df553fe78 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 15 Jul 2011 17:36:42 +0200 Subject: it is not anymore necessary to add an empty source to purge directories --- manifests/base.pp | 3 --- 1 file changed, 3 deletions(-) diff --git a/manifests/base.pp b/manifests/base.pp index 0068cd5..7f9312f 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -46,7 +46,6 @@ class nagios::base { file { 'nagios_private': path => "${nagios::defaults::vars::int_nagios_cfgdir}/private/", - source => "puppet:///modules/common/empty", ensure => directory, purge => true, recurse => true, @@ -64,7 +63,6 @@ class nagios::base { file { 'nagios_confd': path => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/", - source => "puppet:///modules/common/empty", ensure => directory, purge => true, recurse => true, @@ -179,7 +177,6 @@ class nagios::base { # must be defined after exported resource overrides and cfg file defs file { 'nagios_cfgdir': path => "${nagios::defaults::vars::int_nagios_cfgdir}/", - source => "puppet:///modules/common/empty", ensure => directory, recurse => true, purge => true, -- cgit v1.2.3 From 363bdd5c7519aea45be143f4a19c10dc41a9b03f Mon Sep 17 00:00:00 2001 From: "Christian G. Warden" Date: Wed, 1 Feb 2012 16:56:49 -0800 Subject: Fully qualify facter variables to suppress warnings --- manifests/apache.pp | 2 +- manifests/base.pp | 12 ++++++------ manifests/defaults/commands.pp | 4 ++-- manifests/defaults/templates.pp | 4 ++-- manifests/defaults/vars.pp | 2 +- manifests/init.pp | 4 ++-- manifests/irc_bot.pp | 8 ++++---- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/manifests/apache.pp b/manifests/apache.pp index c560e5b..6acf538 100644 --- a/manifests/apache.pp +++ b/manifests/apache.pp @@ -2,7 +2,7 @@ class nagios::apache inherits ::apache { $nagios_httpd = 'apache' include nagios - case $operatingsystem { + case $::operatingsystem { 'debian': { file { "${nagios::defaults::vars::int_nagios_cfgdir}/apache2.conf": ensure => present, diff --git a/manifests/base.pp b/manifests/base.pp index 8b96308..315298d 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -18,9 +18,9 @@ class nagios::base { file { 'nagios_main_cfg': path => "${nagios::defaults::vars::int_nagios_cfgdir}/nagios.cfg", source => [ "puppet:///modules/site-nagios/configs/${fqdn}/nagios.cfg", - "puppet:///modules/site-nagios/configs/${operatingsystem}/nagios.cfg", + "puppet:///modules/site-nagios/configs/${::operatingsystem}/nagios.cfg", "puppet:///modules/site-nagios/configs/nagios.cfg", - "puppet:///modules/nagios/configs/${operatingsystem}/nagios.cfg", + "puppet:///modules/nagios/configs/${::operatingsystem}/nagios.cfg", "puppet:///modules/nagios/configs/nagios.cfg" ], notify => Service['nagios'], mode => 0644, owner => root, group => root; @@ -29,9 +29,9 @@ class nagios::base { file { 'nagios_cgi_cfg': path => "${nagios::defaults::vars::int_nagios_cfgdir}/cgi.cfg", source => [ "puppet:///modules/site-nagios/configs/${fqdn}/cgi.cfg", - "puppet:///modules/site-nagios/configs/${operatingsystem}/cgi.cfg", + "puppet:///modules/site-nagios/configs/${::operatingsystem}/cgi.cfg", "puppet:///modules/site-nagios/configs/cgi.cfg", - "puppet:///modules/nagios/configs/${operatingsystem}/cgi.cfg", + "puppet:///modules/nagios/configs/${::operatingsystem}/cgi.cfg", "puppet:///modules/nagios/configs/cgi.cfg" ], mode => '0644', owner => 'root', group => 0, notify => Service['apache'], @@ -56,8 +56,8 @@ class nagios::base { file { 'nagios_private_resource_cfg': path => "${nagios::defaults::vars::int_nagios_cfgdir}/private/resource.cfg", - source => [ "puppet:///modules/site-nagios/configs/${operatingsystem}/private/resource.cfg.${architecture}", - "puppet:///modules/nagios/configs/${operatingsystem}/private/resource.cfg.${architecture}" ], + source => [ "puppet:///modules/site-nagios/configs/${::operatingsystem}/private/resource.cfg.${::architecture}", + "puppet:///modules/nagios/configs/${::operatingsystem}/private/resource.cfg.${::architecture}" ], notify => Service['nagios'], owner => root, group => nagios, mode => '0640'; } diff --git a/manifests/defaults/commands.pp b/manifests/defaults/commands.pp index 17d1408..3b0da37 100644 --- a/manifests/defaults/commands.pp +++ b/manifests/defaults/commands.pp @@ -4,7 +4,7 @@ class nagios::defaults::commands { include nagios::command::imap_pop3 # common service commands - case $operatingsystem { + case $::operatingsystem { debian,ubuntu: { nagios_command { check_dummy: @@ -122,7 +122,7 @@ class nagios::defaults::commands { # notification commands - $mail_cmd_location = $operatingsystem ? { + $mail_cmd_location = $::operatingsystem ? { centos => '/bin/mail', default => '/usr/bin/mail' } diff --git a/manifests/defaults/templates.pp b/manifests/defaults/templates.pp index c97eee4..aec97c0 100644 --- a/manifests/defaults/templates.pp +++ b/manifests/defaults/templates.pp @@ -4,9 +4,9 @@ class nagios::defaults::templates { file { 'nagios_templates': path => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_templates.cfg", source => [ "puppet:///modules/site-nagios/configs/${fqdn}/nagios_templates.cfg", - "puppet:///modules/site-nagios/configs/${operatingsystem}/nagios_templates.cfg", + "puppet:///modules/site-nagios/configs/${::operatingsystem}/nagios_templates.cfg", "puppet:///modules/site-nagios/configs/nagios_templates.cfg", - "puppet:///modules/nagios/configs/${operatingsystem}/nagios_templates.cfg", + "puppet:///modules/nagios/configs/${::operatingsystem}/nagios_templates.cfg", "puppet:///modules/nagios/configs/nagios_templates.cfg" ], notify => Service['nagios'], mode => 0644, owner => root, group => root; diff --git a/manifests/defaults/vars.pp b/manifests/defaults/vars.pp index 6302f13..b0aef57 100644 --- a/manifests/defaults/vars.pp +++ b/manifests/defaults/vars.pp @@ -1,6 +1,6 @@ class nagios::defaults::vars { case $nagios_cfgdir { - '': { $int_nagios_cfgdir = $operatingsystem ? { + '': { $int_nagios_cfgdir = $::operatingsystem ? { centos => '/etc/nagios/', default => '/etc/nagios3' } diff --git a/manifests/init.pp b/manifests/init.pp index 1aecc3a..5050b69 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -21,7 +21,7 @@ class nagios { 'apache': { include apache } default: { include apache } } - case $operatingsystem { + case $::operatingsystem { 'centos': { $nagios_cfgdir = '/etc/nagios' include nagios::centos @@ -30,6 +30,6 @@ class nagios { $nagios_cfgdir = '/etc/nagios3' include nagios::debian } - default: { fail("No such operatingsystem: $operatingsystem yet defined") } + default: { fail("No such operatingsystem: ${::operatingsystem} yet defined") } } } diff --git a/manifests/irc_bot.pp b/manifests/irc_bot.pp index 961755a..fc47884 100644 --- a/manifests/irc_bot.pp +++ b/manifests/irc_bot.pp @@ -4,14 +4,14 @@ class nagios::irc_bot { } $nagios_nsa_socket = $nagios_nsa_socket ? { - '' => $operatingsystem ? { + '' => $::operatingsystem ? { centos => '/var/run/nagios-nsa/nsa.socket', default => '/var/run/nagios3/nsa.socket' }, default => $nagios_nsa_socket, } $nagios_nsa_pidfile = $nagios_nsa_pidfile ? { - '' => $operatingsystem ? { + '' => $::operatingsystem ? { centos => '/var/run/nagios-nsa/nsa.pid', default => '/var/run/nagios3/nsa.pid' }, @@ -40,7 +40,7 @@ class nagios::irc_bot { } file { "/etc/init.d/nagios-nsa": owner => root, group => root, mode => 0755, - content => template("nagios/irc_bot/${operatingsystem}/nagios-nsa.sh.erb"), + content => template("nagios/irc_bot/${::operatingsystem}/nagios-nsa.sh.erb"), require => File["/usr/local/bin/riseup-nagios-server.pl"], } file { "/etc/nagios_nsa.cfg": @@ -61,7 +61,7 @@ class nagios::irc_bot { Service['nagios'] ], } - case $operatingsystem { + case $::operatingsystem { centos: { Package['libnet-irc-perl']{ name => 'perl-Net-IRC', -- cgit v1.2.3 From 9e22cc72124c9eb1612f62653ea92538bac06855 Mon Sep 17 00:00:00 2001 From: "Christian G. Warden" Date: Wed, 1 Feb 2012 18:00:04 -0800 Subject: fully qualify fqdn and hostname facter variables --- manifests/service.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/service.pp b/manifests/service.pp index afc8650..a739317 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -1,6 +1,6 @@ define nagios::service ( $ensure = present, - $host_name = $fqdn, + $host_name = $::fqdn, $check_command, $check_period = '', $normal_check_interval = '', @@ -16,7 +16,7 @@ define nagios::service ( # TODO: this resource should normally accept all nagios_host parameters - $real_name = "${hostname}_${name}" + $real_name = "${::hostname}_${name}" @@nagios_service { "${real_name}": ensure => $ensure, -- cgit v1.2.3 From 60ebd42e903db7f5c1f8bb2f1d447e4d952a7265 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 10 Feb 2012 14:42:16 +0100 Subject: use trocla for that password --- manifests/service/mysql.pp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/service/mysql.pp b/manifests/service/mysql.pp index d501f06..95f0970 100644 --- a/manifests/service/mysql.pp +++ b/manifests/service/mysql.pp @@ -1,11 +1,11 @@ -# Checks a mysql instance via tcp or socket +# Checks a mysql instance via tcp or socket define nagios::service::mysql( $ensure = present, $check_host = 'absent', $check_port = '3306', $check_username = 'nagios', - $check_password = $nagios_mysql_password, + $check_password = trocla("mysql_nagios_${::fqdn}",'plain','length: 32'), $check_database = 'information_schema', $check_warning = undef, $check_critical = undef, @@ -20,7 +20,7 @@ define nagios::service::mysql( if ($check_host == 'absent') { fail("Please specify a hostname, ip address or socket to check a mysql instance.") } - + case $check_mode { 'tcp': { if ($check_host == 'localhost') { @@ -39,7 +39,7 @@ define nagios::service::mysql( } } } - + nagios::service { "mysql_health_${name}": ensure => $ensure, check_command => "check_mysql_health!${check_host}!${check_port}!${check_username}!${check_password}!${name}!${check_database}", -- cgit v1.2.3 From b0a5c09d81d0eb5151c32c6d8d14753c8529ede5 Mon Sep 17 00:00:00 2001 From: Erik Froese Date: Wed, 25 Apr 2012 09:57:39 -0400 Subject: Add the port arg to check_http_url_regex. Default 80. --- manifests/defaults/commands.pp | 2 +- manifests/service/http.pp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/manifests/defaults/commands.pp b/manifests/defaults/commands.pp index 3b0da37..195c8e3 100644 --- a/manifests/defaults/commands.pp +++ b/manifests/defaults/commands.pp @@ -64,7 +64,7 @@ class nagios::defaults::commands { check_http_url: command_line => '$USER1$/check_http -H $ARG1$ -u $ARG2$'; check_http_url_regex: - command_line => '$USER1$/check_http -H $ARG1$ -u $ARG2$ -e $ARG3$'; + command_line => '$USER1$/check_http -H $ARG1$ -p $ARG2$ -u $ARG3$ -e $ARG4$'; check_https_url: command_line => '$USER1$/check_http --ssl -H $ARG1$ -u $ARG2$'; check_https_url_regex: diff --git a/manifests/service/http.pp b/manifests/service/http.pp index 8fd5059..ef63abb 100644 --- a/manifests/service/http.pp +++ b/manifests/service/http.pp @@ -6,6 +6,7 @@ define nagios::service::http( $ensure = present, $check_domain = 'absent', + $port = '80', $check_url = '/', $check_code = 'OK', $use = 'generic-service', @@ -27,7 +28,7 @@ define nagios::service::http( nagios::service{"httprd_${name}": ensure => $ensure, use => $use, - check_command => "check_http_url_regex!${real_check_domain}!${check_url}!'301'", + check_command => "check_http_url_regex!${real_check_domain}!${port}!${check_url}!'301'", } } } @@ -38,7 +39,7 @@ define nagios::service::http( nagios::service{"http_${name}_${check_code}": ensure => $ensure, use => $use, - check_command => "check_http_url_regex!${real_check_domain}!${check_url}!'${check_code}'", + check_command => "check_http_url_regex!${real_check_domain}!${port}!${check_url}!'${check_code}'", } } } -- cgit v1.2.3 From cd05fee87d406a77eaf0f4441062e3478c27601d Mon Sep 17 00:00:00 2001 From: Erik Froese Date: Tue, 24 Apr 2012 11:52:22 -0400 Subject: Remove unnecessary jabber dependency. --- manifests/defaults/plugins.pp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/manifests/defaults/plugins.pp b/manifests/defaults/plugins.pp index b713354..abd8b52 100644 --- a/manifests/defaults/plugins.pp +++ b/manifests/defaults/plugins.pp @@ -6,9 +6,5 @@ class nagios::defaults::plugins { source => 'nagios/plugins/check_dns2'; 'check_dnsbl': source => 'nagios/plugins/check_dnsbl'; - 'check_jabber_login': - source => 'nagios/plugins/check_jabber_login'; } - # for check_jabber_login - require rubygems::xmpp4r } -- cgit v1.2.3 From 057af9e85d958b1f75a4999570693f1fd428993a Mon Sep 17 00:00:00 2001 From: Erik Froese Date: Tue, 1 May 2012 11:15:07 -0400 Subject: Move the jabber plugin to its own class. --- manifests/plugin/jabber.pp | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 manifests/plugin/jabber.pp diff --git a/manifests/plugin/jabber.pp b/manifests/plugin/jabber.pp new file mode 100644 index 0000000..380a5c0 --- /dev/null +++ b/manifests/plugin/jabber.pp @@ -0,0 +1,10 @@ +class nagios::plugins::jabber { + + # for check_jabber_login + require rubygems::xmpp4r + + nagios::plugin { 'check_jabber_login': + source => 'nagios/plugins/check_jabber_login' + } +} + -- cgit v1.2.3 From 3db1ca8f85b28978a3a9c09de3551f536b1375a6 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 15 May 2012 21:30:17 +0200 Subject: put the class the right place --- manifests/plugin/jabber.pp | 10 ---------- manifests/plugins/jabber.pp | 10 ++++++++++ 2 files changed, 10 insertions(+), 10 deletions(-) delete mode 100644 manifests/plugin/jabber.pp create mode 100644 manifests/plugins/jabber.pp diff --git a/manifests/plugin/jabber.pp b/manifests/plugin/jabber.pp deleted file mode 100644 index 380a5c0..0000000 --- a/manifests/plugin/jabber.pp +++ /dev/null @@ -1,10 +0,0 @@ -class nagios::plugins::jabber { - - # for check_jabber_login - require rubygems::xmpp4r - - nagios::plugin { 'check_jabber_login': - source => 'nagios/plugins/check_jabber_login' - } -} - diff --git a/manifests/plugins/jabber.pp b/manifests/plugins/jabber.pp new file mode 100644 index 0000000..380a5c0 --- /dev/null +++ b/manifests/plugins/jabber.pp @@ -0,0 +1,10 @@ +class nagios::plugins::jabber { + + # for check_jabber_login + require rubygems::xmpp4r + + nagios::plugin { 'check_jabber_login': + source => 'nagios/plugins/check_jabber_login' + } +} + -- cgit v1.2.3 From 0fe7552f256f0b1508cc5d3cab952eb93bee6811 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 5 Jun 2012 19:34:51 -0300 Subject: new style for 2.7 --- README | 67 +++++++++++---------- manifests/apache.pp | 15 ++--- manifests/base.pp | 94 +++++++++++++++--------------- manifests/centos.pp | 2 +- manifests/debian.pp | 4 +- manifests/defaults/templates.pp | 22 +++---- manifests/defaults/vars.pp | 6 +- manifests/init.pp | 17 +++--- manifests/irc_bot.pp | 45 ++++++-------- manifests/nsca/client.pp | 6 +- manifests/nsca/server.pp | 10 ++-- manifests/plugin/deploy.pp | 6 +- manifests/plugin/scriptpaths.pp | 2 +- manifests/service/ntp.pp | 8 +-- manifests/service/ping.pp | 16 ++--- manifests/target.pp | 14 +++-- manifests/target/fqdn.pp | 4 +- templates/irc_bot/CentOS/nagios-nsa.sh.erb | 4 +- templates/irc_bot/Debian/nagios-nsa.sh.erb | 4 +- templates/irc_bot/nsa.cfg.erb | 16 ++--- 20 files changed, 179 insertions(+), 183 deletions(-) diff --git a/README b/README index 4ca4c3e..f2368ac 100644 --- a/README +++ b/README @@ -31,11 +31,11 @@ Hosts ----- On a node which shall be monitored with nagios, include the "nagios::target". -This just creates a host declaration for this host's "$ipaddress" fact. If -the $ipaddress of your target is not the one you wish to modify, you can use -"nagios::target::fqdn" instead, which will use the $fqdn fact of the host instead. +This just creates a host declaration for this host's "$::ipaddress" fact. If +the $::ipaddress of your target is not the one you wish to modify, you can use +"nagios::target::fqdn" instead, which will use the $::fqdn fact of the host instead. -Set the $nagios_parents variable in the node scope for enabling the reachability +Pass the $parents variable to the target class for enabling the reachability features of nagios. If a node needs more customisation, use the native "@@nagios_host" type directly (the double-ampersand declares the object as an exported resource). @@ -72,14 +72,14 @@ Upgrade Notes The nagios::target bits have been reworked, the notable changes that may affect an upgrade are: -. previous versions had nagios::target::nat which used the $fqdn for +. previous versions had nagios::target::nat which used the $::fqdn for the address part of nagios::target, this has been renamed to nagios::target::fqdn to be more clear. if you were using nagios::target::nat then you will need to change those references to ::fqdn -. previous versions of this module used $fqdn for the nagios::target -address, now it is using $ipaddress. If you need $fqdn, use +. previous versions of this module used $::fqdn for the nagios::target +address, now it is using $::ipaddress. If you need $::fqdn, use nagios::target::fqdn instead of nagios::target . previous versions of nagios_host used the parameter named 'ip', that @@ -132,36 +132,38 @@ See : http://projects.reductivelabs.com/issues/1180 Variables ========= -Options to change the behavior of the nagios module: +Options to change the behavior of the nagios class: -- nagios_allow_external_cmd: Set to true, if you'd like to ensure that your http - daemon can write to the external command file. You - may also need to flip "check_external_commands" in - "nagios.cfg" to enable this functionality. +- allow_external_cmd: Set to true, if you'd like to ensure that your http + daemon can write to the external command file. You + may also need to flip "check_external_commands" in + "nagios.cfg" to enable this functionality. -- nagios_nsa_socket: This optional variable can be used to specify the path to - the socket file that the IRC daemon should use. +For the irc_bot class: -- nagios_nsa_server: When using the IRC bot, this defines the server address of - the IRC network on which the bot will connect. +- nsa_socket: This optional variable can be used to specify the path to + the socket file that the IRC daemon should use. -- nagios_nsa_port: Defines the port number on the IRC server on which the bot - should connect. When this variable is not set, the port used - by default is 6667. +- nsa_server: When using the IRC bot, this defines the server address of + the IRC network on which the bot will connect. -- nagios_nsa_nickname: This is the nickname that the IRC bot will take. +- nsa_port: Defines the port number on the IRC server on which the bot + should connect. When this variable is not set, the port used + by default is 6667. -- nagios_nsa_password: Some networks require a password to connect to them. - This defines such a password. +- nsa_nickname: This is the nickname that the IRC bot will take. -- nagios_nsa_channel: The name of the channel that the IRC bot will join and - will post notifications to. +- nsa_password: Some networks require a password to connect to them. + This defines such a password. -- nagios_nsa_pidfile: This optional variable can be used to define the path to - the file that will contain the process ID of the IRC bot - daemon. -- nagios_nsa_realname: The IRC bot user's real name that will be displayed. By - default, the real name is 'Nagios'. +- nsa_channel: The name of the channel that the IRC bot will join and + will post notifications to. + +- nsa_pidfile: This optional variable can be used to define the path to + the file that will contain the process ID of the IRC bot + daemon. +- nsa_realname: The IRC bot user's real name that will be displayed. By + default, the real name is 'Nagios'. Examples ======== @@ -197,9 +199,10 @@ $HOSTADDRESS$' node target { - # Monitor th () is host - $nagios_parents = 'router01' - include nagios::target + # Monitor this host + class{'nagios::target': + parents = 'router01' + } # monitor a service $apache2_port = 8080 diff --git a/manifests/apache.pp b/manifests/apache.pp index 6acf538..0696723 100644 --- a/manifests/apache.pp +++ b/manifests/apache.pp @@ -1,20 +1,21 @@ class nagios::apache inherits ::apache { - $nagios_httpd = 'apache' - include nagios + class{'nagios': + httpd => 'apache' + } case $::operatingsystem { 'debian': { - file { "${nagios::defaults::vars::int_nagios_cfgdir}/apache2.conf": + file { "${nagios::defaults::vars::int_cfgdir}/apache2.conf": ensure => present, - source => ["puppet:///site-nagios/configs/${fqdn}/apache2.conf", - "puppet:///site-nagios/configs/apache2.conf", + source => ["puppet:///site_nagios/configs/${::fqdn}/apache2.conf", + "puppet:///site_nagios/configs/apache2.conf", "puppet:///nagios/configs/apache2.conf"], } apache::config::global { "nagios3.conf": ensure => link, - target => "${nagios::defaults::vars::int_nagios_cfgdir}/apache2.conf", - require => File["${nagios::defaults::vars::int_nagios_cfgdir}/apache2.conf"], + target => "${nagios::defaults::vars::int_cfgdir}/apache2.conf", + require => File["${nagios::defaults::vars::int_cfgdir}/apache2.conf"], } } } diff --git a/manifests/base.pp b/manifests/base.pp index 5a7cb7d..e706bb9 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -4,7 +4,7 @@ class nagios::base { package { 'nagios': alias => 'nagios', - ensure => present, + ensure => present, } service { 'nagios': @@ -16,21 +16,21 @@ class nagios::base { # this file should contain all the nagios_puppet-paths: file { 'nagios_main_cfg': - path => "${nagios::defaults::vars::int_nagios_cfgdir}/nagios.cfg", - source => [ "puppet:///modules/site-nagios/configs/${fqdn}/nagios.cfg", - "puppet:///modules/site-nagios/configs/${::operatingsystem}/nagios.cfg", - "puppet:///modules/site-nagios/configs/nagios.cfg", + path => "${nagios::defaults::vars::int_cfgdir}/nagios.cfg", + source => [ "puppet:///modules/site_nagios/configs/${::fqdn}/nagios.cfg", + "puppet:///modules/site_nagios/configs/${::operatingsystem}/nagios.cfg", + "puppet:///modules/site_nagios/configs/nagios.cfg", "puppet:///modules/nagios/configs/${::operatingsystem}/nagios.cfg", "puppet:///modules/nagios/configs/nagios.cfg" ], notify => Service['nagios'], mode => 0644, owner => root, group => root; - } + } file { 'nagios_cgi_cfg': - path => "${nagios::defaults::vars::int_nagios_cfgdir}/cgi.cfg", - source => [ "puppet:///modules/site-nagios/configs/${fqdn}/cgi.cfg", - "puppet:///modules/site-nagios/configs/${::operatingsystem}/cgi.cfg", - "puppet:///modules/site-nagios/configs/cgi.cfg", + path => "${nagios::defaults::vars::int_cfgdir}/cgi.cfg", + source => [ "puppet:///modules/site_nagios/configs/${::fqdn}/cgi.cfg", + "puppet:///modules/site_nagios/configs/${::operatingsystem}/cgi.cfg", + "puppet:///modules/site_nagios/configs/cgi.cfg", "puppet:///modules/nagios/configs/${::operatingsystem}/cgi.cfg", "puppet:///modules/nagios/configs/cgi.cfg" ], mode => '0644', owner => 'root', group => 0, @@ -38,14 +38,14 @@ class nagios::base { } file { 'nagios_htpasswd': - path => "${nagios::defaults::vars::int_nagios_cfgdir}/htpasswd.users", - source => [ "puppet:///modules/site-nagios/htpasswd.users", + path => "${nagios::defaults::vars::int_cfgdir}/htpasswd.users", + source => [ "puppet:///modules/site_nagios/htpasswd.users", "puppet:///modules/nagios/htpasswd.users" ], mode => 0640, owner => root, group => apache; } file { 'nagios_private': - path => "${nagios::defaults::vars::int_nagios_cfgdir}/private/", + path => "${nagios::defaults::vars::int_cfgdir}/private/", ensure => directory, purge => true, recurse => true, @@ -54,15 +54,15 @@ class nagios::base { } file { 'nagios_private_resource_cfg': - path => "${nagios::defaults::vars::int_nagios_cfgdir}/private/resource.cfg", - source => [ "puppet:///modules/site-nagios/configs/${::operatingsystem}/private/resource.cfg.${::architecture}", + path => "${nagios::defaults::vars::int_cfgdir}/private/resource.cfg", + source => [ "puppet:///modules/site_nagios/configs/${::operatingsystem}/private/resource.cfg.${::architecture}", "puppet:///modules/nagios/configs/${::operatingsystem}/private/resource.cfg.${::architecture}" ], notify => Service['nagios'], owner => root, group => nagios, mode => '0640'; } file { 'nagios_confd': - path => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/", + path => "${nagios::defaults::vars::int_cfgdir}/conf.d/", ensure => directory, purge => true, recurse => true, @@ -85,88 +85,88 @@ class nagios::base { Nagios_timeperiod <<||>> Nagios_command <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_command.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_command.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_contact <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_contact.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_contact.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_contactgroup <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_contactgroup.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_contactgroup.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_host <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_host.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_host.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_hostdependency <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostdependency.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostdependency.cfg", notify => Service['nagios'], } Nagios_hostescalation <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostescalation.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostescalation.cfg", notify => Service['nagios'], } Nagios_hostextinfo <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostextinfo.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostextinfo.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_hostgroup <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostgroup.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostgroup.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_service <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_service.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_service.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_servicegroup <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_servicegroup.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_servicegroup.cfg", notify => Service['nagios'], } Nagios_servicedependency <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_servicedependency.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_servicedependency.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_serviceescalation <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_serviceescalation.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_serviceescalation.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_serviceextinfo <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_serviceextinfo.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_serviceextinfo.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_timeperiod <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_timeperiod.cfg", + target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_timeperiod.cfg", require => File['nagios_confd'], notify => Service['nagios'], } - file{[ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_command.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_contact.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_contactgroup.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_host.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostdependency.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostescalation.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostextinfo.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostgroup.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostgroupescalation.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_service.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_servicedependency.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_serviceescalation.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_serviceextinfo.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_servicegroup.cfg", - "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_timeperiod.cfg" ]: + file{[ "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_command.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_contact.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_contactgroup.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_host.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostdependency.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostescalation.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostextinfo.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostgroup.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostgroupescalation.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_service.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_servicedependency.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_serviceescalation.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_serviceextinfo.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_servicegroup.cfg", + "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_timeperiod.cfg" ]: ensure => file, replace => false, notify => Service['nagios'], @@ -176,7 +176,7 @@ class nagios::base { # manage nagios cfg files # must be defined after exported resource overrides and cfg file defs file { 'nagios_cfgdir': - path => "${nagios::defaults::vars::int_nagios_cfgdir}/", + path => "${nagios::defaults::vars::int_cfgdir}/", ensure => directory, recurse => true, purge => true, @@ -184,7 +184,7 @@ class nagios::base { mode => 0755, owner => root, group => root; } - if $use_munin { + if hiera('use_munin',false) { include nagios::munin } diff --git a/manifests/centos.pp b/manifests/centos.pp index 35379b8..5a2ba23 100644 --- a/manifests/centos.pp +++ b/manifests/centos.pp @@ -9,7 +9,7 @@ class nagios::centos inherits nagios::base { hasstatus => true, } - if ($nagios_allow_external_cmd) { + if $nagios::allow_external_cmd { file { '/var/spool/nagios/cmd': ensure => 'directory', require => Package['nagios'], diff --git a/manifests/debian.pp b/manifests/debian.pp index b9e87ec..bb9bb38 100644 --- a/manifests/debian.pp +++ b/manifests/debian.pp @@ -14,13 +14,13 @@ class nagios::debian inherits nagios::base { File['nagios_htpasswd', 'nagios_cgi_cfg'] { group => 'www-data' } - file { "${nagios::defaults::vars::int_nagios_cfgdir}/stylesheets": + file { "${nagios::defaults::vars::int_cfgdir}/stylesheets": ensure => directory, purge => false, recurse => true, } - if ($nagios_allow_external_cmd) { + if $nagios::allow_external_cmd { exec { 'nagios_external_cmd_perms_overrides': command => 'dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw && dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3', unless => 'dpkg-statoverride --list nagios www-data 2710 /var/lib/nagios3/rw && dpkg-statoverride --list nagios nagios 751 /var/lib/nagios3', diff --git a/manifests/defaults/templates.pp b/manifests/defaults/templates.pp index aec97c0..0e73c97 100644 --- a/manifests/defaults/templates.pp +++ b/manifests/defaults/templates.pp @@ -1,15 +1,15 @@ class nagios::defaults::templates { - include nagios::defaults::vars + include nagios::defaults::vars - file { 'nagios_templates': - path => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_templates.cfg", - source => [ "puppet:///modules/site-nagios/configs/${fqdn}/nagios_templates.cfg", - "puppet:///modules/site-nagios/configs/${::operatingsystem}/nagios_templates.cfg", - "puppet:///modules/site-nagios/configs/nagios_templates.cfg", - "puppet:///modules/nagios/configs/${::operatingsystem}/nagios_templates.cfg", - "puppet:///modules/nagios/configs/nagios_templates.cfg" ], - notify => Service['nagios'], - mode => 0644, owner => root, group => root; - } + file { 'nagios_templates': + path => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_templates.cfg", + source => [ "puppet:///modules/site_nagios/configs/${::fqdn}/nagios_templates.cfg", + "puppet:///modules/site_nagios/configs/${::operatingsystem}/nagios_templates.cfg", + "puppet:///modules/site_nagios/configs/nagios_templates.cfg", + "puppet:///modules/nagios/configs/${::operatingsystem}/nagios_templates.cfg", + "puppet:///modules/nagios/configs/nagios_templates.cfg" ], + notify => Service['nagios'], + mode => 0644, owner => root, group => root; + } } diff --git a/manifests/defaults/vars.pp b/manifests/defaults/vars.pp index b0aef57..87f41f8 100644 --- a/manifests/defaults/vars.pp +++ b/manifests/defaults/vars.pp @@ -1,10 +1,10 @@ class nagios::defaults::vars { - case $nagios_cfgdir { - '': { $int_nagios_cfgdir = $::operatingsystem ? { + case $nagios::cfgdir { + '': { $int_cfgdir = $::operatingsystem ? { centos => '/etc/nagios/', default => '/etc/nagios3' } } - default: { $int_nagios_cfgdir = $nagios_cfgdir } + default: { $int_cfgdir = $nagios::cfgdir } } } diff --git a/manifests/init.pp b/manifests/init.pp index 5050b69..d3a00df 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -8,14 +8,17 @@ # Marcel Härry haerry+puppet(at)puzzle.ch # Simon Josi josi+puppet(at)puzzle.ch # -# This program is free software; you can redistribute -# it and/or modify it under the terms of the GNU -# General Public License version 3 as published by +# This program is free software; you can redistribute +# it and/or modify it under the terms of the GNU +# General Public License version 3 as published by # the Free Software Foundation. # -class nagios { - case $nagios_httpd { +class nagios( + $httpd = hiera('nagios_httpd','apache'), + $allow_external_cmd = hiera('nagios_allow_external_cmd',false), +) { + case $nagios::httpd { 'absent': { } 'lighttpd': { include lighttpd } 'apache': { include apache } @@ -23,11 +26,11 @@ class nagios { } case $::operatingsystem { 'centos': { - $nagios_cfgdir = '/etc/nagios' + $cfgdir = '/etc/nagios' include nagios::centos } 'debian': { - $nagios_cfgdir = '/etc/nagios3' + $cfgdir = '/etc/nagios3' include nagios::debian } default: { fail("No such operatingsystem: ${::operatingsystem} yet defined") } diff --git a/manifests/irc_bot.pp b/manifests/irc_bot.pp index fc47884..5d684f8 100644 --- a/manifests/irc_bot.pp +++ b/manifests/irc_bot.pp @@ -1,33 +1,26 @@ -class nagios::irc_bot { - if ( ! ($nagios_nsa_server and $nagios_nsa_nickname and $nagios_nsa_channel) ) { - fail("Please provide values at least for \$nagios_nsa_server, \$nagios_nsa_nickname and \$nagios_nsa_channel") - } - - $nagios_nsa_socket = $nagios_nsa_socket ? { - '' => $::operatingsystem ? { +class nagios::irc_bot( + $nsa_socket = hiera('nagios_nsa_socket','absent'), + $nsa_server = hiera('nagios_nsa_server'), + $nsa_port = hiera('nagios_nsa_port',6667), + $nsa_nickname = hiera('nagios_nsa_nickname'), + $nsa_password = hiera('nagios_nsa_password',''), + $nsa_channel = hiera('nagios_nsa_channel'), + $nsa_pidfile = hiera('nagios_nsa_pidfile','absent'), + $nsa_realname = hiera('nagios_nsa_realname','Nagios') +) { + $real_nsa_socket = $nsa_socket ? { + 'absent' => $::operatingsystem ? { centos => '/var/run/nagios-nsa/nsa.socket', default => '/var/run/nagios3/nsa.socket' }, - default => $nagios_nsa_socket, + default => $nsa_socket, } - $nagios_nsa_pidfile = $nagios_nsa_pidfile ? { - '' => $::operatingsystem ? { + $real__nsa_pidfile = $nsa_pidfile ? { + 'absent' => $::operatingsystem ? { centos => '/var/run/nagios-nsa/nsa.pid', default => '/var/run/nagios3/nsa.pid' }, - default => $nagios_nsa_pidfile, - } - $nagios_nsa_port = $nagios_nsa_port ? { - '' => '6667', - default => $nagios_nsa_port, - } - $nagios_nsa_realname = $nagios_nsa_realname ? { - '' => 'Nagios', - default => $nagios_nsa_realname, - } - - if (! $nagios_nsa_password) { - $nagios_nsa_password = '' + default => $nsa_pidfile, } file { "/usr/local/bin/riseup-nagios-client.pl": @@ -64,12 +57,12 @@ class nagios::irc_bot { case $::operatingsystem { centos: { Package['libnet-irc-perl']{ - name => 'perl-Net-IRC', + name => 'perl-Net-IRC', } Service['nagios-nsa']{ enable => true, } - } + } debian,ubuntu: { exec { "nagios_nsa_init_script": command => "/usr/sbin/update-rc.d nagios-nsa defaults", @@ -87,7 +80,7 @@ class nagios::irc_bot { command_line => '/usr/local/bin/riseup-nagios-client.pl "$HOSTNAME$ ($HOSTALIAS$) $NOTIFICATIONTYPE$ n.$HOSTATTEMPT$ $HOSTSTATETYPE$ took $HOSTEXECUTIONTIME$s $HOSTOUTPUT$ $HOSTPERFDATA$ $HOSTLATENCY$s"'; } - if $use_shorewall { + if hiera('use_shorewall',false) { include shorewall::rules::out::irc } } diff --git a/manifests/nsca/client.pp b/manifests/nsca/client.pp index 6e2c472..e58721d 100644 --- a/manifests/nsca/client.pp +++ b/manifests/nsca/client.pp @@ -1,10 +1,10 @@ class nagios::nsca::client { package { 'nsca': ensure => installed } - + file { '/etc/send_nsca.cfg': - source => [ "puppet:///modules/site-nagios/nsca/{$fqdn}/send_nsca.cfg", - "puppet:///modules/site-nagios/nsca/send_nsca.cfg", + source => [ "puppet:///modules/site_nagios/nsca/{$::fqdn}/send_nsca.cfg", + "puppet:///modules/site_nagios/nsca/send_nsca.cfg", "puppet:///modules/nagios/nsca/send_nsca.cfg" ], owner => 'nagios', group => 'nogroup', diff --git a/manifests/nsca/server.pp b/manifests/nsca/server.pp index 9239f21..8ba0116 100644 --- a/manifests/nsca/server.pp +++ b/manifests/nsca/server.pp @@ -1,21 +1,21 @@ class nagios::nsca::server { package { 'nsca': ensure => installed } - + service { 'nsca': ensure => running, hasstatus => false, hasrestart => true, } - + file { '/etc/nsca.cfg': - source => [ "puppet:///modules/site-nagios/nsca/{$fqdn}/nsca.cfg", - "puppet:///modules/site-nagios/nsca/nsca.cfg", + source => [ "puppet:///modules/site_nagios/nsca/{$::fqdn}/nsca.cfg", + "puppet:///modules/site_nagios/nsca/nsca.cfg", "puppet:///modules/nagios/nsca/nsca.cfg" ], owner => 'nagios', group => 'nogroup', mode => '400', notify => Service['nsca'], } - + } diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 96fea41..3f2a1a4 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -5,7 +5,7 @@ define nagios::plugin::deploy($source = '', $ensure = 'present', $config = '', $ default => $ensure } $real_source = $source ? { - '' => "nagios/plugins/$plugin_src", + '' => "nagios/plugins/${plugin_src}", default => $source } @@ -15,11 +15,11 @@ define nagios::plugin::deploy($source = '', $ensure = 'present', $config = '', $ tag => "nagios::plugin::deploy::package"; } } - + include nagios::plugin::scriptpaths file { "nagios_plugin_${name}": path => "$nagios::plugin::scriptpaths::script_path/${name}", - source => "puppet://$server/modules/$real_source", + source => "puppet:///modules/${real_source}", mode => 0755, owner => root, group => 0, require => Package[$require_package], tag => "nagios::plugin::deploy::file"; diff --git a/manifests/plugin/scriptpaths.pp b/manifests/plugin/scriptpaths.pp index 6065709..9cd4b5d 100644 --- a/manifests/plugin/scriptpaths.pp +++ b/manifests/plugin/scriptpaths.pp @@ -1,5 +1,5 @@ class nagios::plugin::scriptpaths { - case $hardwaremodel { + case $::hardwaremodel { x86_64: { $script_path = "/usr/lib64/nagios/plugins/" } default: { $script_path = "/usr/lib/nagios/plugins" } } diff --git a/manifests/service/ntp.pp b/manifests/service/ntp.pp index eca255a..b3cde2a 100644 --- a/manifests/service/ntp.pp +++ b/manifests/service/ntp.pp @@ -1,9 +1,9 @@ # manifests/service/ntp.pp class nagios::service::ntp { - nagios::service{ "check_ntp": - check_command => "check_ntp_time", - host_name => $fqdn, - } + nagios::service{ "check_ntp": + check_command => "check_ntp_time", + host_name => $::fqdn, + } } diff --git a/manifests/service/ping.pp b/manifests/service/ping.pp index c705c68..80f2114 100644 --- a/manifests/service/ping.pp +++ b/manifests/service/ping.pp @@ -1,13 +1,9 @@ define nagios::service::ping( - $ensure = present + $ensure = present, + $ping_rate = hiera('nagios_ping_rate','!100.0,20%!500.0,60%') ){ - $real_nagios_ping_rate = $nagios_ping_rate ? { - '' => '!100.0,20%!500.0,60%', - default => $nagios_ping_rate - } - - nagios::service{ "check_ping": - ensure => $ensure, - check_command => "check_ping${real_nagios_ping_rate}", - } + nagios::service{ "check_ping": + ensure => $ensure, + check_command => "check_ping${ping_rate}", + } } diff --git a/manifests/target.pp b/manifests/target.pp index 675ac1a..fc39834 100644 --- a/manifests/target.pp +++ b/manifests/target.pp @@ -1,15 +1,17 @@ # manifests/target.pp -class nagios::target { +class nagios::target( + $parents = 'absent', +) { - @@nagios_host { "${fqdn}": - address => $ipaddress, - alias => $hostname, + @@nagios_host { $::fqdn: + address => $::ipaddress, + alias => $::hostname, use => 'generic-host', } - if ($nagios_parents != '') { - Nagios_host["${fqdn}"] { parents => $nagios_parents } + if ($parents != 'absent') { + Nagios_host["${::fqdn}"] { parents => $parents } } } diff --git a/manifests/target/fqdn.pp b/manifests/target/fqdn.pp index acac5d6..2521533 100644 --- a/manifests/target/fqdn.pp +++ b/manifests/target/fqdn.pp @@ -1,5 +1,3 @@ class nagios::target::fqdn inherits nagios::target { - - Nagios_host["${fqdn}"] { address => "${fqdn}" } - + Nagios_host[$::fqdn] { address => $::fqdn } } diff --git a/templates/irc_bot/CentOS/nagios-nsa.sh.erb b/templates/irc_bot/CentOS/nagios-nsa.sh.erb index 1561afd..0f9f87b 100644 --- a/templates/irc_bot/CentOS/nagios-nsa.sh.erb +++ b/templates/irc_bot/CentOS/nagios-nsa.sh.erb @@ -19,8 +19,8 @@ exec="/usr/local/bin/riseup-nagios-server.pl" prog="nsa" -PIDFILE=<%= nagios_nsa_pidfile %> -SOCKFILE=<%= nagios_nsa_socket %> +PIDFILE=<%= scope.lookupvar('nagios::irc_bot::real_nsa_pidfile') %> +SOCKFILE=<%= scope.lookupvar('nagios::irc_bot::real_nsa_socket') %> [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog diff --git a/templates/irc_bot/Debian/nagios-nsa.sh.erb b/templates/irc_bot/Debian/nagios-nsa.sh.erb index 6e608db..16fa2ea 100644 --- a/templates/irc_bot/Debian/nagios-nsa.sh.erb +++ b/templates/irc_bot/Debian/nagios-nsa.sh.erb @@ -9,8 +9,8 @@ # Short-Description: Nagios Simple IRC Agent ### END INIT INFO -PIDFILE=<%= nagios_nsa_pidfile %> -SOCKFILE=<%= nagios_nsa_socket %> +PIDFILE=<%= scope.lookupvar('nagios::irc_bot::real_nsa_pidfile') %> +SOCKFILE=<%= scope.lookupvar('nagios::irc_bot::real_nsa_socket') %> . /lib/lsb/init-functions diff --git a/templates/irc_bot/nsa.cfg.erb b/templates/irc_bot/nsa.cfg.erb index 7cba62c..7285386 100644 --- a/templates/irc_bot/nsa.cfg.erb +++ b/templates/irc_bot/nsa.cfg.erb @@ -1,13 +1,13 @@ %Nsa = ( - 'socket' => '<%= nagios_nsa_socket %>', - 'server' => '<%= nagios_nsa_server %>', - 'port' => '<%= nagios_nsa_port %>', - 'nickname' => '<%= nagios_nsa_nickname %>', - 'password' => '<%= nagios_nsa_password %>', + 'socket' => '<%= scope.lookupvar('nagios::irc_bot::real_nsa_socket') %>', + 'server' => '<%= scope.lookupvar('nagios::irc_bot::nsa_server') %>', + 'port' => '<%= scope.lookupvar('nagios::irc_bot::nsa_port') %>', + 'nickname' => '<%= scope.lookupvar('nagios::irc_bot::nsa_nickname') %>', + 'password' => '<%= scope.lookupvar('nagios::irc_bot::nsa_password') %>', # this needs libio-socket-ssl-perl # doesn't actually works because Net::IRC is braindead and tries to use IO::Socket::SSL->read/write instead of the builtin print, see http://search.cpan.org/dist/IO-Socket-SSL/SSL.pm #'SSL' => 0, - 'channel' => '<%= nagios_nsa_channel %>', - 'pidfile' => '<%= nagios_nsa_pidfile %>', # set to undef to disable - 'realname' => "<%= nagios_nsa_realname %>", + 'channel' => '<%= scope.lookupvar('nagios::irc_bot::nsa_channel') %>', + 'pidfile' => '<%= scope.lookupvar('nagios::irc_bot::real_nsa_pidfile') %>', # set to undef to disable + 'realname' => "<%= scope.lookupvar('nagios::irc_bot::nsa_realname') %>", ); -- cgit v1.2.3 From 315a1942cacc58aecfe275599e54fa9da8252518 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 6 Jun 2012 10:12:32 -0300 Subject: fix template --- templates/irc_bot/nsa.cfg.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/irc_bot/nsa.cfg.erb b/templates/irc_bot/nsa.cfg.erb index 7285386..cc7d274 100644 --- a/templates/irc_bot/nsa.cfg.erb +++ b/templates/irc_bot/nsa.cfg.erb @@ -1,4 +1,4 @@ -%Nsa = ( +%%Nsa = ( 'socket' => '<%= scope.lookupvar('nagios::irc_bot::real_nsa_socket') %>', 'server' => '<%= scope.lookupvar('nagios::irc_bot::nsa_server') %>', 'port' => '<%= scope.lookupvar('nagios::irc_bot::nsa_port') %>', -- cgit v1.2.3 From 106515b61b731489cce2d8b74bea13b26d4a65f6 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 8 Jun 2012 13:04:33 -0300 Subject: refactor things for >2.7 --- manifests/apache.pp | 34 +++++++++++++++++----------------- manifests/init.pp | 6 +++--- manifests/plugin.pp | 10 +++++----- manifests/target.pp | 25 +++++++++++++++---------- manifests/target/fqdn.pp | 11 +++++++++-- 5 files changed, 49 insertions(+), 37 deletions(-) diff --git a/manifests/apache.pp b/manifests/apache.pp index 0696723..38026f7 100644 --- a/manifests/apache.pp +++ b/manifests/apache.pp @@ -1,22 +1,22 @@ class nagios::apache inherits ::apache { - class{'nagios': - httpd => 'apache' - } + class{'nagios': + httpd => 'apache' + } - case $::operatingsystem { - 'debian': { - file { "${nagios::defaults::vars::int_cfgdir}/apache2.conf": - ensure => present, - source => ["puppet:///site_nagios/configs/${::fqdn}/apache2.conf", - "puppet:///site_nagios/configs/apache2.conf", - "puppet:///nagios/configs/apache2.conf"], - } + case $::operatingsystem { + 'debian': { + file { "${nagios::defaults::vars::int_cfgdir}/apache2.conf": + ensure => present, + source => [ "puppet:///site_nagios/configs/${::fqdn}/apache2.conf", + "puppet:///site_nagios/configs/apache2.conf", + "puppet:///nagios/configs/apache2.conf"], + } - apache::config::global { "nagios3.conf": - ensure => link, - target => "${nagios::defaults::vars::int_cfgdir}/apache2.conf", - require => File["${nagios::defaults::vars::int_cfgdir}/apache2.conf"], - } - } + apache::config::global { "nagios3.conf": + ensure => link, + target => "${nagios::defaults::vars::int_cfgdir}/apache2.conf", + require => File["${nagios::defaults::vars::int_cfgdir}/apache2.conf"], + } } + } } diff --git a/manifests/init.pp b/manifests/init.pp index d3a00df..9952cd9 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -20,9 +20,9 @@ class nagios( ) { case $nagios::httpd { 'absent': { } - 'lighttpd': { include lighttpd } - 'apache': { include apache } - default: { include apache } + 'lighttpd': { include ::lighttpd } + 'apache': { include ::apache } + default: { include ::apache } } case $::operatingsystem { 'centos': { diff --git a/manifests/plugin.pp b/manifests/plugin.pp index c2e7676..d32606b 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -3,14 +3,14 @@ define nagios::plugin( $ensure = present ){ file{$name: - path => $hardwaremodel ? { - 'x86_64' => "/usr/lib64/nagios/plugins/$name", - default => "/usr/lib/nagios/plugins/$name", + path => $::hardwaremodel ? { + 'x86_64' => "/usr/lib64/nagios/plugins/${name}", + default => "/usr/lib/nagios/plugins/${name}", }, ensure => $ensure, source => $source ? { - 'absent' => "puppet:///modules/nagios/plugins/$name", - default => "puppet:///modules/$source" + 'absent' => "puppet:///modules/nagios/plugins/${name}", + default => "puppet:///modules/${source}" }, tag => 'nagios_plugin', require => Package['nagios-plugins'], diff --git a/manifests/target.pp b/manifests/target.pp index fc39834..9a86c09 100644 --- a/manifests/target.pp +++ b/manifests/target.pp @@ -2,16 +2,21 @@ class nagios::target( $parents = 'absent', -) { + $address = $::ipaddress, + $nagios_alias = $::hostname, + $hostgroups = 'absent', +){ + @@nagios_host { $::fqdn: + address => $address, + alias => $nagios_alias, + use => 'generic-host', + } - @@nagios_host { $::fqdn: - address => $::ipaddress, - alias => $::hostname, - use => 'generic-host', - } - - if ($parents != 'absent') { - Nagios_host["${::fqdn}"] { parents => $parents } - } + if ($parents != 'absent') { + Nagios_host["${::fqdn}"] { parents => $parents } + } + if ($hostgroups != 'absent') { + Nagios_host["${::fqdn}"] { hostgroups => $hostgroups } + } } diff --git a/manifests/target/fqdn.pp b/manifests/target/fqdn.pp index 2521533..6bb16c1 100644 --- a/manifests/target/fqdn.pp +++ b/manifests/target/fqdn.pp @@ -1,3 +1,10 @@ -class nagios::target::fqdn inherits nagios::target { - Nagios_host[$::fqdn] { address => $::fqdn } +class nagios::target::fqdn( + $hostgroups = 'absent', + $parents = 'absent' +) { + class{'nagios::target': + address => $::fqdn, + hostgroups => $hostgroups, + parents => $parents + } } -- cgit v1.2.3 From 41fe95b36253826b8f801ee1669acdb28c70076c Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 14 Jun 2012 10:36:25 -0300 Subject: take hiera out of the params --- manifests/apache.pp | 11 +++- manifests/base.pp | 5 -- manifests/init.pp | 39 +++++++------ manifests/irc_bot.pp | 146 +++++++++++++++++++++++----------------------- manifests/lighttpd.pp | 14 ++++- manifests/service/ping.pp | 2 +- manifests/target.pp | 2 +- 7 files changed, 116 insertions(+), 103 deletions(-) diff --git a/manifests/apache.pp b/manifests/apache.pp index 38026f7..a90d0ee 100644 --- a/manifests/apache.pp +++ b/manifests/apache.pp @@ -1,6 +1,13 @@ -class nagios::apache inherits ::apache { +class nagios::apache( + $allow_external_cmd = false, + $manage_shorewall = false, + $manage_munin = false +) { class{'nagios': - httpd => 'apache' + httpd => 'apache', + allow_external_cmd => $allow_external_cmd, + manage_munin => $manage_munin, + manage_shorewall => $manage_shorewall, } case $::operatingsystem { diff --git a/manifests/base.pp b/manifests/base.pp index e706bb9..0f8b777 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -183,9 +183,4 @@ class nagios::base { notify => Service['nagios'], mode => 0755, owner => root, group => root; } - - if hiera('use_munin',false) { - include nagios::munin - } - } diff --git a/manifests/init.pp b/manifests/init.pp index 9952cd9..12d3db2 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -15,24 +15,29 @@ # class nagios( - $httpd = hiera('nagios_httpd','apache'), - $allow_external_cmd = hiera('nagios_allow_external_cmd',false), + $httpd = 'apache', + $allow_external_cmd = false, + $manage_shorewall = false, + $manage_munin = false ) { - case $nagios::httpd { - 'absent': { } - 'lighttpd': { include ::lighttpd } - 'apache': { include ::apache } - default: { include ::apache } + case $nagios::httpd { + 'absent': { } + 'lighttpd': { include ::lighttpd } + 'apache': { include ::apache } + default: { include ::apache } + } + case $::operatingsystem { + 'centos': { + $cfgdir = '/etc/nagios' + include nagios::centos } - case $::operatingsystem { - 'centos': { - $cfgdir = '/etc/nagios' - include nagios::centos - } - 'debian': { - $cfgdir = '/etc/nagios3' - include nagios::debian - } - default: { fail("No such operatingsystem: ${::operatingsystem} yet defined") } + 'debian': { + $cfgdir = '/etc/nagios3' + include nagios::debian } + default: { fail("No such operatingsystem: ${::operatingsystem} yet defined") } + } + if $manage_munin { + include nagios::munin + } } diff --git a/manifests/irc_bot.pp b/manifests/irc_bot.pp index 5d684f8..77c5fa8 100644 --- a/manifests/irc_bot.pp +++ b/manifests/irc_bot.pp @@ -1,86 +1,84 @@ class nagios::irc_bot( - $nsa_socket = hiera('nagios_nsa_socket','absent'), - $nsa_server = hiera('nagios_nsa_server'), - $nsa_port = hiera('nagios_nsa_port',6667), - $nsa_nickname = hiera('nagios_nsa_nickname'), - $nsa_password = hiera('nagios_nsa_password',''), - $nsa_channel = hiera('nagios_nsa_channel'), - $nsa_pidfile = hiera('nagios_nsa_pidfile','absent'), - $nsa_realname = hiera('nagios_nsa_realname','Nagios') + $nsa_socket = 'absent', + $nsa_server, + $nsa_port = 6667, + $nsa_nickname, + $nsa_password = '', + $nsa_channel, + $nsa_pidfile = 'absent', + $nsa_realname = 'Nagios' ) { - $real_nsa_socket = $nsa_socket ? { - 'absent' => $::operatingsystem ? { - centos => '/var/run/nagios-nsa/nsa.socket', - default => '/var/run/nagios3/nsa.socket' - }, - default => $nsa_socket, - } - $real__nsa_pidfile = $nsa_pidfile ? { - 'absent' => $::operatingsystem ? { - centos => '/var/run/nagios-nsa/nsa.pid', - default => '/var/run/nagios3/nsa.pid' - }, - default => $nsa_pidfile, - } + $real_nsa_socket = $nsa_socket ? { + 'absent' => $::operatingsystem ? { + centos => '/var/run/nagios-nsa/nsa.socket', + default => '/var/run/nagios3/nsa.socket' + }, + default => $nsa_socket, + } + $real__nsa_pidfile = $nsa_pidfile ? { + 'absent' => $::operatingsystem ? { + centos => '/var/run/nagios-nsa/nsa.pid', + default => '/var/run/nagios3/nsa.pid' + }, + default => $nsa_pidfile, + } - file { "/usr/local/bin/riseup-nagios-client.pl": - owner => root, group => root, mode => 0755, - source => "puppet:///modules/nagios/irc_bot/riseup-nagios-client.pl", - } - file { "/usr/local/bin/riseup-nagios-server.pl": - owner => root, group => root, mode => 0755, - source => "puppet:///modules/nagios/irc_bot/riseup-nagios-server.pl", - } - file { "/etc/init.d/nagios-nsa": - owner => root, group => root, mode => 0755, - content => template("nagios/irc_bot/${::operatingsystem}/nagios-nsa.sh.erb"), - require => File["/usr/local/bin/riseup-nagios-server.pl"], - } - file { "/etc/nagios_nsa.cfg": - ensure => present, - owner => nagios, group => root, mode => 0400, - content => template('nagios/irc_bot/nsa.cfg.erb'), - } + file { + '/usr/local/bin/riseup-nagios-client.pl': + source => 'puppet:///modules/nagios/irc_bot/riseup-nagios-client.pl', + owner => root, group => root, mode => 0755; + '/usr/local/bin/riseup-nagios-server.pl': + source => 'puppet:///modules/nagios/irc_bot/riseup-nagios-server.pl', + owner => root, group => root, mode => 0755; + '/etc/init.d/nagios-nsa': + content => template("nagios/irc_bot/${::operatingsystem}/nagios-nsa.sh.erb"), + require => File['/usr/local/bin/riseup-nagios-server.pl'], + owner => root, group => root, mode => 0755; + '/etc/nagios_nsa.cfg': + ensure => present, + content => template('nagios/irc_bot/nsa.cfg.erb'), + owner => nagios, group => root, mode => 0400; + } - package { "libnet-irc-perl": - ensure => present, - } + package { 'libnet-irc-perl': + ensure => present, + } - service { "nagios-nsa": - ensure => "running", - hasstatus => true, - require => [File["/etc/nagios_nsa.cfg"], - Package["libnet-irc-perl"], - Service['nagios'] ], - } + service { "nagios-nsa": + ensure => "running", + hasstatus => true, + require => [ File["/etc/nagios_nsa.cfg"], + Package["libnet-irc-perl"], + Service['nagios'] ], + } - case $::operatingsystem { - centos: { - Package['libnet-irc-perl']{ - name => 'perl-Net-IRC', - } - Service['nagios-nsa']{ - enable => true, - } + case $::operatingsystem { + centos: { + Package['libnet-irc-perl']{ + name => 'perl-Net-IRC', } - debian,ubuntu: { - exec { "nagios_nsa_init_script": - command => "/usr/sbin/update-rc.d nagios-nsa defaults", - unless => "/bin/ls /etc/rc3.d/ | /bin/grep nagios-nsa", - require => File["/etc/init.d/nagios-nsa"], - before => Service['nagios-nsa'], - } + Service['nagios-nsa']{ + enable => true, } } - - nagios_command { - "notify-by-irc": - command_line => '/usr/local/bin/riseup-nagios-client.pl "$HOSTNAME$ ($SERVICEDESC$) $NOTIFICATIONTYPE$ n.$SERVICEATTEMPT$ $SERVICESTATETYPE$ $SERVICEEXECUTIONTIME$s $SERVICELATENCY$s $SERVICEOUTPUT$ $SERVICEPERFDATA$"'; - "host-notify-by-irc": - command_line => '/usr/local/bin/riseup-nagios-client.pl "$HOSTNAME$ ($HOSTALIAS$) $NOTIFICATIONTYPE$ n.$HOSTATTEMPT$ $HOSTSTATETYPE$ took $HOSTEXECUTIONTIME$s $HOSTOUTPUT$ $HOSTPERFDATA$ $HOSTLATENCY$s"'; + debian,ubuntu: { + exec { "nagios_nsa_init_script": + command => "/usr/sbin/update-rc.d nagios-nsa defaults", + unless => "/bin/ls /etc/rc3.d/ | /bin/grep nagios-nsa", + require => File["/etc/init.d/nagios-nsa"], + before => Service['nagios-nsa'], + } } + } - if hiera('use_shorewall',false) { - include shorewall::rules::out::irc - } + nagios_command { + 'notify-by-irc': + command_line => '/usr/local/bin/riseup-nagios-client.pl "$HOSTNAME$ ($SERVICEDESC$) $NOTIFICATIONTYPE$ n.$SERVICEATTEMPT$ $SERVICESTATETYPE$ $SERVICEEXECUTIONTIME$s $SERVICELATENCY$s $SERVICEOUTPUT$ $SERVICEPERFDATA$"'; + 'host-notify-by-irc': + command_line => '/usr/local/bin/riseup-nagios-client.pl "$HOSTNAME$ ($HOSTALIAS$) $NOTIFICATIONTYPE$ n.$HOSTATTEMPT$ $HOSTSTATETYPE$ took $HOSTEXECUTIONTIME$s $HOSTOUTPUT$ $HOSTPERFDATA$ $HOSTLATENCY$s"'; + } + + if $nagios::manage_shorewall { + include shorewall::rules::out::irc + } } diff --git a/manifests/lighttpd.pp b/manifests/lighttpd.pp index 27aff43..0f29896 100644 --- a/manifests/lighttpd.pp +++ b/manifests/lighttpd.pp @@ -1,4 +1,12 @@ -class nagios::lighttpd { - $nagios_httpd = 'lighttpd' - include nagios +class nagios::lighttpd( + $allow_external_cmd = false, + $manage_shorewall = false, + $manage_munin = false +) { + class{'nagios': + httpd => 'lighttpd', + allow_external_cmd => $allow_external_cmd, + manage_munin => $manage_munin, + manage_shorewall => $manage_shorewall, + } } diff --git a/manifests/service/ping.pp b/manifests/service/ping.pp index 80f2114..f1c8d87 100644 --- a/manifests/service/ping.pp +++ b/manifests/service/ping.pp @@ -1,6 +1,6 @@ define nagios::service::ping( $ensure = present, - $ping_rate = hiera('nagios_ping_rate','!100.0,20%!500.0,60%') + $ping_rate = '!100.0,20%!500.0,60%' ){ nagios::service{ "check_ping": ensure => $ensure, diff --git a/manifests/target.pp b/manifests/target.pp index 9a86c09..f9b7e13 100644 --- a/manifests/target.pp +++ b/manifests/target.pp @@ -4,7 +4,7 @@ class nagios::target( $parents = 'absent', $address = $::ipaddress, $nagios_alias = $::hostname, - $hostgroups = 'absent', + $hostgroups = 'absent' ){ @@nagios_host { $::fqdn: address => $address, -- cgit v1.2.3