summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2012-06-14 10:36:25 -0300
committermh <mh@immerda.ch>2012-06-14 10:36:25 -0300
commit41fe95b36253826b8f801ee1669acdb28c70076c (patch)
tree275d0bb973a35c3fd48fe51dd67333764fe99325
parent106515b61b731489cce2d8b74bea13b26d4a65f6 (diff)
take hiera out of the params
-rw-r--r--manifests/apache.pp11
-rw-r--r--manifests/base.pp5
-rw-r--r--manifests/init.pp39
-rw-r--r--manifests/irc_bot.pp146
-rw-r--r--manifests/lighttpd.pp14
-rw-r--r--manifests/service/ping.pp2
-rw-r--r--manifests/target.pp2
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,