diff options
author | mh <mh@immerda.ch> | 2012-06-05 19:34:51 -0300 |
---|---|---|
committer | mh <mh@immerda.ch> | 2012-06-05 19:34:51 -0300 |
commit | 0fe7552f256f0b1508cc5d3cab952eb93bee6811 (patch) | |
tree | 9769eab5ea4b9bf6f49c2c11d9a9b9e1736361c9 /manifests | |
parent | 3db1ca8f85b28978a3a9c09de3551f536b1375a6 (diff) |
new style for 2.7
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/apache.pp | 15 | ||||
-rw-r--r-- | manifests/base.pp | 94 | ||||
-rw-r--r-- | manifests/centos.pp | 2 | ||||
-rw-r--r-- | manifests/debian.pp | 4 | ||||
-rw-r--r-- | manifests/defaults/templates.pp | 22 | ||||
-rw-r--r-- | manifests/defaults/vars.pp | 6 | ||||
-rw-r--r-- | manifests/init.pp | 17 | ||||
-rw-r--r-- | manifests/irc_bot.pp | 45 | ||||
-rw-r--r-- | manifests/nsca/client.pp | 6 | ||||
-rw-r--r-- | manifests/nsca/server.pp | 10 | ||||
-rw-r--r-- | manifests/plugin/deploy.pp | 6 | ||||
-rw-r--r-- | manifests/plugin/scriptpaths.pp | 2 | ||||
-rw-r--r-- | manifests/service/ntp.pp | 8 | ||||
-rw-r--r-- | manifests/service/ping.pp | 16 | ||||
-rw-r--r-- | manifests/target.pp | 14 | ||||
-rw-r--r-- | manifests/target/fqdn.pp | 4 |
16 files changed, 132 insertions, 139 deletions
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 } } |