OLD | NEW |
1 class nagios::server( | 1 class nagios::server( |
2 $domain, | 2 $domain, |
3 $certificate, | 3 $certificate, |
4 $private_key, | 4 $private_key, |
5 $is_default=false, | 5 $is_default=false, |
6 $htpasswd_source, | 6 $htpasswd_source, |
7 $admins | 7 $admins, |
| 8 $zone, |
8 ) { | 9 ) { |
9 | 10 |
10 File { | 11 File { |
11 owner => 'root', | 12 owner => 'root', |
12 group => 'root', | 13 group => 'root', |
13 mode => 0644 | 14 mode => 0644 |
14 } | 15 } |
15 | 16 |
16 include nginx, 'spawn-fcgi' | 17 include nginx, 'spawn-fcgi' |
17 | 18 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 } | 115 } |
115 | 116 |
116 Nagios_command <| |> { | 117 Nagios_command <| |> { |
117 target => '/etc/nagios3/conf.d/commands.cfg', | 118 target => '/etc/nagios3/conf.d/commands.cfg', |
118 require => Package['nagios3'], | 119 require => Package['nagios3'], |
119 notify => [File['/etc/nagios3/conf.d/commands.cfg'], Service['nagios3']] | 120 notify => [File['/etc/nagios3/conf.d/commands.cfg'], Service['nagios3']] |
120 } | 121 } |
121 | 122 |
122 Nagios_host <| |> { | 123 Nagios_host <| |> { |
123 target => '/etc/nagios3/conf.d/hosts.cfg', | 124 target => '/etc/nagios3/conf.d/hosts.cfg', |
124 require => Package['nagios3'], | |
125 notify => [File['/etc/nagios3/conf.d/hosts.cfg'], Service['nagios3']] | 125 notify => [File['/etc/nagios3/conf.d/hosts.cfg'], Service['nagios3']] |
126 } | 126 } |
127 | 127 <- |
128 Nagios_hostgroup <| |> { | 128 Nagios_hostgroup <| |> { |
129 target => '/etc/nagios3/conf.d/hostgroups.cfg', | 129 target => '/etc/nagios3/conf.d/hostgroups.cfg', |
130 require => Package['nagios3'], | 130 require => Package['nagios3'], |
131 notify => [File['/etc/nagios3/conf.d/hostgroups.cfg'], Service['nagios3']] | 131 notify => [File['/etc/nagios3/conf.d/hostgroups.cfg'], Service['nagios3']] |
132 } | 132 } |
133 | 133 |
134 Nagios_service <| |> { | 134 Nagios_service <| |> { |
135 target => '/etc/nagios3/conf.d/services.cfg', | 135 target => '/etc/nagios3/conf.d/services.cfg', |
136 require => Package['nagios3'], | 136 require => Package['nagios3'], |
137 notify => [File['/etc/nagios3/conf.d/services.cfg'], Service['nagios3']] | 137 notify => [File['/etc/nagios3/conf.d/services.cfg'], Service['nagios3']] |
138 } | 138 } |
139 | 139 |
140 file {['/etc/nagios3/conf.d/contacts.cfg', | 140 file {['/etc/nagios3/conf.d/contacts.cfg', |
141 '/etc/nagios3/conf.d/contactgroups.cfg', | 141 '/etc/nagios3/conf.d/contactgroups.cfg', |
142 '/etc/nagios3/conf.d/commands.cfg', | 142 '/etc/nagios3/conf.d/commands.cfg', |
143 '/etc/nagios3/conf.d/hosts.cfg', | 143 '/etc/nagios3/conf.d/hosts.cfg', |
144 '/etc/nagios3/conf.d/hostgroups.cfg', | 144 '/etc/nagios3/conf.d/hostgroups.cfg', |
145 '/etc/nagios3/conf.d/services.cfg']: | 145 '/etc/nagios3/conf.d/services.cfg']: |
146 require => Package['nagios3'], | 146 require => Package['nagios3'], |
147 notify => Service['nagios3'] | 147 notify => Service['nagios3'] |
148 } | 148 } |
| 149 |
| 150 $nagios_contacts = hiera('nagios_contacts', {}) |
| 151 create_resources(nagios_contact, $nagios_contacts) |
| 152 |
| 153 $nagios_contactgroups = hiera('nagios_contactgroups', {}) |
| 154 create_resources(nagios_contactgroup, $nagios_contactgroups) |
| 155 |
| 156 $nagios_commands = hiera('nagios_commands', {}) |
| 157 create_resources(nagios_command, $nagios_commands) |
| 158 |
| 159 $nagios_services = hiera('nagios_services', {}) |
| 160 create_resources(nagios_service, $nagios_services) |
| 161 |
| 162 $nagios_hosts = hiera('nagios_hosts', {}) |
| 163 create_resources(nagios_host, $nagios_hosts) |
| 164 |
| 165 $nagios_hostgroups = hiera('nagios_hostgroups', {}) |
| 166 create_resources(nagios_hostgroup, $nagios_hostgroups) |
| 167 |
| 168 $nagios_generic = hiera('servers') |
| 169 create_resources(nagios::server::generic_host, $nagios_generic) |
| 170 |
| 171 define generic_host( |
| 172 $ip, |
| 173 $ssh_public_key = undef, |
| 174 $role = undef, |
| 175 $dns = undef, |
| 176 $groups = [], |
| 177 ) { |
| 178 |
| 179 $fqdn_name = join([$name, $nagios::server::zone], ".") |
| 180 |
| 181 nagios_host {$fqdn_name: |
| 182 use => 'generic-host', |
| 183 hostgroups => $groups, |
| 184 } |
| 185 } |
149 } | 186 } |
OLD | NEW |