nagios: Manifest cleanup

* Updated host and service defaults based on current documentation.
 * Removed hostextinfo configs as they are deprecated, use host
   attributes instead.
 * Fixed nagios resource references
This commit is contained in:
Ossi Salmi 2013-07-17 13:54:57 +03:00
parent 64db9faec5
commit 124c055992

View file

@ -186,7 +186,7 @@ class nagios::server::manual inherits nagios::common {
mode => "0640",
owner => "root",
group => "nagios",
before => Nagios_Contactgroup["all"],
before => Nagios_contactgroup["all"],
require => File["/etc/nagios/conf.d"],
}
nagios_contactgroup { "all":
@ -199,23 +199,26 @@ class nagios::server::manual inherits nagios::common {
mode => "0640",
owner => "root",
group => "nagios",
before => Nagios_Host["default"],
before => Nagios_host["default"],
require => File["/etc/nagios/conf.d"],
}
nagios_host { "default":
target => "${confdir}/host_default.cfg",
register => "0",
active_checks_enabled => "1",
passive_checks_enabled => "1",
notifications_enabled => "1",
event_handler_enabled => "1",
flap_detection_enabled => "1",
failure_prediction_enabled => "1",
process_perf_data => "1",
retain_status_information => "1",
retain_nonstatus_information => "1",
check_command => "check-host-alive",
max_check_attempts => "5",
notification_interval => "0",
check_period => "24x7",
check_interval => "5",
retry_interval => "1",
max_check_attempts => "3",
notification_period => "24x7",
notification_interval => "0",
notification_options => "d,u,r,f,s",
contact_groups => "all",
notify => Service["nagios"],
@ -226,7 +229,7 @@ class nagios::server::manual inherits nagios::common {
mode => "0640",
owner => "root",
group => "nagios",
before => Nagios_Service["default"],
before => Nagios_service["default"],
require => File["/etc/nagios/conf.d"],
}
nagios_service { "default":
@ -234,23 +237,17 @@ class nagios::server::manual inherits nagios::common {
register => "0",
active_checks_enabled => "1",
passive_checks_enabled => "1",
parallelize_check => "1",
obsess_over_service => "1",
check_freshness => "1",
notifications_enabled => "1",
event_handler_enabled => "1",
flap_detection_enabled => "1",
failure_prediction_enabled => "1",
process_perf_data => "1",
retain_status_information => "1",
retain_nonstatus_information => "1",
notification_interval => "0",
is_volatile => "0",
check_period => "24x7",
normal_check_interval => "5",
check_interval => "5",
retry_check_interval => "1",
max_check_attempts => "2",
max_check_attempts => "3",
notification_period => "24x7",
notification_interval => "0",
notification_options => "w,u,c,r,f,s",
contact_groups => "all",
notify => Service["nagios"],
@ -261,7 +258,7 @@ class nagios::server::manual inherits nagios::common {
mode => "0640",
owner => "root",
group => "nagios",
before => Nagios_Timeperiod["24x7"],
before => Nagios_timeperiod["24x7"],
require => File["/etc/nagios/conf.d"],
}
nagios_timeperiod { "24x7":
@ -313,7 +310,7 @@ define nagios::contact::email($group=["all"],
mode => "0640",
owner => "root",
group => "nagios",
before => Nagios_Contact[$name],
before => Nagios_contact[$name],
require => File["/etc/nagios/conf.d"],
}
nagios_contact { $name:
@ -351,7 +348,7 @@ define nagios::contact::prowl($group=["all"],
mode => "0640",
owner => "root",
group => "nagios",
before => Nagios_Contact["prowl-${name}"],
before => Nagios_contact["prowl-${name}"],
require => File["/etc/nagios/conf.d"],
}
nagios_contact { "prowl-${name}":
@ -391,7 +388,7 @@ define nagios::contact::pushover($token, $group=["all"],
mode => "0640",
owner => "root",
group => "nagios",
before => Nagios_Contact["pushover-${name}"],
before => Nagios_contact["pushover-${name}"],
require => File["/etc/nagios/conf.d"],
}
nagios_contact { "pushover-${name}":
@ -434,7 +431,7 @@ define nagios::contact::sms($number, $group=["all"],
mode => "0640",
owner => "root",
group => "nagios",
before => Nagios_Contact["sms-${name}"],
before => Nagios_contact["sms-${name}"],
require => File["/etc/nagios/conf.d"],
}
nagios_contact { "sms-${name}":
@ -464,9 +461,9 @@ define nagios::contact::sms($number, $group=["all"],
# $group:
# Hostgroup name.
# $osname:
# Operating system name for hostextinfo.
# Operating system name.
# $osicon:
# Operating system icon name for hostextinfo.
# Operating system icon name.
# $parent:
# Parent hostname.
#
@ -479,7 +476,7 @@ define nagios::host($address=undef, $group="NONE", $osname="NONE",
mode => "0640",
owner => "root",
group => "nagios",
before => Nagios_Host[$name],
before => Nagios_host[$name],
require => File["/etc/nagios/conf.d"],
}
nagios_host { $name:
@ -503,32 +500,21 @@ define nagios::host($address=undef, $group="NONE", $osname="NONE",
$iconpath = ""
}
}
file { "${confdir}/hostextinfo_${name}.cfg":
ensure => present,
mode => "0640",
owner => "root",
group => "nagios",
before => Nagios_Hostextinfo[$name],
require => File["/etc/nagios/conf.d"],
}
nagios_hostextinfo { $name:
ensure => present,
Nagios_host[$name] {
icon_image_alt => $osname,
icon_image => "${iconpath}${osicon}.png",
statusmap_image => "${iconpath}${osicon}.gd2",
target => "${confdir}/hostextinfo_${name}.cfg",
notify => Service["nagios"],
}
}
if $group != "NONE" {
if !defined(Nagios_Contactgroup[$group]) {
if !defined(Nagios_contactgroup[$group]) {
file { "${confdir}/contactgroup_${group}.cfg":
ensure => present,
mode => "0640",
owner => "root",
group => "nagios",
before => Nagios_Contactgroup[$group],
before => Nagios_contactgroup[$group],
require => File["/etc/nagios/conf.d"],
}
nagios_contactgroup { $group:
@ -536,13 +522,13 @@ define nagios::host($address=undef, $group="NONE", $osname="NONE",
notify => Service["nagios"],
}
}
if !defined(Nagios_Hostgroup[$group]) {
if !defined(Nagios_hostgroup[$group]) {
file { "${confdir}/hostgroup_${group}.cfg":
ensure => present,
mode => "0640",
owner => "root",
group => "nagios",
before => Nagios_Hostgroup[$group],
before => Nagios_hostgroup[$group],
require => File["/etc/nagios/conf.d"],
}
nagios_hostgroup { $group:
@ -550,7 +536,7 @@ define nagios::host($address=undef, $group="NONE", $osname="NONE",
notify => Service["nagios"],
}
}
Nagios_Host[$name] {
Nagios_host[$name] {
contact_groups => "all,${group}",
hostgroups => $group,
}
@ -580,7 +566,7 @@ define nagios::service($host, $command, $description, $group="NONE",
mode => "0640",
owner => "root",
group => "nagios",
before => Nagios_Service[$name],
before => Nagios_service[$name],
require => File["/etc/nagios/conf.d"],
}
nagios_service { $name:
@ -589,12 +575,12 @@ define nagios::service($host, $command, $description, $group="NONE",
service_description => $description,
use => "default",
target => "${confdir}/service_${name}.cfg",
require => Nagios_Host[$host],
require => Nagios_host[$host],
notify => Service["nagios"],
}
if $group != "NONE" {
Nagios_Service[$name] {
Nagios_service[$name] {
contact_groups => "all,${group}",
}
}