diff --git a/clarified/manifests/init.pp b/clarified/manifests/init.pp index f8136c0..f241c48 100644 --- a/clarified/manifests/init.pp +++ b/clarified/manifests/init.pp @@ -15,8 +15,8 @@ class clarified::analyzer { file { "/usr/local/src/clarified-analyzer-linux-i686.sh": ensure => present, mode => "0755", - owner => root, - group => root, + owner => "root", + group => "root", source => "puppet:///files/packages/${clarified_analyzer_package}", before => Exec["/usr/local/src/clarified-analyzer-linux-i686.sh"], } @@ -50,8 +50,8 @@ class clarified::recorder { file { $recorder_datadir: ensure => directory, mode => "0700", - owner => root, - group => root, + owner => "root", + group => "root", } file { "/var/lib/recorder": @@ -63,8 +63,8 @@ class clarified::recorder { file { "/var/lib/recorder": ensure => directory, mode => "0700", - owner => root, - group => root, + owner => "root", + group => "root", } } @@ -73,8 +73,8 @@ class clarified::recorder { "/etc/clarified/remote.d", ]: ensure => directory, mode => "0644", - owner => root, - group => root, + owner => "root", + group => "root", before => Exec["/usr/local/src/clarified-recorder-linux.sh"], } @@ -88,8 +88,8 @@ class clarified::recorder { file { "/usr/local/src/clarified-recorder-linux.sh": ensure => present, mode => "0755", - owner => root, - group => root, + owner => "root", + group => "root", source => "puppet:///files/packages/${clarified_recorder_package}", before => Exec["/usr/local/src/clarified-recorder-linux.sh"], } @@ -117,18 +117,24 @@ class clarified::recorder { file { "/etc/init.d/clarified-probe": ensure => present, mode => "0755", - owner => root, - group => root, + owner => "root", + group => "root", source => "/usr/local/probe/probe-init.sh", require => Exec["/usr/local/src/clarified-recorder-linux.sh"], - before => Service["clarified-probe"], + notify => Exec["add-service-clarified-probe"], + } + exec { "add-service-clarified-probe": + path => "/bin:/usr/bin:/sbin:/usr/sbin", + command => $::operatingsystem ? { + "debian" => "update-rc.d clarified-probe defaults", + "ubuntu" => "update-rc.d clarified-probe defaults", + default => "chkconfig --add clarified-probe", + }, + refreshonly => true, + before => Service["clarified-probe"], } - service { "clarified-probe": - ensure => running, - enable => true, - hasrestart => true, - status => "pgrep -f /usr/local/probe", + enable => true, } } @@ -179,17 +185,39 @@ define clarified::probe($interface="", $snaplen="65535", $keeptime="100GB", $interface_real = $name } + file { "/var/lib/recorder/${name}": + ensure => directory, + mode => "0700", + owner => "root", + group => "root", + } + file { "/etc/clarified/probe.d/${name}": ensure => $probe ? { true => present, false => absent, }, mode => "0755", - owner => root, - group => root, + owner => "root", + group => "root", content => template("clarified/probe.erb"), - require => File["/etc/clarified/probe.d"], - notify => Service["clarified-probe"], + require => File["/var/lib/recorder/${name}"], + notify => $probe ? { + true => Service["probe-${name}"], + false => undef, + }, + } + + service { "probe-${name}": + ensure => $probe ? { + true => running, + false => stopped, + }, + provider => "base", + start => "/etc/clarified/probe.d/${name} start", + restart => "/etc/clarified/probe.d/${name} restart", + stop => "pkill -f /var/run/probe/${name}.pid", + status => "pgrep -f /var/run/probe/${name}.pid", } file { "/etc/clarified/remote.d/${name}": @@ -198,20 +226,26 @@ define clarified::probe($interface="", $snaplen="65535", $keeptime="100GB", false => absent, }, mode => "0755", - owner => root, - group => root, + owner => "root", + group => "root", content => template("clarified/remote.erb"), - require => File["/etc/clarified/remote.d"], - notify => Service["clarified-probe"], + require => File["/var/lib/recorder/${name}"], + notify => $remote ? { + true => Service["remote-${name}"], + false => undef, + }, } - file { "/var/lib/recorder/${name}": - ensure => directory, - mode => "0700", - owner => root, - group => root, - require => File["/var/lib/recorder"], - before => Service["clarified-probe"], + service { "remote-${name}": + ensure => $remote ? { + true => running, + false => stopped, + }, + provider => "base", + start => "/etc/clarified/remote.d/${name} start", + restart => "/etc/clarified/remote.d/${name} restart", + stop => "pkill -f /var/run/remote/${name}.pid", + status => "pgrep -f /var/run/remote/${name}.pid", } } diff --git a/nagios/manifests/init.pp b/nagios/manifests/init.pp index df354bb..818eb26 100644 --- a/nagios/manifests/init.pp +++ b/nagios/manifests/init.pp @@ -190,8 +190,8 @@ class nagios::server::manual inherits nagios::common { require => File["/etc/nagios/conf.d"], } nagios_contactgroup { "all": - target => "${confdir}/contactgroup_all.cfg", - notify => Service["nagios"], + target => "${confdir}/contactgroup_all.cfg", + notify => Service["nagios"], } file { "${confdir}/host_default.cfg": @@ -522,8 +522,8 @@ define nagios::host($address=undef, $group="NONE", $osname="NONE", require => File["/etc/nagios/conf.d"], } nagios_contactgroup { $group: - target => "${confdir}/contactgroup_${group}.cfg", - notify => Service["nagios"], + target => "${confdir}/contactgroup_${group}.cfg", + notify => Service["nagios"], } } if !defined(Nagios_hostgroup[$group]) { @@ -536,8 +536,8 @@ define nagios::host($address=undef, $group="NONE", $osname="NONE", require => File["/etc/nagios/conf.d"], } nagios_hostgroup { $group: - target => "${confdir}/hostgroup_${group}.cfg", - notify => Service["nagios"], + target => "${confdir}/hostgroup_${group}.cfg", + notify => Service["nagios"], } } Nagios_host[$name] { @@ -584,8 +584,23 @@ define nagios::service($host, $command, $description, $group="NONE", } if $group != "NONE" { + if !defined(Nagios_servicegroup[$group]) { + file { "${confdir}/servicegroup_${group}.cfg": + ensure => present, + mode => "0640", + owner => "root", + group => "nagios", + before => Nagios_servicegroup[$group], + require => File["/etc/nagios/conf.d"], + } + nagios_servicegroup { $group: + target => "${confdir}/servicegroup_${group}.cfg", + notify => Service["nagios"], + } + } Nagios_service[$name] { contact_groups => "all,${group}", + servicegroups => $group, } }