Documentation by YARD 0.9.36
+Alphabetic Index
+ +Puppet Class Listing A-Z
+ + +
+
+
+
|
+
Defined Type Listing A-Z
+ + +
+
+
+
|
+
File Listing
+-
+
+
+
- README + + +
diff --git a/doc/_index.html b/doc/_index.html new file mode 100644 index 0000000..937bfc9 --- /dev/null +++ b/doc/_index.html @@ -0,0 +1,242 @@ + + +
+ + +
+
+
+
|
+
+
+
+
|
+
| t |
+ + + +6 +7 +8+ |
+
+ # File 'manifests/init.pp', line 6
+
+class confdroid_nagios {
+ include confdroid_nagios::params
+}
+ |
+
confdroid_nagios::client::target.pp Module name: confdroid_nagios Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +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+ |
+
+ # File 'manifests/client/target.pp', line 6
+
+class confdroid_nagios::client::target (
+
+) inherits confdroid_nagios::params {
+ if ($ng_nagios_server == $fqdn) and ($ng_enable_target == true) {
+ if $ng_include_nrpe == true {
+ require confdroid_nrpe
+ }
+
+ @@nagios_host { $fqdn:
+ ensure => $ng_ping_ensure,
+ alias => $hostname,
+ address => $fqdn,
+ use => 'linux-server',
+ target => $ng_target_host,
+ hostgroups => 'linux-servers',
+ contacts => $ng_contact_name,
+ max_check_attempts => $ng_max_check_attempts,
+ notification_period => '24x7',
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ check_command => "check_ping!${ng_ping_warn}!${ng_ping_crit}",
+ notify => Service[$ng_service],
+ }
+
+ @@nagios_service { "root_partition_${fqdn}":
+ ensure => $ng_disk_ensure,
+ check_command => "check_nrpe!check_disk!${ng_disk_warn}!${ng_disk_crit}!/",
+ use => 'generic-service',
+ host_name => $fqdn,
+ contacts => $ng_contact_name,
+ notification_period => '24x7',
+ service_description => "${fqdn}_root_partition",
+ servicegroups => 'linux-services',
+ target => $ng_target_service,
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ }
+
+ if $ng_enable_swap_check == true {
+ @@nagios_service { "Swap_Usage_${fqdn}":
+ ensure => $ng_swap_ensure,
+ check_command => "check_nrpe!check_swap!${ng_swap_warn}!${ng_swap_crit}",
+ use => 'generic-service',
+ host_name => $fqdn,
+ contacts => $ng_contact_name,
+ notification_period => '24x7',
+ service_description => "${fqdn}_swap_usage",
+ servicegroups => 'linux-services',
+ target => $ng_target_service,
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ }
+ }
+
+ @@nagios_service { "Local_Users_${fqdn}":
+ ensure => $ng_users_ensure,
+ check_command => "check_nrpe!check_users!${ng_users_warn}!${ng_users_crit}",
+ use => 'generic-service',
+ host_name => $fqdn,
+ contacts => $ng_contact_name,
+ notification_period => '24x7',
+ service_description => "${fqdn}_local_users",
+ servicegroups => 'linux-services',
+ target => $ng_target_service,
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ }
+
+ @@nagios_service { "Total Processes_${fqdn}":
+ 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 => $ng_contact_name,
+ notification_period => '24x7',
+ service_description => "${fqdn}_total_processes",
+ servicegroups => 'linux-services',
+ target => $ng_target_service,
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ }
+
+ @@nagios_service { "Zombie Processes_${fqdn}":
+ 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 => $ng_contact_name,
+ notification_period => '24x7',
+ service_description => "${fqdn}_zombie_processes",
+ servicegroups => 'linux-services',
+ target => $ng_target_service,
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ }
+
+ @@nagios_service { "Current_Load_${fqdn}":
+ ensure => $ng_load_ensure,
+ check_command => "check_nrpe!check_load!${ng_load_warn}!${ng_load_crit}",
+ use => 'generic-service',
+ host_name => $fqdn,
+ contacts => $ng_contact_name,
+ notification_period => '24x7',
+ service_description => "${fqdn}_current_load",
+ servicegroups => 'linux-services',
+ target => $ng_target_service,
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ }
+ }
+}
+ |
+
confdroid_nagios::main::config.pp Module name: confdroid_nagios Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +6 +7 +8 +9 +10 +11 +12 +13 +14+ |
+
+ # File 'manifests/main/config.pp', line 6
+
+class confdroid_nagios::main::config (
+
+) inherits confdroid_nagios::params {
+ if $fqdn == $ng_nagios_server {
+ include confdroid_nagios::server::service
+ }
+
+ include confdroid_nagios::client::target
+}
+ |
+
confdroid_nagios::main::dirs.pp Module name: confdroid_nagios Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +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 +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 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221+ |
+
+ # File 'manifests/main/dirs.pp', line 6
+
+class confdroid_nagios::main::dirs (
+
+) inherits confdroid_nagios::params {
+ require confdroid_nagios::main::install
+
+ if $ng_nagios_server == $fqdn {
+ # 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,
+ }
+
+ # /etc/nagios/objects
+ file { $ng_objects_dir:
+ ensure => directory,
+ path => $ng_objects_dir,
+ owner => 'root',
+ group => 'nagios',
+ 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 => 'nagios',
+ mode => '0750',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_etc_t,
+ seluser => system_u,
+ }
+
+ # /etc/nagios/conf.d
+ file { $ng_conf_d_dir:
+ ensure => directory,
+ path => $ng_conf_d_dir,
+ owner => 'root',
+ group => 'nagios',
+ mode => '0750',
+ 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 => 'nagios',
+ group => 'nagios',
+ mode => '0755',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_spool_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 => 'nagios',
+ group => 'nagios',
+ 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 => 'nagios',
+ group => 'nagios',
+ 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,
+ }
+
+ # run dir for pid file
+ file { $ng_run_dir:
+ ensure => directory,
+ path => $ng_run_dir,
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0755',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_var_run_t,
+ seluser => system_u,
+ }
+
+ # cmd dir
+ file { $ng_cmd_dir:
+ ensure => directory,
+ path => $ng_cmd_dir,
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '2775',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_spool_t,
+ seluser => system_u,
+ }
+
+ # checkresults dir
+ file { $ng_checkresults_dir:
+ ensure => directory,
+ path => $ng_checkresults_dir,
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0750',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_spool_t,
+ seluser => system_u,
+ }
+ }
+
+ if $ng_nagios_server != $fqdn {
+ # ensure client directories exist on server for potential future use
+ file { $ng_lib_dir:
+ ensure => directory,
+ path => $ng_lib_dir,
+ owner => 'root',
+ group => 'root',
+ mode => '0755',
+ selrange => s0,
+ selrole => object_r,
+ seltype => usr_t,
+ seluser => system_u,
+ }
+
+ file { $ng_spool_dir:
+ ensure => directory,
+ path => $ng_spool_dir,
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0755',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_spool_t,
+ seluser => system_u,
+ }
+ }
+}
+ |
+
confdroid_nagios::main::install.pp Module name: confdroid_nagios Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +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+ |
+
+ # File 'manifests/main/install.pp', line 6
+
+class confdroid_nagios::main::install (
+
+) inherits confdroid_nagios::params {
+ require confdroid_resources
+
+ if $ng_nagios_server == $fqdn {
+ # if our FQDN matches the configured Nagios server FQDN, install both server-
+ # and client packages.We'll need httpd installed
+ require confdroid_apache
+
+ package { $ng_reqpackages_server:
+ ensure => $ng_pkg_ensure,
+ }
+ package { $ng_reqpackages_client:
+ ensure => $ng_pkg_ensure,
+ }
+ }
+
+ # if we are not the nagios server, install only client packages
+ if $fqdn != $ng_nagios_server {
+ package { $ng_reqpackages_client:
+ ensure => $ng_pkg_ensure,
+ }
+
+ # if we want to use NRPE on clients, install it
+ if $ng_include_nrpe == true {
+ require confdroid_nrpe
+ }
+ }
+}
+ |
+
confdroid_nagios::main::user.pp Module name: confdroid_nagios Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +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+ |
+
+ # File 'manifests/main/user.pp', line 6
+
+class confdroid_nagios::main::user (
+
+) inherits confdroid_nagios::params {
+ require confdroid_nagios::main::install
+
+ if $ng_nagios_server == $fqdn {
+ group { $ng_user:
+ ensure => present,
+ name => $ng_user,
+ allowdupe => false,
+ }
+
+ user { $ng_user:
+ ensure => present,
+ name => $ng_user,
+ allowdupe => false,
+ comment => $ng_u_comment,
+ groups => $ng_u_groups,
+ managehome => true,
+ home => $ng_u_home,
+ shell => $ng_u_shell,
+ require => Group[$ng_user],
+ }
+ }
+}
+ |
+
confdroid_nagios::server::nagios::config.pp Module name: confdroid_nagios Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19+ |
+
+ # File 'manifests/nagios/config.pp', line 6
+
+class confdroid_nagios::nagios::config (
+
+) inherits confdroid_nagios::params {
+ if $ng_nagios_server == $fqdn {
+ require confdroid_nagios::nagios::objects::commands
+ #require confdroid_nagios::nagios::objects::template_rules
+ require confdroid_nagios::nagios::objects::add_contact_rules
+ require confdroid_nagios::nagios::objects::add_contactgroups_rules
+ require confdroid_nagios::nagios::objects::add_hostgroup_rules
+ require confdroid_nagios::nagios::objects::add_servicegroup_rules
+ #require confdroid_nagios::nagios::objects::add_timeperiod_rules
+ require confdroid_nagios::nagios::resources::resource
+ }
+}
+ |
+
confdroid_nagios::nagios::objects::add_contact_rules.pp Module name: confdroid_nagios Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +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+ |
+
+ # File 'manifests/nagios/objects/add_contact_rules.pp', line 13
+
+class confdroid_nagios::nagios::objects::add_contact_rules (
+
+) inherits confdroid_nagios::params {
+ if $ng_nagios_server == $fqdn {
+ # manage /etc/nagios/conf.d/nagios_add_contacts.cfg
+
+ concat { $ng_target_add_contact:
+ ensure => present,
+ path => $ng_target_add_contact,
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_etc_t,
+ seluser => system_u,
+ notify => Service[$ng_service],
+ }
+
+ # manage file header
+
+ concat::fragment { 'contact_header':
+ target => $ng_target_add_contact,
+ content => template($ng_contacts_head_erb),
+ order => '000',
+ }
+
+ # add main contact through define via parameters
+ confdroid_nagios::nagios::objects::add_contact { $ng_contact_name:
+ ng_contact_name => $ng_contact_name,
+ ng_contact_alias => $ng_contact_alias,
+ ng_contact_groups => $ng_contact_groups,
+ ng_contact_email => $ng_contact_email,
+ }
+ }
+}
+ |
+
confdroid_nagios::nagios::objects::add_contactgroups_rules.pp Module name: confdroid_nagios Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +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+ |
+
+ # File 'manifests/nagios/objects/add_contactgroups_rules.pp', line 13
+
+class confdroid_nagios::nagios::objects::add_contactgroups_rules (
+
+) inherits confdroid_nagios::params {
+ if $ng_nagios_server == $fqdn {
+ # manage /etc/nagios/conf.d/nagios_add_contactgroups.cfg
+
+ concat { $ng_tgt_contactgroup_add:
+ ensure => present,
+ path => $ng_tgt_contactgroup_add,
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_etc_t,
+ seluser => system_u,
+ notify => Service[$ng_service],
+ }
+
+ # manage file header
+
+ concat::fragment { 'contactgroups_header':
+ target => $ng_tgt_contactgroup_add,
+ content => template($ng_cntctgrps_head_erb),
+ order => '000',
+ }
+
+ # add main contact group through define via parameters
+ confdroid_nagios::nagios::objects::add_contactgroups { $ng_contactgroup_name:
+ ng_contactgroup_name => $ng_contactgroup_name,
+ ng_contactgroup_alias => $ng_contactgroup_alias,
+ ng_contactgroup_members => $ng_contactgroup_members,
+ }
+ }
+}
+ |
+
confdroid_nagios::nagios::objects::add_hostgroup_rules.pp Module name: confdroid_nagios Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +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+ |
+
+ # File 'manifests/nagios/objects/add_hostgroup_rules.pp', line 12
+
+class confdroid_nagios::nagios::objects::add_hostgroup_rules (
+
+) inherits confdroid_nagios::params {
+ if $ng_nagios_server == $fqdn {
+ # manage /etc/nagios_conf.d/nagios_hostgroups_add.cfg
+
+ concat { $ng_tgt_hostgroup_add:
+ ensure => present,
+ path => $ng_tgt_hostgroup_add,
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_etc_t,
+ seluser => system_u,
+ notify => Service[$ng_service],
+ }
+
+ # manage file header
+
+ concat::fragment { 'hostgroups_header':
+ target => $ng_tgt_hostgroup_add,
+ content => template($ng_tgt_hostgrp_head_erb),
+ order => '000',
+ }
+
+ # add hostgroup rules through defines and parameters
+ confdroid_nagios::nagios::objects::add_hostgroups { $ng_hostgroup_name:
+ ng_hostgroup_name => $ng_hostgroup_name,
+ ng_hostgroup_alias => $ng_hostgroup_alias,
+ }
+ }
+}
+ |
+
confdroid_nagios::nagios::objects::add_servicegroup_rules.pp Module name: confdroid_nagios Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +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+ |
+
+ # File 'manifests/nagios/objects/add_servicegroup_rules.pp', line 12
+
+class confdroid_nagios::nagios::objects::add_servicegroup_rules (
+
+) inherits confdroid_nagios::params {
+ if $ng_nagios_server == $fqdn {
+ # manage /etc/nagios_conf.d/nagios_servicegroups_add.cfg
+
+ concat { $ng_tgt_servicegroup_add:
+ ensure => present,
+ path => $ng_tgt_servicegroup_add,
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_etc_t,
+ seluser => system_u,
+ notify => Service[$ng_service],
+ }
+
+ # manage file header
+
+ concat::fragment { 'servicegroups_header':
+ target => $ng_tgt_servicegroup_add,
+ content => template($ng_tgt_svcgrp_head_erb),
+ order => '000',
+ }
+ }
+}
+ |
+
+ + + +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 +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 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222+ |
+
+ # File 'manifests/nagios/objects/commands.pp', line 8
+
+class confdroid_nagios::nagios::objects::commands (
+
+) inherits confdroid_nagios::params {
+ if $ng_nagios_server == $fqdn {
+ @@nagios_command { 'notify-host-by-email':
+ ensure => present,
+ command_name => 'notify-host-by-email',
+ command_line => '/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTADDRESS$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTADDRESS$ is $HOSTSTATE$ **" $CONTACTEMAIL$',
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ target => $ng_target_command,
+ }
+
+ @@nagios_command { 'notify-service-by-email':
+ ensure => present,
+ command_name => 'notify-service-by-email',
+ command_line => '/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$',
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ target => $ng_target_command,
+ }
+
+ @@nagios_command { 'check-host-alive':
+ ensure => present,
+ command_name => 'check-host-alive',
+ command_line => '$USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5',
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ target => $ng_target_command,
+ }
+
+ @@nagios_command { 'check_disk':
+ ensure => present,
+ command_name => 'check_disk',
+ command_line => '$USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$',
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ target => $ng_target_command,
+ }
+
+ @@nagios_command { 'check_local_load':
+ ensure => present,
+ command_name => 'check_local_load',
+ command_line => '$USER1$/check_load -w $ARG1$ -c $ARG2$',
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ target => $ng_target_command,
+ }
+
+ @@nagios_command { 'check_local_procs':
+ ensure => present,
+ command_name => 'check_local_procs',
+ command_line => '$USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$',
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ target => $ng_target_command,
+ }
+
+ @@nagios_command { 'check_local_users':
+ ensure => present,
+ command_name => 'check_local_users',
+ command_line => '$USER1$/check_users -w $ARG1$ -c $ARG2$',
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ target => $ng_target_command,
+ }
+
+ @@nagios_command { 'check_local_swap':
+ ensure => present,
+ command_name => 'check_local_swap',
+ command_line => '$USER1$/check_swap -w $ARG1$ -c $ARG2$',
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ target => $ng_target_command,
+ }
+
+ @@nagios_command { 'check_ftp':
+ ensure => present,
+ command_name => 'check_ftp',
+ command_line => '$USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$',
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ target => $ng_target_command,
+ }
+
+ @@nagios_command { 'check_snmp':
+ ensure => present,
+ command_name => 'check_snmp',
+ command_line => '$USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$',
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ target => $ng_target_command,
+ }
+
+ @@nagios_command { 'check_http':
+ ensure => present,
+ command_name => 'check_http',
+ command_line => '$USER1$/check_http -I $HOSTADDRESS$ $ARG1$',
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ target => $ng_target_command,
+ }
+
+ @@nagios_command { 'check_ssh':
+ ensure => present,
+ command_name => 'check_ssh',
+ command_line => '$USER1$/check_ssh $ARG1$ $HOSTADDRESS$',
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ target => $ng_target_command,
+ }
+
+ @@nagios_command { 'check_ping':
+ ensure => present,
+ command_name => 'check_ping',
+ command_line => '$USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5',
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ target => $ng_target_command,
+ }
+
+ @@nagios_command { 'check_tcp':
+ ensure => present,
+ command_name => 'check_tcp',
+ command_line => '$USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$',
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ target => $ng_target_command,
+ }
+
+ @@nagios_command { 'check_udp':
+ ensure => present,
+ command_name => 'check_udp',
+ command_line => '$USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$',
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ target => $ng_target_command,
+ }
+
+ @@nagios_command { 'check_nrpe':
+ ensure => present,
+ command_name => 'check_nrpe',
+ command_line => '$USER1$/check_nrpe -t 30 -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$ $ARG3$ $ARG4$',
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ target => $ng_target_command,
+ }
+
+ @@nagios_command { 'check_nagios':
+ ensure => present,
+ command_name => 'check_nagios',
+ command_line => '$USER1$/check_nagios -F $ARG1$ -e $ARG2$ -C $ARG3$',
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ target => $ng_target_command,
+ }
+
+ @@nagios_command { 'check_bandwidth':
+ ensure => present,
+ command_name => 'check_bandwidth',
+ command_line => '$USER1$/check_bandwidth.sh -t 30 -H $HOSTADDRESS$ linux $ARG1$ $ARG2$ $ARG3$',
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ target => $ng_target_command,
+ }
+
+ @@nagios_command { 'process-service-perfdata-file':
+ ensure => present,
+ command_name => 'process-service-perfdata-file',
+ command_line => '/bin/mv /var/log/pnp4nagios/service-perfdata /var/spool/pnp4nagios/service-perfdata.$TIMET$',
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ target => $ng_target_command,
+ }
+
+ @@nagios_command { 'process-host-perfdata-file':
+ ensure => present,
+ command_name => 'process-host-perfdata-file',
+ command_line => '/bin/mv /var/log/pnp4nagios/host-perfdata /var/spool/pnp4nagios/host-perfdata.$TIMET$',
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ target => $ng_target_command,
+ }
+
+ @@nagios_command { 'check_ntp_time':
+ ensure => present,
+ command_name => 'check_ntp_time',
+ command_line => '$USER1$/check_ntp_time -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$',
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0640',
+ target => $ng_target_command,
+ }
+ }
+}
+ |
+
confdroid_nagios::nagios::resources::resource.pp Module name: confdroid_nagios Author: 12ww1160 (12ww1160@confdroid.com) }
+ +
+ + + +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+ |
+
+ # File 'manifests/nagios/resources/resource.pp', line 11
+
+class confdroid_nagios::nagios::resources::resource (
+
+) inherits confdroid_nagios::params {
+ if $ng_nagios_server == $fqdn {
+ concat { $ng_resource_file:
+ ensure => present,
+ owner => 'root',
+ group => 'nagios',
+ mode => '0640',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_etc_t,
+ seluser => system_u,
+ notify => Service[$ng_service],
+ }
+
+ concat::fragment { 'header':
+ target => $ng_resource_file,
+ content => template($ng_resource_erb),
+ order => '000',
+ }
+
+ # plugins rule
+
+ confdroid_nagios::nagios::resources::resource_df { 'user_rule_plugins':
+ ng_user_arg_name => 'USER1',
+ ng_user_arg_value => '/usr/lib64/nagios/plugins/',
+ ng_user_arg_comment => 'Sets user1 to be the path to the plugins',
+ }
+
+ # eventhandlers rule
+ confdroid_nagios::nagios::resources::resource_df { 'user_rule_eventhandlers':
+ ng_user_arg_name => 'USER2',
+ ng_user_arg_value => '/usr/lib64/nagios/plugins/eventhandlers/',
+ ng_user_arg_comment => 'Sets user2 to be the path to the eventhandlers',
+ }
+ }
+}
+ |
+
confdroid_nagios::params Module name: confdroid_nagios Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +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 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +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+ |
+
+ # File 'manifests/params.pp', line 105
+
+class confdroid_nagios::params (
+
+# main
+ String $ng_nagios_server = 'nagios.example.net',
+ Array $ng_reqpackages_server = ['nagios','nagios-devel'],
+ Array $ng_reqpackages_client = ['net-snmp-utils','nagios-plugins','nagios-plugins-all','nagios-plugins-nrpe','nagios-common'],
+ String $ng_pkg_ensure = 'present',
+ Boolean $ng_include_nrpe = true,
+ String $ng_main_user = 'nagios',
+ String $ng_main_password = 'nagios',
+ String $ng_max_check_attempts = '10',
+ String $ng_status_upd_interval = '10',
+ String $ng_check_ext_commands = '1',
+ String $ng_user = 'nagios',
+ Boolean $ng_enable_target = true,
+
+# contact groups
+ String $ng_contactgroup_name = 'admins',
+ String $ng_contactgroup_alias = 'Nagios Administrators',
+ String $ng_contactgroup_members = 'nagiosadmin',
+
+# contacts
+ String $ng_contact_name = 'nagiosadmin',
+ String $ng_contact_alias = 'Nagios Admin',
+ String $ng_contact_groups = 'admins',
+ String $ng_contact_email = 'nagiosadmin@example.net',
+
+# hostgroups
+ String $ng_hostgroup_name = 'linux-servers',
+ String $ng_hostgroup_alias = 'Linux Servers',
+
+# nagios.cfg
+ String $ng_log_file = '/var/log/nagios/nagios.log',
+
+# cgi.cfg
+ String $ng_context_help = '1',
+
+# httpd
+ Boolean $ng_use_https = false,
+
+# check command parameters
+## ping
+ String $ng_ping_warn = '100.0,20%',
+ String $ng_ping_crit = '500.0,60%',
+ String $ng_ping_ensure = 'present',
+## disk
+ String $ng_disk_warn = '20%',
+ String $ng_disk_crit = '10%' ,
+ String $ng_disk_ensure = 'present',
+# swap
+ String $ng_swap_warn = '20',
+ String $ng_swap_crit = '10',
+ String $ng_swap_ensure = 'present',
+# users
+ String $ng_users_warn = '20',
+ String $ng_users_crit = '50',
+ String $ng_users_ensure = 'present',
+#total procs
+ String $ng_procs_tot_warn = '330',
+ String $ng_procs_tot_crit = '400',
+ String $ng_procs_tot_param = 'RDST',
+ String $ng_procs_tot_ens = 'present',
+# zombie procs
+ String $ng_procs_z_warn = '10',
+ String $ng_procs_z_crit = '30',
+ String $ng_procs_z_param = 'Z',
+ String $ng_procs_z_ensure = 'present',
+# load
+ String $ng_load_warn = '5.00,4.00,3.00',
+ String $ng_load_crit = '10.00,6.00,4.00',
+ String $ng_load_ensure = 'present',
+
+# single nagios checks
+ Boolean $ng_enable_swap_check = true,
+
+) {
+# Default facts
+ $fqdn = $facts['networking']['fqdn']
+ $hostname = $facts['networking']['hostname']
+ $domain = $facts['networking']['domain']
+ $os_name = $facts['os']['name']
+ $os_release = $facts['os']['release']['major']
+
+# service
+ $ng_service = 'nagios'
+
+# 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"
+ $ng_run_dir = '/var/run/nagios'
+ $ng_cmd_dir = "${ng_spool_dir}/cmd"
+ $ng_checkresults_dir = "${ng_spool_dir}/checkresults"
+
+# files
+ $ng_nagios_cfg_file = "${ng_main_dir}/nagios.cfg"
+ $ng_nagios_cfg_erb = 'confdroid_nagios/nagios/nagios_cfg.erb'
+ $ng_cgi_cfg_file = "${ng_main_dir}/cgi.cfg"
+ $ng_cgi_cfg_erb = 'confdroid_nagios/nagios/cgi_cfg.erb'
+
+# nagios
+ $ng_target_templates = "${ng_conf_d_dir}/nagios_templates.cfg"
+ $ng_templates_head_erb = 'confdroid_nagios/nagios/templates_cfg_head.erb'
+ $ng_templates_rule_erb = 'confdroid_nagios/nagios/templates_cfg_rule.erb'
+ $ng_tgt_timeperiods_base = "${ng_conf_d_dir}/nagios_timeperiods.cfg"
+ $ng_tgt_timep_add = "${ng_conf_d_dir}/nagios_timeperiods.cfg"
+ $ng_tgt_timep_head_erb = 'confdroid_nagios/nagios/timeperiods_cfg_head.erb'
+ $ng_tgt_timep_rule_erb = 'confdroid_nagios/nagios/timeperiods_cfg_rule.erb'
+ $ng_target_localhost = "${ng_conf_d_dir}/nagios_localhost.cfg"
+ $ng_target_host = "${ng_conf_d_dir}/nagios_host.cfg"
+ $ng_target_hostgroup_base = "${ng_conf_d_dir}/nagios_hostgroups_base.cfg"
+ $ng_tgt_hostgroup_add = "${ng_conf_d_dir}/nagios_hostgroups.cfg"
+ $ng_tgt_hostgrp_head_erb = 'confdroid_nagios/nagios/hostgroups_cfg_head.erb'
+ $ng_tgt_hostgrp_rule_erb = 'confdroid_nagios/nagios/hostgroups_cfg_rule.erb'
+ $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_svcgrp_base = "${ng_conf_d_dir}/nagios_servicegroups_base.cfg"
+ $ng_tgt_servicegroup_add = "${ng_conf_d_dir}/nagios_servicegroups.cfg"
+ $ng_tgt_svcgrp_head_erb = 'confdroid_nagios/nagios/svcgroups_cfg_head.erb'
+ $ng_tgt_svcgrp_rule_erb = 'confdroid_nagios/nagios/svcgroups_cfg_rule.erb'
+ $ng_target_base_contact = "${ng_conf_d_dir}/nagios_contact_base.cfg"
+ $ng_target_add_contact = "${ng_conf_d_dir}/nagios_contact_add.cfg"
+ $ng_contacts_head_erb = 'confdroid_nagios/nagios/contacts_cfg_head.erb'
+ $ng_contacts_rule_erb = 'confdroid_nagios/nagios/contacts_cfg_rule.erb'
+ $ng_tgt_contactgroup_base = "${ng_conf_d_dir}/nagios_contactgroup_base.cfg"
+ $ng_tgt_contactgroup_add = "${ng_conf_d_dir}/nagios_contactgroup.cfg"
+ $ng_cntctgrps_head_erb = 'confdroid_nagios/nagios/contactgroups_cfg_head.erb'
+ $ng_cntctgrps_rule_erb = 'confdroid_nagios/nagios/contactgroups_cfg_rule.erb'
+ $ng_target_command = "${ng_conf_d_dir}/nagios_commands_base.cfg"
+ $ng_service_cmd = 'check_nagios!/var/log/nagios/status.dat!5!/usr/sbin/nagios'
+ $ng_htpasswd_file = "${ng_main_dir}/passwd"
+ $ng_htpasswd_head = 'confdroid_nagios/nagios/htpasswd_head.erb'
+ $ng_htpasswd_rule = 'confdroid_nagios/nagios/htpasswd_rule.erb'
+ $ng_resource_file = "${ng_private_dir}/resource.cfg"
+ $ng_resource_erb = 'confdroid_nagios/nagios/resource_cfg.erb'
+ $ng_object_cache_file = "${ng_spool_dir}/objects.cache"
+ $ng_precached_obj_file = "${ng_spool_dir}/objects.precache"
+ $ng_status_file = "${ng_log_dir}/status.dat"
+
+## old
+ $ng_taccgi_erb = 'confdroid_nagios/selinux/taccgi.erb'
+ $ng_statcgi_erb = 'confdroid_nagios/selinux/statuscgi.erb'
+ $ng_statdat_erb = 'confdroid_nagios/selinux/statusdat.erb'
+ $ng_checknrpe_erb = 'confdroid_nagios/selinux/checknrpe.erb'
+ $ng_checknagios_erb = 'confdroid_nagios/selinux/checknagios.erb'
+ $ng_nagios_conf = '/etc/httpd/conf.d/nagios.conf'
+ $ng_nagios_conf_erb = 'confdroid_nagios/httpd/nagios_conf.erb'
+ $ng_welcome_conf = '/etc/httpd/conf.d/welcome.conf'
+ $ng_welcome_conf_erb = 'confdroid_nagios/httpd/welcome_conf.erb'
+ $ng_forward_conf = '/etc/httpd/conf.d/nagios_forward.conf'
+ $ng_forward_conf_erb = 'confdroid_nagios/httpd/forward_conf.erb'
+ $ng_get_cert_erb = 'confdroid_nagios/certbot/get_cert.erb'
+ $ng_unless_get_cert = 'confdroid_nagios/certbot/unless_get_cert.erb'
+ $ng_unless_renew_erb = 'confdroid_nagios/certbot/unless_renew_cert.erb'
+ $ng_index_html_file = '/var/www/html/index.html'
+ $ng_index_html_erb = 'confdroid_nagios/httpd/index_html.erb'
+ $ng_ssl_vhost_file = '/etc/httpd/conf.d/nagios_ssl.conf'
+ $ng_ssl_vhost_erb = 'confdroid_nagios/httpd/nagios_ssl_vhost.erb'
+ $ng_grep_erb = 'confdroid_nagios/selinux/grep.erb'
+
+# includes must be last
+ include confdroid_nagios::main::config
+}
+ |
+
confdroid_nagios::server::access_rules.pp Module name: confdroid_nagios Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +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+ |
+
+ # File 'manifests/server/access_rules.pp', line 6
+
+class confdroid_nagios::server::access_rules (
+
+) inherits confdroid_nagios::params {
+ if $fqdn == $ng_nagios_server {
+ # manage /etc/nagios/passwd 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 => Exec['ng_restart_httpd'],
+ }
+
+ # manage file header
+ concat::fragment { 'fle_header':
+ target => $ng_htpasswd_file,
+ content => template($ng_htpasswd_head),
+ order => '000',
+ }
+ }
+}
+ |
+
confdroid_nagios::server::files.pp Module name: confdroid_nagios Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20+ |
+
+ # File 'manifests/server/files.pp', line 6
+
+class confdroid_nagios::server::files (
+
+) inherits confdroid_nagios::params {
+ require confdroid_nagios::main::dirs
+ if $ng_nagios_server == $fqdn {
+ file { $ng_nagios_cfg_file:
+ ensure => file,
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0644',
+ content => template($ng_nagios_cfg_erb),
+ notify => Service[$ng_service],
+ }
+ }
+}
+ |
+
confdroid_nagios::server::nagios.pp Module name: confdroid_nagios Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +6 +7 +8 +9 +10+ |
+
+ # File 'manifests/server/nagios.pp', line 6
+
+class confdroid_nagios::server::nagios (
+
+) inherits confdroid_nagios::params {
+ # config here
+}
+ |
+
confdroid_nagios::server::service.pp Module name: confdroid_nagios Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +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 +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 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201+ |
+
+ # File 'manifests/server/service.pp', line 6
+
+class confdroid_nagios::server::service (
+
+) inherits confdroid_nagios::params {
+ require confdroid_nagios::server::files
+ if $ng_nagios_server == $fqdn {
+ require confdroid_nagios::server::access_rules
+ require confdroid_nagios::nagios::config
+
+ exec { 'ng_restart_httpd':
+ command => 'systemctl restart httpd',
+ path => ['/bin', '/usr/bin', '/sbin', '/usr/sbin'],
+ refreshonly => true,
+ }
+
+ service { $ng_service:
+ ensure => running,
+ name => $ng_service,
+ enable => true,
+ hasrestart => true,
+ hasstatus => true,
+ require => Exec['ng_restart_httpd'],
+ }
+
+ @@nagios_host { 'localhost':
+ ensure => $ng_ping_ensure,
+ alias => 'localhost',
+ address => '127.0.0.1',
+ use => 'linux-server',
+ target => $ng_target_localhost,
+ hostgroups => 'linux-servers',
+ contacts => 'ops',
+ max_check_attempts => $ng_max_check_attempts,
+ notification_period => '24x7',
+ owner => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ check_command => "check_ping!${ng_ping_warn}!${ng_ping_crit}",
+ notify => Service[$ng_service],
+ }
+
+ @@nagios_service { 'check_nagios_localhost':
+ check_command => $ng_service_cmd,
+ use => 'generic-service',
+ host_name => 'localhost',
+ notification_period => '24x7',
+ service_description => 'localhost_nagios_service',
+ target => $ng_target_service,
+ owner => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ contacts => 'ops',
+ }
+
+ @@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 => $ng_max_check_attempts,
+ notification_period => '24x7',
+ owner => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ check_command => "check_ping!${ng_ping_warn}!${ng_ping_crit}",
+ notify => Service[$ng_user],
+ }
+
+ @@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 => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ }
+
+ if $ng_enable_swap_check == true {
+ @@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 => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ }
+ }
+
+ @@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 => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ }
+
+ @@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 => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ }
+
+ @@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 => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ }
+
+ @@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 => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ }
+
+ 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'] }
+ }
+}
+ |
+
confdroid_nagios::nagios::objects::add_contact.pp Module name: confdroid_nagios Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39+ |
+
+ # File 'manifests/nagios/objects/add_contact.pp', line 19
+
+define confdroid_nagios::nagios::objects::add_contact (
+
+ Optional[String] $ng_contact_name = undef,
+ String $ng_contact_use = 'generic-contact',
+ Optional[String] $ng_contact_alias = undef,
+ Optional[String] $ng_contact_email = undef,
+ Optional[String] $ng_contact_groups = undef,
+
+) {
+ $ng_nagios_server = $confdroid_nagios::params::ng_nagios_server
+ $ng_target_add_contact = $confdroid_nagios::params::ng_target_add_contact
+ $ng_contacts_rule_erb = $confdroid_nagios::params::ng_contacts_rule_erb
+ $fqdn = $facts['networking']['fqdn']
+
+ if $ng_nagios_server == $fqdn {
+ concat::fragment { $name:
+ target => $ng_target_add_contact,
+ content => template($ng_contacts_rule_erb),
+ }
+ }
+}
+ |
+
confdroid_nagios::nagios::objects::add_contactgroups.pp Module name: confdroid_nagios Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34+ |
+
+ # File 'manifests/nagios/objects/add_contactgroups.pp', line 15
+
+define confdroid_nagios::nagios::objects::add_contactgroups (
+
+ Optional[String] $ng_contactgroup_name = undef,
+ Optional[String] $ng_contactgroup_alias = undef,
+ Optional[String] $ng_contactgroup_members = undef,
+ String $ng_contactgroup_register = '1',
+
+) {
+ $ng_nagios_server = $confdroid_nagios::params::ng_nagios_server
+ $ng_tgt_contactgroup_add = $confdroid_nagios::params::ng_tgt_contactgroup_add
+ $ng_cntctgrps_rule_erb = $confdroid_nagios::params::ng_cntctgrps_rule_erb
+ $fqdn = $facts['networking']['fqdn']
+
+ if $ng_nagios_server == $fqdn {
+ concat::fragment { $name:
+ target => $ng_tgt_contactgroup_add,
+ content => template($ng_cntctgrps_rule_erb),
+ }
+ }
+}
+ |
+
confdroid_nagios::nagios::objects::add_hostgroups.pp Module name: confdroid_nagios Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33+ |
+
+ # File 'manifests/nagios/objects/add_hostgroups.pp', line 15
+
+define confdroid_nagios::nagios::objects::add_hostgroups (
+
+ Optional[String] $ng_hostgroup_name = undef,
+ Optional[String] $ng_hostgroup_alias = undef,
+ String $ng_hostgroup_register = '1',
+
+) {
+ $ng_nagios_server = $confdroid_nagios::params::ng_nagios_server
+ $ng_tgt_hostgroup_add = $confdroid_nagios::params::ng_tgt_hostgroup_add
+ $ng_tgt_hostgrp_rule_erb = $confdroid_nagios::params::ng_tgt_hostgrp_rule_erb
+ $fqdn = $facts['networking']['fqdn']
+
+ if $ng_nagios_server == $fqdn {
+ concat::fragment { $name:
+ target => $ng_tgt_hostgroup_add,
+ content => template($ng_tgt_hostgrp_rule_erb),
+ }
+ }
+}
+ |
+
confdroid_nagios::nagios::objects::add_servicegroups.pp Module name: confdroid_nagios Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36+ |
+
+ # File 'manifests/nagios/objects/add_servicegroups.pp', line 18
+
+define confdroid_nagios::nagios::objects::add_servicegroups (
+
+ Optional[String] $ng_servicegroup_name = undef,
+ Optional[String] $ng_servicegroup_alias = undef,
+ String $ng_servicegroup_register = '1',
+
+) {
+ $ng_nagios_server = $confdroid_nagios::params::ng_nagios_server
+ $ng_tgt_servicegroup_add = $confdroid_nagios::params::ng_tgt_servicegroup_add
+ $ng_tgt_svcgrp_rule_erb = $confdroid_nagios::params::ng_tgt_svcgrp_rule_erb
+ $fqdn = $facts['networking']['fqdn']
+
+ if $ng_nagios_server == $fqdn {
+ concat::fragment { $name:
+ target => $ng_tgt_servicegroup_add,
+ content => template($ng_tgt_svcgrp_rule_erb),
+ }
+ }
+}
+ |
+
confdroid_nagios::nagios::resources::resource_df.pp Module name: confdroid_nagios Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29+ |
+
+ # File 'manifests/nagios/resources/resource_df.pp', line 10
+
+define confdroid_nagios::nagios::resources::resource_df (
+
+ Optional[String] $ng_user_arg_name = undef,
+ Optional[String] $ng_user_arg_value = undef,
+ Optional[String] $ng_user_arg_comment = undef,
+ String $ng_resource_rule_erb = 'confdroid_nagios/nagios/resource_cfg_rule.erb',
+
+) {
+ $ng_nagios_server = $confdroid_nagios::params::ng_nagios_server
+ $ng_resource_file = $confdroid_nagios::params::ng_resource_file
+ $fqdn = $facts['networking']['fqdn']
+
+ if $ng_nagios_server == $fqdn {
+ concat::fragment { "rule_${name}":
+ target => $ng_resource_file,
+ content => template($ng_resource_rule_erb),
+ order => '000',
+ }
+ }
+}
+ |
+
confdroid_nagios::server::access.pp Module name: confdroid_nagios Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29+ |
+
+ # File 'manifests/server/access.pp', line 13
+
+define confdroid_nagios::server::access (
+ Optional[String] $ng_htpasswd_user = undef,
+ Optional[String] $ng_htpasswd_password = undef,
+) {
+ $ng_nagios_server = $confdroid_nagios::params::ng_nagios_server
+ $ng_htpasswd_file = $confdroid_nagios::params::ng_htpasswd_file
+ $ng_htpasswd_rule = $confdroid_nagios::params::ng_htpasswd_rule
+ $ng_service = $confdroid_nagios::params::ng_service
+
+ if $fqdn == $ng_nagios_server {
+ # create password rules
+ concat::fragment { $name:
+ target => $ng_htpasswd_file,
+ content => template($ng_htpasswd_rule),
+ }
+ }
+}
+ |
+