1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
# basic stuff for nagios
class nagios::base {
# include the variables
include ::nagios::defaults::vars
package { 'nagios':
ensure => present,
}
service { 'nagios':
ensure => running,
enable => $nagios::service_at_boot,
require => Package['nagios'],
}
$cfg_dir = $nagios::defaults::vars::int_cfgdir
# this file should contain all the nagios_puppet-paths:
file{
'nagios_cfgdir':
ensure => directory,
path => $cfg_dir,
alias => nagios_confd,
recurse => true,
purge => true,
force => true,
require => Package['nagios'],
notify => Service['nagios'],
owner => root,
group => root,
mode => '0755';
'nagios_main_cfg':
path => "${cfg_dir}/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'],
owner => root,
group => root,
mode => '0644';
'nagios_cgi_cfg':
path => "${cfg_dir}/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' ],
notify => Service['apache'],
owner => 'root',
group => 0,
mode => '0644';
'nagios_htpasswd':
path => "${cfg_dir}/htpasswd.users",
source => [ 'puppet:///modules/site_nagios/htpasswd.users',
'puppet:///modules/nagios/htpasswd.users' ],
owner => root,
group => apache,
mode => '0640';
'nagios_resource_cfg':
path => "${cfg_dir}/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';
}
if $cfg_dir == '/etc/nagios3' {
file{'/etc/nagios':
ensure => link,
target => $cfg_dir,
before => File['nagios_cfgdir'],
}
}
file{
[ "${cfg_dir}/nagios_command.cfg",
"${cfg_dir}/nagios_contact.cfg",
"${cfg_dir}/nagios_contactgroup.cfg",
"${cfg_dir}/nagios_host.cfg",
"${cfg_dir}/nagios_hostdependency.cfg",
"${cfg_dir}/nagios_hostescalation.cfg",
"${cfg_dir}/nagios_hostextinfo.cfg",
"${cfg_dir}/nagios_hostgroup.cfg",
"${cfg_dir}/nagios_hostgroupescalation.cfg",
"${cfg_dir}/nagios_service.cfg",
"${cfg_dir}/nagios_servicedependency.cfg",
"${cfg_dir}/nagios_serviceescalation.cfg",
"${cfg_dir}/nagios_serviceextinfo.cfg",
"${cfg_dir}/nagios_servicegroup.cfg",
"${cfg_dir}/nagios_timeperiod.cfg" ]:
ensure => file,
replace => false,
notify => Service['nagios'],
require => File['nagios_cfgdir'],
owner => root,
group => 0,
mode => '0644';
}
resources {
[
'nagios_command',
'nagios_contactgroup',
'nagios_contact',
'nagios_hostdependency',
'nagios_hostescalation',
'nagios_hostextinfo',
'nagios_hostgroup',
'nagios_host',
'nagios_servicedependency',
'nagios_serviceescalation',
'nagios_servicegroup',
'nagios_serviceextinfo',
'nagios_service',
'nagios_timeperiod',
]:
notify => Service['nagios'],
purge => $::nagios::purge_resources
}
# make sure nagios resources are defined after nagios is
# installed and the nagios_cfgdir resource is present
File['nagios_cfgdir'] -> Nagios_command <||>
File['nagios_cfgdir'] -> Nagios_contactgroup <||>
File['nagios_cfgdir'] -> Nagios_contact <||>
File['nagios_cfgdir'] -> Nagios_hostdependency <||>
File['nagios_cfgdir'] -> Nagios_hostescalation <||>
File['nagios_cfgdir'] -> Nagios_hostextinfo <||>
File['nagios_cfgdir'] -> Nagios_hostgroup <||>
File['nagios_cfgdir'] -> Nagios_host <||>
File['nagios_cfgdir'] -> Nagios_servicedependency <||>
File['nagios_cfgdir'] -> Nagios_serviceescalation <||>
File['nagios_cfgdir'] -> Nagios_servicegroup <||>
File['nagios_cfgdir'] -> Nagios_serviceextinfo <||>
File['nagios_cfgdir'] -> Nagios_service <||>
File['nagios_cfgdir'] -> Nagios_timeperiod <||>
if ( $nagios::storeconfigs == true ) {
include ::nagios::storeconfigs
}
}
|