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..88fc7e1 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,266 @@ +
+Changelog of Git Changelog. +
+ ++
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
+
+
+
+
|
+
| t |
+ + + +23 +24 +25+ |
+
+ # File 'manifests/init.pp', line 23
+
+class cd_nagios {
+ include cd_nagios::params
+}
+ |
+
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+ |
+
+ # File 'manifests/certbot/config.pp', line 23
+
+class cd_nagios::certbot::config (
+
+) inherits cd_nagios::params {
+
+ if $::fqdn == $ng_nagios_server {
+ 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',
+ }
+
+ # create temp vhost file
+
+ exec { 'create_temp_vhost':
+ command => template('cd_nagios/certbot/create_tempfile.erb'),
+ cwd => '/tmp',
+ path => ['/bin','/usr/bin'],
+ provider => 'shell',
+ creates => '/etc/httpd/conf.d/.created',
+ notify => Service['httpd'],
+ }
+
+ # 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',
+ }
+
+ # remove temp_vhost
+
+ exec { 'remove_temp_vhost':
+ command => "rm -Rf ${ng_certbot_temp_file}",
+ cwd => '/tmp',
+ path => ['/bin','/usr/bin'],
+ provider => 'shell',
+ notify => Service['httpd'],
+ require => Exec['create_cert'],
+ creates => "/etc/letsencrypt/live/${ng_nagios_server}/cert.pem",
+ }
+
+ # 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),
+ }
+ }
+ }
+}
+ |
+
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+ |
+
+ # 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 $::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.
+ +
+ + + +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +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+ |
+
+ # File 'manifests/params.pp', line 213
+
+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_disable_welcome = true,
+
+# certbot
+$ng_enable_certbot = true,
+$ng_certbot_cert_path = '/var/www/html',
+
+) {
+
+# 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_create_tempvhost = 'cd_nagios/certbot/create_tempfile.erb'
+$ng_certbot_temp_file = '/etc/httpd/conf.d/certbot_temp.conf'
+
+# 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 +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+ |
+
+ # File 'manifests/server/files.pp', line 23
+
+class cd_nagios::server::files (
+
+) inherits cd_nagios::params {
+
+ if $::fqdn == $ng_nagios_server {
+ if $ng_enable_certbot == true {
+ require cd_nagios::certbot::config
+ require cd_nagios::main::dirs
+
+ # manage nagios.cfg
+
+
+ # 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],
+ }
+
+ # manage nagios.conf for httpd
+
+ file { $ng_nagios_conf:
+ ensure => file,
+ path => $ng_nagios_conf,
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ selrange => s0,
+ selrole => object_r,
+ seltype => httpd_config_t,
+ seluser => system_u,
+ content => template($ng_nagios_conf_erb),
+ notify => Service[$ae_service],
+ }
+
+ if $ng_http_https_fw == true {
+ 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],
+ }
+ }
+
+ # manage welcome.conf for nagios web server
+
+ if $ng_disable_welcome == true {
+ file { $ng_welcome_conf:
+ ensure => file,
+ path => $ng_welcome_conf,
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ selrange => s0,
+ selrole => object_r,
+ seltype => httpd_config_t,
+ seluser => system_u,
+ content => template($ng_welcome_conf_erb),
+ notify => Service[$ae_service],
+ }
+ }
+ }
+
+ else {
+
+ require cd_nagios::main::dirs
+
+ # manage nagios.cfg
+
+
+ # 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],
+ }
+
+ # manage nagios.conf for httpd
+
+ file { $ng_nagios_conf:
+ ensure => file,
+ path => $ng_nagios_conf,
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ selrange => s0,
+ selrole => object_r,
+ seltype => httpd_config_t,
+ seluser => system_u,
+ content => template($ng_nagios_conf_erb),
+ notify => Service[$ae_service],
+ }
+
+ if $ng_http_https_fw == true {
+
+ 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],
+ }
+ }
+
+ # manage welcome.conf for nagios web server
+
+ if $ng_disable_welcome == true {
+
+ file { $ng_welcome_conf:
+ ensure => file,
+ path => $ng_welcome_conf,
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ selrange => s0,
+ selrole => object_r,
+ seltype => httpd_config_t,
+ seluser => system_u,
+ content => template($ng_welcome_conf_erb),
+ notify => Service[$ae_service],
+ }
+ }
+ }
+ }
+}
+ |
+
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+ |
+
+ # 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,
+ }
+ }
+}
+ |
+
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),
+ }
+ }
+}
+ |
+