Documentation by YARD 0.9.9
+Alphabetic Index
+ +Puppet Class Listing A-Z
+ + +
+
+
+
|
+
Defined Type Listing A-Z
+ + +
+
+
+
|
+
File Listing
+-
+
+
+
- README + + +
diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..1a5fbe5 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,561 @@ +
+Changelog of Git Changelog. +
+ ++
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
+
+
+
+
|
+
| t |
+ + + +23 +24 +25+ |
+
+ # File 'manifests/init.pp', line 23
+
+class cd_nagios {
+ include cd_nagios::params
+}
+ |
+
cd_nagios::certbot::certs.pp +Module name: cd_nagios +Author: Arne Teuke +(arne_teuke@ConfDroid.com)
+ +This file is part of cd_nagios.
+ +cd_nagios is used for providing automatic configuration of Nagios + +Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com) + This program is +free software: you can redistribute it and/or modify + it under the terms of +the GNU General Public License as published by + the Free Software +Foundation, either version 3 of the License, or + (at your option) any later +version.
+ +This program is distributed in the hope that it will be useful, + but +WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License +for more details.
+ +You should have received a copy of the GNU General Public License + along +with this program. If not, see www.gnu.org/licenses/.
+ +
+ + + +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+ |
+
+ # File 'manifests/certbot/certs.pp', line 23
+
+class cd_nagios::certbot::certs (
+
+) inherits cd_nagios::params {
+
+ if $::fqdn == $ng_nagios_server {
+ if $ng_use_https == true {
+ if $ng_enable_certbot == true {
+
+ require cd_certbot
+ require cd_apache
+
+ if $ng_include_fw == true {
+ require cd_nagios::firewall::iptables
+ }
+
+ # create cert
+
+ exec { 'create_cert':
+ command => template($ng_get_cert_erb),
+ cwd => '/tmp',
+ path => ['/bin','/usr/bin'],
+ provider => 'shell',
+ unless => template('cd_nagios/certbot/unless_get_cert.erb'),
+ notify => Service['httpd'],
+ creates => $ng_certbot_check,
+ }
+
+ # renew certs
+
+ exec { 'renew_cert':
+ command => 'certbot renew',
+ cwd => '/tmp',
+ path => ['/bin','/usr/bin','/opt/'],
+ provider => 'shell',
+ notify => Service['httpd'],
+ unless => template($ng_unless_renew_erb),
+ }
+ }
+ }
+
+ else {
+ # do nothing as we are not using https and certbot is not required then
+ }
+ }
+}
+ |
+
cd_nagios::certbot::config.pp +Module name: cd_nagios +Author: Arne Teuke +(arne_teuke@ConfDroid.com)
+ +This file is part of cd_nagios.
+ +cd_nagios is used for providing automatic configuration of Nagios + +Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com) + This program is +free software: you can redistribute it and/or modify + it under the terms of +the GNU General Public License as published by + the Free Software +Foundation, either version 3 of the License, or + (at your option) any later +version.
+ +This program is distributed in the hope that it will be useful, + but +WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License +for more details.
+ +You should have received a copy of the GNU General Public License + along +with this program. If not, see www.gnu.org/licenses/.
+ +
+ + + +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+ |
+
+ # File 'manifests/certbot/config.pp', line 23
+
+class cd_nagios::certbot::config (
+
+) inherits cd_nagios::params {
+
+ if $::fqdn == $ng_nagios_server {
+ if $ng_use_https == true {
+ if $ng_enable_certbot == true {
+
+ require cd_certbot
+
+ # ensure there is no forward vhost file
+
+ exec { 'remove_forward_vhost':
+ command => "rm -Rf ${ng_forward_conf}",
+ creates => '/etc/httpd/conf.d/.cert_created',
+ }
+
+ exec { 'remove_nagios_conf':
+ command => "rm -Rf ${ng_nagios_conf}",
+ creates => '/etc/httpd/conf.d/.cert_created',
+ require => Exec['remove_forward_vhost'],
+ }
+
+ exec { 'remove_index_html':
+ command => "rm -Rf ${ng_index_html_file}",
+ creates => '/etc/httpd/conf.d/.cert_created',
+ require => Exec['remove_nagios_conf'],
+ notify => Service[$ae_service],
+ }
+
+ exec { 'disable_selinux_temporarily':
+ command => 'setenforce 0',
+ path => ['/usr/sbin'],
+ creates => '/etc/httpd/conf.d/.cert_created',
+ require => Exec['remove_index_html'],
+ }
+
+ # create cert
+
+ exec { 'create_cert':
+ command => template($ng_get_cert_erb),
+ cwd => '/tmp',
+ path => ['/bin','/usr/bin'],
+ provider => 'shell',
+ unless => template('cd_nagios/certbot/unless_get_cert.erb'),
+ notify => Service['httpd'],
+ creates => '/etc/httpd/conf.d/.cert_created',
+ }
+
+ exec { 'enable_selinux':
+ command => 'setenforce 1',
+ path => ['/usr/sbin'],
+ creates => '/etc/httpd/conf.d/.cert_created',
+ require => Exec['create_cert'],
+ }
+
+ # renew certs
+
+ exec { 'renew_cert':
+ command => 'certbot renew',
+ cwd => '/tmp',
+ path => ['/bin','/usr/bin','/opt/'],
+ provider => 'shell',
+ notify => Service['httpd'],
+ unless => template($ng_unless_renew_erb),
+ }
+ }
+ }
+
+ else {
+ # do nothing as we are not using https and certbot is not required then
+ }
+ }
+}
+ |
+
cd_nagios::client::target.pp +Module name: nagios +Author: Arne Teuke +(arne_teuke@ConfDroid.com) +License: + This file is part of nagios.
+ +nagios is used for providing automatic configuration of Nagios targets. + +Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com) + This program is +free software: you can redistribute it and/or modify + it under the terms of +the GNU General Public License as published by + the Free Software +Foundation, either version 3 of the License, or + (at your option) any later +version.
+ +This program is distributed in the hope that it will be useful, + but +WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License +for more details.
+ +You should have received a copy of the GNU General Public License + along +with this program. If not, see www.gnu.org/licenses/.
+ +
+ + + +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+ |
+
+ # File 'manifests/client/target.pp', line 23
+
+class cd_nagios::client::target (
+
+
+) inherits cd_nagios::params {
+
+ if $::fqdn != $ng_nagios_server {
+
+ @@nagios_host { $::fqdn:
+ ensure => $ng_ping_ensure,
+ alias => $::hostname,
+ address => $::fqdn,
+ use => 'linux-server',
+ target => $ng_target_host,
+ hostgroups => 'linux-servers',
+ contacts => 'ops',
+ max_check_attempts => $max_check_attempts,
+ notification_period => '24x7',
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0664',
+ check_command => "check_ping!${ng_ping_warn}!${ng_ping_crit}",
+ notify => Service['nagios'],
+ }
+
+ @@nagios_service { "root_partition_${::hostname}":
+ ensure => $ng_disk_ensure,
+ check_command => "check_nrpe!check_disk!${ng_disk_warn}!${ng_disk_crit}!/",
+ use => 'generic-service',
+ host_name => $::fqdn,
+ contacts => 'ops',
+ notification_period => '24x7',
+ service_description => "${::hostname}_root_partition",
+ servicegroups => 'linux-services',
+ target => $ng_target_service,
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0664',
+ }
+
+ @@nagios_service { "Swap_Usage_${::hostname}":
+ ensure => $ng_swap_ensure,
+ check_command => "check_nrpe!check_swap!${ng_swap_warn}!${ng_swap_crit}",
+ use => 'generic-service',
+ host_name => $::fqdn,
+ contacts => 'ops',
+ notification_period => '24x7',
+ service_description => "${::hostname}_swap_usage",
+ servicegroups => 'linux-services',
+ target => $ng_target_service,
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0664',
+ }
+
+ @@nagios_service { "Local_Users_${::hostname}":
+ ensure => $ng_users_ensure,
+ check_command => "check_nrpe!check_users!${ng_users_warn}!${ng_users_crit}",
+ use => 'generic-service',
+ host_name => $::fqdn,
+ contacts => 'ops',
+ notification_period => '24x7',
+ service_description => "${::hostname}_local_users",
+ servicegroups => 'linux-services',
+ target => $ng_target_service,
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0664',
+ }
+
+ @@nagios_service { "Total Processes_${::hostname}":
+ ensure => $ng_procs_tot_ens,
+ check_command => "check_nrpe!check_procs!${ng_procs_tot_warn}!${ng_procs_tot_crit}!${ng_procs_tot_param}",
+ use => 'generic-service',
+ host_name => $::fqdn,
+ contacts => 'ops',
+ notification_period => '24x7',
+ service_description => "${::hostname}_total_processes",
+ servicegroups => 'linux-services',
+ target => $ng_target_service,
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0664',
+ }
+
+ @@nagios_service { "Zombie Processes_${::hostname}":
+ ensure => $ng_procs_z_ensure,
+ check_command => "check_nrpe!check_procs!${ng_procs_z_warn}!${ng_procs_z_crit}!${ng_procs_z_param}",
+ use => 'generic-service',
+ host_name => $::fqdn,
+ contacts => 'ops',
+ notification_period => '24x7',
+ service_description => "${::hostname}_zombie_processes",
+ servicegroups => 'linux-services',
+ target => $ng_target_service,
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0664',
+ }
+
+ @@nagios_service { "Current_Load_${::hostname}":
+ ensure => $ng_load_ensure,
+ check_command => "check_nrpe!check_load!${ng_load_warn}!${ng_load_crit}",
+ use => 'generic-service',
+ host_name => $::fqdn,
+ contacts => 'ops',
+ notification_period => '24x7',
+ service_description => "${::hostname}_current_load",
+ servicegroups => 'linux-services',
+ target => $ng_target_service,
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0664',
+ }
+ }
+}
+ |
+
cd_nagios::firewall::iptables.pp +Module name: cd_nagios +Author: Arne Teuke +(arne_teuke@ConfDroid.com) +License: + This file is part of cd_nagios.
+ +cd_nagios is used for providing automatic configuration of + <service / +purpose> + Copyright (C) 2017 ConfDroid (copyright@ConfDroid.com) + This +program is free software: you can redistribute it and/or modify + it under +the terms of the GNU General Public License as published by + the Free +Software Foundation, either version 3 of the License, or + (at your option) +any later version.
+ +This program is distributed in the hope that it will be useful, + but +WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License +for more details.
+ +You should have received a copy of the GNU General Public License + along +with this program. If not, see www.gnu.org/licenses/.
+ +
+ + + +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+ |
+
+ # File 'manifests/firewall/iptables.pp', line 24
+
+class cd_nagios::firewall::iptables (
+
+) inherits cd_nagios::params {
+
+ if $::fqdn == $ng_nagios_server {
+
+ if $ng_use_https != true {
+
+ firewall { "${ng_fw_order}${ng_http_port} port ${ng_http_port}":
+ proto => ['tcp','udp'],
+ dport => $ng_http_port,
+ action => 'accept',
+ }
+ }
+
+ if $ng_use_https == true {
+
+ firewall { "${ng_fw_order}${ng_https_port} port ${ng_https_port}":
+ proto => ['tcp','udp'],
+ dport => $ng_https_port,
+ action => 'accept',
+ }
+
+ if $ng_http_https_fw == true {
+
+ firewall { "${ng_fw_order}${ng_http_port} port ${ng_http_port}":
+ proto => ['tcp','udp'],
+ dport => $ng_http_port,
+ action => 'accept',
+ }
+ }
+ }
+ }
+}
+ |
+
cd_nagios::main::config.pp +Module name: cd_nagios +Author: Arne Teuke +(arne_teuke@ConfDroid.com)
+ +This file is part of cd_nagios.
+ +cd_nagios is used for providing automatic configuration of Nagios + +Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com) + This program is +free software: you can redistribute it and/or modify + it under the terms of +the GNU General Public License as published by + the Free Software +Foundation, either version 3 of the License, or + (at your option) any later +version.
+ +This program is distributed in the hope that it will be useful, + but +WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License +for more details.
+ +You should have received a copy of the GNU General Public License + along +with this program. If not, see www.gnu.org/licenses/.
+ +
+ + + +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+ |
+
+ # File 'manifests/main/config.pp', line 24
+
+class cd_nagios::main::config (
+
+) inherits cd_nagios::params {
+
+ # manage server configuration
+
+ if $::fqdn == $ng_nagios_server {
+ include cd_nagios::server::service
+
+ if $ng_include_fw == true {
+ include cd_nagios::firewall::iptables
+ }
+
+ if $ng_use_selinux_tools == true {
+ include cd_nagios::selinux::config
+ }
+
+ if $ng_enable_certbot == true {
+ require cd_nagios::certbot::certs
+ }
+ }
+
+ if $::fqdn != $ng_nagios_server {
+ include cd_nagios::client::target
+ }
+
+}
+ |
+
cd_nagios::main::dirs.pp +Module name: cd_nagios +Author: Arne Teuke +(arne_teuke@ConfDroid.com)
+ +This file is part of cd_nagios.
+ +cd_nagios is used for providing automatic configuration of Nagios. + +Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com) + This program is +free software: you can redistribute it and/or modify + it under the terms of +the GNU General Public License as published by + the Free Software +Foundation, either version 3 of the License, or + (at your option) any later +version.
+ +This program is distributed in the hope that it will be useful, + but +WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License +for more details.
+ +You should have received a copy of the GNU General Public License + along +with this program. If not, see www.gnu.org/licenses/.
+ +
+ + + +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 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186+ |
+
+ # File 'manifests/main/dirs.pp', line 23
+
+class cd_nagios::main::dirs (
+
+) inherits cd_nagios::params {
+
+ require cd_nagios::main::user
+
+ # main directory
+
+ file { $ng_main_dir:
+ ensure => directory,
+ path => $ng_main_dir,
+ owner => 'root',
+ group => 'root',
+ mode => '0755',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_etc_t,
+ seluser => system_u,
+ }
+
+ # /usr/lib64/nagios dir required for plugins
+
+ file { $ng_lib_dir:
+ ensure => directory,
+ path => $ng_lib_dir,
+ owner => 'root',
+ group => 'root',
+ mode => '0755',
+ selrange => s0,
+ selrole => object_r,
+ seltype => lib_t,
+ seluser => system_u,
+ }
+
+ # /var/spool/nagios
+
+ file { $ng_spool_dir:
+ ensure => directory,
+ path => $ng_spool_dir,
+ owner => $ng_user,
+ group => $ng_user,
+ mode => '0755',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_spool_t,
+ seluser => system_u,
+ }
+
+
+ if $::fqdn == $ng_nagios_server {
+
+ # /etc/nagios/conf.d
+
+ file { $ng_conf_d_dir:
+ ensure => directory,
+ path => $ng_conf_d_dir,
+ owner => 'root',
+ group => $ng_user,
+ mode => '0750',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_etc_t,
+ seluser => system_u,
+ }
+
+ # /etc/nagios/objects
+
+ file { $ng_objects_dir:
+ ensure => directory,
+ path => $ng_objects_dir,
+ owner => 'root',
+ group => $ng_user,
+ mode => '0750',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_etc_t,
+ seluser => system_u,
+ }
+
+ # /etc/nagios/private
+
+ file { $ng_private_dir:
+ ensure => directory,
+ path => $ng_private_dir,
+ owner => 'root',
+ group => $ng_user,
+ mode => '0750',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_etc_t,
+ seluser => system_u,
+ }
+
+ # include dir
+
+ file { $ng_usr_incl:
+ ensure => directory,
+ path => $ng_usr_incl,
+ owner => 'root',
+ group => 'root',
+ mode => '0755',
+ selrange => s0,
+ selrole => object_r,
+ seltype => usr_t,
+ seluser => system_u,
+ }
+
+ # log dir
+
+ file { $ng_log_dir:
+ ensure => directory,
+ path => $ng_log_dir,
+ owner => $ng_user,
+ group => $ng_user,
+ mode => '0750',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_log_t,
+ seluser => system_u,
+ }
+
+ # log archives
+
+ file { $ng_log_archives:
+ ensure => directory,
+ path => $ng_log_archives,
+ owner => $ng_user,
+ group => $ng_user,
+ mode => '0750',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_log_t,
+ seluser => system_u,
+ }
+
+ # /usr/share/nagios
+
+ file { $ng_usr_share:
+ ensure => directory,
+ path => $ng_usr_share,
+ owner => 'root',
+ group => 'root',
+ mode => '0755',
+ selrange => s0,
+ selrole => object_r,
+ seltype => usr_t,
+ seluser => system_u,
+ }
+
+ # /usr/share/nagios/html
+
+ file { $ng_share_html:
+ ensure => directory,
+ path => $ng_share_html,
+ owner => 'root',
+ group => 'root',
+ mode => '0755',
+ selrange => s0,
+ selrole => object_r,
+ seltype => usr_t,
+ seluser => system_u,
+ }
+ }
+}
+ |
+
cd_nagios::main::install.pp +Module name: cd_nagios +Author: Arne Teuke +(arne_teuke@ConfDroid.com)
+ +This file is part of cd_nagios.
+ +cd_nagios is used for providing automatic configuration of Nagios. + +Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com) + This program is +free software: you can redistribute it and/or modify + it under the terms of +the GNU General Public License as published by + the Free Software +Foundation, either version 3 of the License, or + (at your option) any later +version.
+ +This program is distributed in the hope that it will be useful, + but +WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License +for more details.
+ +You should have received a copy of the GNU General Public License + along +with this program. If not, see www.gnu.org/licenses/.
+ +
+ + + +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+ |
+
+ # File 'manifests/main/install.pp', line 24
+
+class cd_nagios::main::install (
+
+) inherits cd_nagios::params {
+
+ require cd_resources
+
+ # if our FQDN matches the configured Nagios server FQDN, install both server-
+ # and client packages.
+
+ if $::fqdn == $ng_nagios_server {
+
+ # we'll need httpd installed
+ require cd_apache
+
+ package {$reqpackages_server:
+ ensure => $pkg_ensure,
+ }
+ package {$reqpackages_client:
+ ensure => $pkg_ensure,
+ }
+
+ # install NRPE if enabled
+
+ if $ng_include_nrpe == true {
+
+ package {$reqpackages_nrpe:
+ ensure => $pkg_ensure,
+ }
+ }
+ }
+
+ # if we are not the nagios server, install client packages
+
+ if $::fqdn != $ng_nagios_server {
+ package {$reqpackages_client:
+ ensure => $pkg_ensure,
+ }
+
+ # if we want o use NRPE, install it
+
+ if $ng_include_nrpe == true {
+ package {$reqpackages_nrpe:
+ ensure => $pkg_ensure,
+ }
+ }
+ }
+}
+ |
+
cd_nagios::main::user.pp +Module name: cd_nagios +Author: Arne Teuke +(arne_teuke@ConfDroid.com)
+ +This file is part of cd_nagios.
+ +cd_nagios is used for providing automatic configuration of Nagios + +Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com) + This program is +free software: you can redistribute it and/or modify + it under the terms of +the GNU General Public License as published by + the Free Software +Foundation, either version 3 of the License, or + (at your option) any later +version.
+ +This program is distributed in the hope that it will be useful, + but +WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License +for more details.
+ +You should have received a copy of the GNU General Public License + along +with this program. If not, see www.gnu.org/licenses/.
+ +
+ + + +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+ |
+
+ # File 'manifests/main/user.pp', line 23
+
+class cd_nagios::main::user (
+
+) inherits cd_nagios::params {
+
+ if $::fqdn == $ng_nagios_server {
+
+ require cd_nagios::main::install
+
+ group { $ng_user:
+ ensure => present,
+ name => $ng_user,
+ gid => $ng_u_uid,
+ allowdupe => false,
+ }
+
+ user { $ng_user:
+ ensure => present,
+ name => $ng_user,
+ allowdupe => false,
+ comment => $ng_u_comment,
+ uid => $ng_u_uid,
+ gid => $ng_user,
+ groups => $ng_u_groups,
+ managehome => true,
+ home => $ng_user_home,
+ shell => $ng_user_shell,
+ require => Group[$ng_user],
+ }
+ }
+}
+ |
+
cd_nagios::params.pp +Module name: cd_nagios +Author: Arne Teuke +(arne_teuke@ConfDroid.com)
+ +This file is part of cd_nagios.
+ +cd_nagios is used for providing automatic configuration of Nagios. + +Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com) + This program is +free software: you can redistribute it and/or modify + it under the terms of +the GNU General Public License as published by + the Free Software +Foundation, either version 3 of the License, or + (at your option) any later +version.
+ +This program is distributed in the hope that it will be useful, + but +WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License +for more details.
+ +You should have received a copy of the GNU General Public License + along +with this program. If not, see www.gnu.org/licenses/. + to connect +to NRPE, which as of now does not trust DNS names. Must be the + public +interface in case of NAT environments. +can issue host related commands. +can +issue service related commands.
+ +
+ + + +361 +362 +363 +364 +365 +366 +367 +368 +369 +370 +371 +372 +373 +374 +375 +376 +377 +378 +379 +380 +381 +382 +383 +384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +395 +396 +397 +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408 +409 +410 +411 +412 +413 +414 +415 +416 +417 +418 +419 +420 +421 +422 +423 +424 +425 +426 +427 +428 +429 +430 +431 +432 +433 +434 +435 +436 +437 +438 +439 +440 +441 +442 +443 +444 +445 +446 +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 +458 +459 +460 +461 +462 +463 +464 +465 +466 +467 +468 +469 +470 +471 +472 +473 +474 +475 +476 +477 +478 +479 +480 +481 +482 +483 +484 +485 +486 +487 +488 +489 +490 +491 +492 +493 +494 +495 +496 +497 +498 +499 +500 +501 +502 +503 +504 +505 +506 +507 +508 +509 +510 +511 +512 +513 +514 +515 +516 +517 +518 +519 +520 +521 +522 +523 +524 +525 +526 +527 +528 +529 +530 +531 +532 +533 +534 +535 +536 +537 +538 +539 +540 +541 +542 +543 +544 +545 +546 +547 +548 +549 +550 +551 +552 +553 +554 +555 +556 +557 +558 +559 +560 +561 +562 +563 +564 +565 +566 +567 +568 +569 +570 +571 +572 +573 +574 +575 +576 +577 +578 +579 +580 +581 +582 +583 +584 +585 +586 +587 +588 +589 +590 +591 +592 +593 +594 +595 +596 +597 +598 +599 +600 +601 +602 +603 +604 +605 +606 +607 +608 +609 +610 +611+ |
+
+ # File 'manifests/params.pp', line 361
+
+class cd_nagios::params (
+
+$pkg_ensure = 'latest',
+
+$ng_nagios_server = "nagios.${::domain}",
+$ng_nagios_ext_ip = undef,
+$ng_mail_user = "admin@${::domain}",
+
+$ng_include_nrpe = true,
+
+# firewall
+$ng_include_fw = true,
+$ng_use_https = true,
+$ng_http_https_fw = true,
+$ng_fw_order = '50',
+$ng_http_port = '80',
+$ng_https_port = '443',
+
+# check command parameters
+## ping
+$ng_ping_warn = '100.0,20%',
+$ng_ping_crit = '500.0,60%',
+$ng_ping_ensure = 'present',
+## disk
+$ng_disk_warn = '20%',
+$ng_disk_crit = '10%' ,
+$ng_disk_ensure = 'present',
+# swap
+$ng_swap_warn = '20',
+$ng_swap_crit = '10',
+$ng_swap_ensure = 'present',
+# users
+$ng_users_warn = '20',
+$ng_users_crit = '50',
+$ng_users_ensure = 'present',
+#total procs
+$ng_procs_tot_warn = '330',
+$ng_procs_tot_crit = '400',
+$ng_procs_tot_param = 'RDST',
+$ng_procs_tot_ens = 'present',
+# zombie procs
+$ng_procs_z_warn = '10',
+$ng_procs_z_crit = '30',
+$ng_procs_z_param = 'Z',
+$ng_procs_z_ensure = 'present',
+# load
+$ng_load_warn = '5.00,4.00,3.00',
+$ng_load_crit = '10.00,6.00,4.00',
+$ng_load_ensure = 'present',
+
+# user settings
+$ng_user = 'nagios',
+$ng_u_comment = 'Nagios service user',
+$ng_u_uid = '1004',
+$ng_user_home = '/var/spool/nagios',
+$ng_u_groups = undef,
+$ng_user_shell = '/bin/bash',
+
+# cgi settings
+$ng_context_help = '1',
+$ng_pending_state = '1',
+$ng_use_auth = '1',
+$ng_use_ssl_auth = '0',
+$ng_enable_def_user = false,
+$ng_def_user_name = 'nagios_insecure',
+$ng_nagios_admin = 'nagios_sec_adm',
+$ng_sysinfo_auth = '',
+$ng_confinfo_auth = '',
+$ng_command_auth = '',
+$ng_hostview_auth = '',
+$ng_serviceview_auth = '',
+$ng_host_cmd_auth = '',
+$ng_svc_cmd_auth = '',
+$ng_readonly_auth = '' ,
+$ng_statusmap_img = 'smbackground.gd2',
+$ng_use_colormap = false,
+$ng_colormap_red = '255',
+$ng_colormap_green = '255',
+$ng_colormap_blue = '255',
+$ng_statusmap_layout = '6',
+$ng_wrl_layout = '4',
+$ng_incl_own_wrl = false,
+$ng_statuswrl_include = '',
+$ng_ping_syntax = '/bin/ping -n -U -c 5 $HOSTADDRESS$',
+$ng_refresh_rate = '90',
+$ng_result_limit = '100',
+$ng_escape_html = '1',
+$ng_use_sound = false,
+$ng_host_unreachable = 'hostdown.wav',
+$ng_host_down = 'hostdown.wav',
+$ng_svc_critical = 'critical.wav',
+$ng_svc_warn = 'warning.wav',
+$ng_svc_unknown = 'warning.wav',
+$ng_normal_sound = 'noproblem.wav',
+$ng_action_url_target = '_blank',
+$ng_notes_url_target = '_blank',
+$ng_lock_author_names = '1',
+$ng_enable_splunk = false,
+$ng_splunk_url = 'http://127.0.0.1:8000/',
+$ng_navbar_addresses = '1',
+$ng_navbar_aliases = '1',
+$ng_ack_no_sticky = '0',
+$ng_ack_no_send = '0',
+
+# selinux
+$ng_use_selinux_tools = true,
+
+# httpd
+$ng_required_hosts = '',
+$ng_required_ips = '127.0.0.0/8',
+$ng_enable_index = true,
+
+# certbot
+$ng_enable_certbot = true,
+$ng_certbot_webroot = '/var/www/html',
+$ng_webserver_name = "nagios.${::domain}",
+
+# main settings
+$ng_log_file = '/var/log/nagios/nagios.log',
+$ng_max_check_attempts = '10',
+$ng_object_cache_file = '/var/spool/nagios/objects.cache',
+$ng_precached_obj_file = '/var/spool/nagios/objects.precache',
+$ng_resource_file = '/etc/nagios/private/resource.cfg',
+$ng_status_file = '/var/log/nagios/status.dat',
+$ng_status_upd_interval = '10',
+$ng_check_ext_commands = '1',
+$ng_command_file = '/var/spool/nagios/cmd/nagios.cmd',
+$ng_enable_query_handler = false,
+$ng_query_socket = '/var/spool/nagios/cmd/nagios.qh',
+$ng_lock_file = '/var/run/nagios/nagios.pid',
+$ng_temp_file = '/var/spool/nagios/nagios.tmp',
+$ng_temp_path = '/tmp',
+$ng_event_broker_options = '-1',
+$ng_event_broker_module = '',
+$ng_log_rotation_method = 'h',
+$ng_log_archive_path = '/var/log/nagios/archives',
+$ng_use_syslog = '1',
+$ng_log_notifications = '1',
+$ng_log_service_retries = '1',
+$ng_log_host_retries = '1',
+$ng_log_event_handlers = '1',
+$ng_log_initial_states = '0',
+$ng_log_current_states = '1',
+$ng_log_external_commands = '1',
+$ng_log_passive_checks = '1',
+$ng_glob_host_evt_handler = '',
+$ng_glob_svc_evt_handler = '',
+$ng_svc_int_check_delay = 's',
+$ng_max_svc_check_spread = '30',
+$ng_svc_interleave_factor = 's',
+$ng_host_int_check_delay = 's',
+$ng_max_host_check_spread = '30',
+$ng_max_concurrent_checks = '0',
+$ng_check_res_reaper_freq = '10',
+$ng_max_check_res_reap_time = '30',
+$ng_check_result_path = '/var/spool/nagios/checkresults',
+$ng_max_check_res_file_age = '3600',
+$ng_cached_h_check_horizon = '15',
+$ng_cached_s_check_horizon = '15',
+$ng_pred_host_dep_checks = '1',
+$ng_pred_svc_dep_checks = '1',
+$ng_soft_state_dependencies = '0',
+$ng_time_change_threshold = '900',
+$ng_auto_reschedule_checks = '0',
+$ng_auto_reschedule_intval = '30',
+$ng_auto_reschedule_window = '180',
+
+) {
+
+# installation section
+
+ $reqpackages_server = $::operatingsystem ? {
+ /(?i-mx:centos|fedora|redhat)/ => ['nagios','nagios-devel']
+ }
+ $reqpackages_client = $::operatingsystem ? {
+ /(?i-mx:centos|fedora|redhat)/ => ['net-snmp-utils','nagios-plugins','nagios-plugins-all', 'nagios-plugins-nrpe', 'nagios-common']
+ }
+ $reqpackages_nrpe = $::operatingsystem ? {
+ /(?i-mx:centos|fedora|redhat)/ => ['nrpe']
+ }
+
+# service
+$ng_service = 'nagios'
+$ae_service = 'httpd'
+
+# directories
+$ng_main_dir = '/etc/nagios'
+$ng_conf_d_dir = "${ng_main_dir}/conf.d"
+$ng_objects_dir = "${ng_main_dir}/objects"
+$ng_private_dir = "${ng_main_dir}/private"
+$ng_usr_incl = '/usr/include/nagios'
+$ng_lib_dir = '/usr/lib64/nagios'
+$ng_log_dir = '/var/log/nagios'
+$ng_log_archives = "${ng_log_dir}/archives"
+$ng_spool_dir = '/var/spool/nagios'
+$ng_usr_share = '/usr/share/nagios'
+$ng_share_html = "${ng_usr_share}/html"
+
+# files
+$ng_main_config = "${ng_main_dir}/nagios.cfg"
+$ng_cgi_cfg_file = "${ng_main_dir}/cgi.cfg"
+$ng_cgi_cfg_erb = 'cd_nagios/nagios/cgi_cfg.erb'
+$ng_htpasswd_file = "${ng_main_dir}/passwd"
+$ng_htpasswd_head = 'cd_nagios/nagios/htpasswd_head.erb'
+$ng_htpasswd_rule = 'cd_nagios/nagios/htpasswd_rule.erb'
+$ng_taccgi_erb = 'cd_nagios/selinux/taccgi.erb'
+$ng_statcgi_erb = 'cd_nagios/selinux/statuscgi.erb'
+$ng_nagios_conf = '/etc/httpd/conf.d/nagios.conf'
+$ng_nagios_conf_erb = 'cd_nagios/httpd/nagios_conf.erb'
+$ng_welcome_conf = '/etc/httpd/conf.d/welcome.conf'
+$ng_welcome_conf_erb = 'cd_nagios/httpd/welcome_conf.erb'
+$ng_forward_conf = '/etc/httpd/conf.d/nagios_forward.conf'
+$ng_forward_conf_erb = 'cd_nagios/httpd/forward_conf.erb'
+$ng_get_cert_erb = 'cd_nagios/certbot/get_cert.erb'
+$ng_unless_get_cert = 'cd_nagios/certbot/unless_get_cert.erb'
+$ng_unless_renew_erb = 'cd_nagios/certbot/unless_renew_cert.erb'
+$ng_index_html_file = '/var/www/html/index.html'
+$ng_index_html_erb = 'cd_nagios/httpd/index_html.erb'
+$ng_ssl_vhost_file = '/etc/httpd/conf.d/nagios_ssl.conf'
+$ng_ssl_vhost_erb = 'cd_nagios/httpd/nagios_ssl_vhost.erb'
+$ng_nagios_cfg_file = "${ng_main_dir}/nagios.cfg"
+$ng_nagios_cfg_erb = 'cd_nagios/nagios/nagios_cfg.erb'
+
+# certbot
+$ng_certbot_main_dir = '/etc/letsencrypt'
+$ng_certbot_archive = "${ng_certbot_main_dir}/archive"
+$ng_certbot_check = "${ng_certbot_archive}/${ng_webserver_name}/cert1.pem"
+$ng_certbot_live = "${ng_certbot_main_dir}/live"
+
+# nagios
+
+$ng_target_templates = "${ng_conf_d_dir}/templates.cfg"
+$ng_target_timeperiods = "${ng_conf_d_dir}/timeperiods.cfg"
+$ng_target_localhost = "${ng_conf_d_dir}/nagios_localhost.cfg"
+$ng_target_host = "${ng_conf_d_dir}/nagios_host.cfg"
+$ng_target_hostgroup = "${ng_conf_d_dir}/nagios_hostgroup.cfg"
+$ng_target_hostdep = "${ng_conf_d_dir}/nagios_hostdependency.cfg"
+$ng_target_hostesc = "${ng_conf_d_dir}/nagios_hostescalation.cfg"
+$ng_target_hostext = "${ng_conf_d_dir}/nagios_hostextinfo.cfg"
+$ng_target_service = "${ng_conf_d_dir}/nagios_service.cfg"
+$ng_target_servicegroup = "${ng_conf_d_dir}/nagios_servicegroup.cfg"
+$ng_target_contact = "${ng_conf_d_dir}/nagios_contact.cfg"
+$ng_target_contactgroup = "${ng_conf_d_dir}/nagios_contactgroup.cfg"
+$ng_target_command = "${ng_conf_d_dir}/nagios_command.cfg"
+
+
+# includes must be last
+
+ include cd_nagios::main::config
+
+}
+ |
+
cd_nagios::selinux::config.pp +Module name: cd_nagios +Author: Arne Teuke +(arne_teuke@ConfDroid.com)
+ +This file is part of cd_nagios.
+ +cd_nagios is used for providing automatic configuration of Nagios + +Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com) + This program is +free software: you can redistribute it and/or modify + it under the terms of +the GNU General Public License as published by + the Free Software +Foundation, either version 3 of the License, or + (at your option) any later +version.
+ +This program is distributed in the hope that it will be useful, + but +WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License +for more details.
+ +You should have received a copy of the GNU General Public License + along +with this program. If not, see www.gnu.org/licenses/.
+ +
+ + + +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+ |
+
+ # File 'manifests/selinux/config.pp', line 24
+
+class cd_nagios::selinux::config (
+
+) inherits cd_nagios::params {
+
+ if $ng_use_selinux_tools == true {
+
+ # it appears that selinux hehaves differently accross different nodes,
+ # so all we can do for now is to create a list of the AVC alerts and come up
+ # with a solution on that later.
+
+ exec { 'create_avc_list':
+ command => 'sealert -a /var/log/audit/audit.log > avc_alerts',
+ cwd => $ng_user_home,
+ path => ['/usr/bin'],
+ creates => "${ng_user_home}/avc_alerts",
+ }
+
+ # sealert tac-cgi
+ exec { 'create_policy_taccgi':
+ command => template($ng_taccgi_erb),
+ path => ['/usr/bin','/usr/sbin'],
+ cwd => $ng_user_home,
+ creates => "${ng_user_home}/my-taccgi.pp",
+ notify => Exec['semodule_taccgi'],
+ }
+
+ exec { 'semodule_taccgi':
+ command => 'semodule -i my-taccgi.pp',
+ path => ['/usr/bin','/usr/sbin'],
+ cwd => $ng_user_home,
+ require => Exec['create_policy_taccgi'],
+ refreshonly => true,
+ }
+
+ # sealert status.cgi
+
+ exec { 'create_policy_statuscgi':
+ command => template($ng_statcgi_erb),
+ path => ['/usr/bin','/usr/sbin'],
+ cwd => $ng_user_home,
+ creates => "${ng_user_home}/my-statuscgi.pp",
+ notify => Exec['semodule_statuscgi'],
+ }
+
+ exec { 'semodule_statuscgi':
+ command => 'semodule -i my-statuscgi.pp',
+ path => ['/usr/bin','/usr/sbin'],
+ cwd => $ng_user_home,
+ require => Exec['create_policy_statuscgi'],
+ refreshonly => true,
+ notify => Service[$ng_service],
+ }
+ }
+}
+ |
+
cd_nagios::server::access_rules.pp +Module name: cd_nagios +Author: Arne +Teuke (arne_teuke@ConfDroid.com)
+ +This file is part of cd_nagios.
+ +cd_nagios is used for providing automatic configuration of Nagios + +Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com) + This program is +free software: you can redistribute it and/or modify + it under the terms of +the GNU General Public License as published by + the Free Software +Foundation, either version 3 of the License, or + (at your option) any later +version.
+ +This program is distributed in the hope that it will be useful, + but +WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License +for more details.
+ +You should have received a copy of the GNU General Public License + along +with this program. If not, see www.gnu.org/licenses/.
+ +
+ + + +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49+ |
+
+ # File 'manifests/server/access_rules.pp', line 28
+
+class cd_nagios::server::access_rules (
+
+) inherits cd_nagios::params {
+
+ if $::fqdn == $ng_nagios_server {
+
+ # manage /etc/nagios/htpasswd file
+
+ concat { $ng_htpasswd_file:
+ ensure => present,
+ path => $ng_htpasswd_file,
+ owner => 'root',
+ group => 'apache',
+ mode => '0640',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_etc_t,
+ seluser => system_u,
+ notify => Service[$ng_service],
+ }
+ }
+}
+ |
+
cd_nagios::server::files.pp +Module name: cd_nagios +Author: Arne Teuke +(arne_teuke@ConfDroid.com)
+ +This file is part of cd_nagios.
+ +cd_nagios is used for providing automatic configuration of Nagios + +Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com) + This program is +free software: you can redistribute it and/or modify + it under the terms of +the GNU General Public License as published by + the Free Software +Foundation, either version 3 of the License, or + (at your option) any later +version.
+ +This program is distributed in the hope that it will be useful, + but +WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License +for more details.
+ +You should have received a copy of the GNU General Public License + along +with this program. If not, see www.gnu.org/licenses/.
+ +
+ + + +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+ |
+
+ # File 'manifests/server/files.pp', line 23
+
+class cd_nagios::server::files (
+
+) inherits cd_nagios::params {
+
+ if $::fqdn == $ng_nagios_server {
+ if $ng_use_https == true {
+ if $ng_enable_certbot == true {
+
+ require cd_nagios::certbot::certs
+
+ }
+ }
+
+ require cd_nagios::main::dirs
+
+ # manage nagios.cfg
+
+ file { $ng_nagios_cfg_file:
+ ensure => file,
+ path => $ng_nagios_cfg_file,
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_etc_t,
+ seluser => system_u,
+ content => template($ng_nagios_cfg_erb),
+ notify => Service[$ng_service],
+ }
+
+ # manage cgi.cfg
+
+ file { $ng_cgi_cfg_file:
+ ensure => file,
+ path => $ng_cgi_cfg_file,
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_etc_t,
+ seluser => system_u,
+ content => template($ng_cgi_cfg_erb),
+ notify => Service[$ng_service],
+ }
+
+ # since we use vhost files, we do not want the regular file to appear
+ # after upgrades to avoid conflicts
+
+ file { $ng_nagios_conf:
+ ensure => absent,
+ }
+
+ file { $ng_forward_conf:
+ ensure => file,
+ path => $ng_forward_conf,
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ selrange => s0,
+ selrole => object_r,
+ seltype => httpd_config_t,
+ seluser => system_u,
+ content => template($ng_forward_conf_erb),
+ notify => Service[$ae_service],
+ }
+
+ if $ng_use_https == true {
+
+ # create ssl vhost
+
+ file { $ng_ssl_vhost_file:
+ ensure => file,
+ path => $ng_ssl_vhost_file,
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ selrange => s0,
+ selrole => object_r,
+ seltype => httpd_config_t,
+ seluser => system_u,
+ content => template($ng_ssl_vhost_erb),
+ notify => Service[$ae_service],
+ }
+ }
+
+ if $ng_use_https != true {
+
+ # remove ssl_vhost
+
+ file { $ng_ssl_vhost_file:
+ ensure => absent,
+ }
+ }
+ }
+}
+ |
+
cd_nagios::server::service.pp +Module name: cd_nagios +Author: Arne Teuke +(arne_teuke@ConfDroid.com)
+ +This file is part of cd_nagios.
+ +cd_nagios is used for providing automatic configuration of Nagios + +Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com) + This program is +free software: you can redistribute it and/or modify + it under the terms of +the GNU General Public License as published by + the Free Software +Foundation, either version 3 of the License, or + (at your option) any later +version.
+ +This program is distributed in the hope that it will be useful, + but +WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License +for more details.
+ +You should have received a copy of the GNU General Public License + along +with this program. If not, see www.gnu.org/licenses/.
+ +
+ + + +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+ |
+
+ # File 'manifests/server/service.pp', line 23
+
+class cd_nagios::server::service (
+
+) inherits cd_nagios::params {
+
+ if $::fqdn == $ng_nagios_server {
+
+ require cd_nagios::server::files
+ require cd_nagios::server::access_rules
+
+ service { $ng_service:
+ ensure => running,
+ hasstatus => true,
+ hasrestart => true,
+ enable => true,
+ }
+
+ @@nagios_service { "check_nagios${::hostname}":
+ check_command => 'check_nagios!/var/log/nagios/status.dat!5!/usr/sbin/nagios',
+ use => 'generic-service',
+ host_name => $::fqdn,
+ notification_period => '24x7',
+ target => $ng_target_service,
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '660',
+ contacts => 'DevOps',
+ }
+
+ resources { [ 'nagios_host',
+ 'nagios_hostgroup',
+ 'nagios_hostdependency',
+ 'nagios_hostescalation',
+ 'nagios_hostextinfo',
+ 'nagios_service',
+ 'nagios_servicegroup',
+ 'nagios_servicedependency',
+ 'nagios_serviceescalation',
+ 'nagios_serviceextinfo',
+ 'nagios_contact',
+ 'nagios_contactgroup',
+ 'nagios_command',
+ 'nagios_timeperiod' ]:
+ purge => true,
+ }
+
+ # collect resources and populate /etc/nagios/conf.d/nagios_*.cfg
+ Nagios_host <<||>> { notify => Service['nagios'] }
+ Nagios_hostgroup <<||>> { notify => Service['nagios'] }
+ Nagios_hostdependency <<||>> { notify => Service['nagios'] }
+ Nagios_hostescalation <<||>> { notify => Service['nagios'] }
+ Nagios_hostextinfo <<||>> { notify => Service['nagios'] }
+ Nagios_service <<||>> { notify => Service['nagios'] }
+ Nagios_servicegroup <<||>> { notify => Service['nagios'] }
+ Nagios_servicedependency <<||>> { notify => Service['nagios'] }
+ Nagios_serviceescalation <<||>> { notify => Service['nagios'] }
+ Nagios_serviceextinfo <<||>> { notify => Service['nagios'] }
+ Nagios_contact <<||>> { notify => Service['nagios'] }
+ Nagios_contactgroup <<||>> { notify => Service['nagios'] }
+ Nagios_command <<||>> { notify => Service['nagios'] }
+ Nagios_timeperiod <<||>> { notify => Service['nagios'] }
+
+ }
+}
+ |
+
cd_nagios::server::access.pp +Module name: cd_nagios +Author: Arne Teuke +(arne_teuke@ConfDroid.com)
+ +This file is part of cd_nagios.
+ +cd_nagios is used for providing automatic configuration of Nagios + +Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com) + This program is +free software: you can redistribute it and/or modify + it under the terms of +the GNU General Public License as published by + the Free Software +Foundation, either version 3 of the License, or + (at your option) any later +version.
+ +This program is distributed in the hope that it will be useful, + but +WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License +for more details.
+ +You should have received a copy of the GNU General Public License + along +with this program. If not, see www.gnu.org/licenses/.
+ +
+ + + +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48+ |
+
+ # File 'manifests/server/access.pp', line 26
+
+define cd_nagios::server::access (
+
+$ng_htpasswd_user = undef,
+$ng_htpasswd_password = undef,
+
+) {
+
+$ng_nagios_server = $::cd_nagios::params::ng_nagios_server
+$ng_htpasswd_file = $::cd_nagios::params::ng_htpasswd_file
+$ng_htpasswd_rule = $::cd_nagios::params::ng_htpasswd_rule
+$ng_service = $::cd_nagios::params::ng_service
+
+
+ if $::fqdn == $ng_nagios_server {
+
+ # create password rules
+
+ concat::fragment { $name:
+ target => $ng_htpasswd_file,
+ content => template($ng_htpasswd_rule),
+ }
+ }
+}
+ |
+