Documentation by YARD 0.9.36
+Alphabetic Index
+ +Puppet Class Listing A-Z
+ + +Defined Type Listing A-Z
+ + +
+
+
+
|
+
File Listing
+-
+
+
+
- README + + +
diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index c880235..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,127 +0,0 @@ -pipeline { - agent { - label 'puppet' - } - - post { - always { - deleteDir() /* clean up our workspace */ - } - success { - updateGitlabCommitStatus state: 'success' - } - failure { - updateGitlabCommitStatus state: 'failed' - step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'support@confdroid.com', sendToIndividuals: true]) - } - } - - options { - gitLabConnection('gitlab.confdroid.com') - } - - stages { - - stage('pull master') { - steps { - sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) { - sh ''' - git config user.name "Jenkins Server" - git config user.email jenkins@confdroid.com - # Ensure we're on the development branch (triggered by push) - git checkout development - # Create jenkins branch from development - git checkout -b jenkins-build-$BUILD_NUMBER - # Optionally merge master into jenkins to ensure compatibility - git merge origin/master --no-ff || { echo "Merge conflict detected"; exit 1; } - ''' - } - } - } - - stage('puppet parser') { - steps { - sh '''for file in $(find . -iname \'*.pp\'); do - /opt/puppetlabs/bin/puppet parser validate --color false --render-as s --modulepath=modules $file || exit 1; - done;''' - } - } - - stage('check templates') { - steps{ - sh '''for file in $(find . -iname \'*.erb\'); - do erb -P -x -T "-" $file | ruby -c || exit 1; - done;''' - } - } - - stage('puppet-lint') { - steps { - sh '''/usr/local/bin/puppet-lint . \\ - --no-variable_scope-check \\ - || { echo "Puppet lint failed"; exit 1; } - ''' - } - } - - stage('SonarScan') { - steps { - withCredentials([string(credentialsId: 'sonar-token', variable: 'SONAR_TOKEN')]) { - sh ''' - /opt/sonar-scanner/bin/sonar-scanner \ - -Dsonar.projectKey=confdroid_nagios \ - -Dsonar.sources=. \ - -Dsonar.host.url=https://sonarqube.confdroid.com \ - -Dsonar.token=$SONAR_TOKEN - ''' - } - } - } - - stage('create Puppet documentation') { - steps { - sh '/opt/puppetlabs/bin/puppet strings' - } - } - - stage('update repo') { - steps { - sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) { - sh ''' - git config user.name "Jenkins Server" - git config user.email jenkins@confdroid.com - git rm -r --cached .vscode || echo "No .vscode to remove from git" - git add -A && git commit -am "Recommit for updates in build $BUILD_NUMBER" || echo "No changes to commit" - git push origin HEAD:master - ''' - } - } - } - - stage('Mirror to Gitea') { - steps { - withCredentials([usernamePassword( - credentialsId: 'Jenkins-gitea', - usernameVariable: 'GITEA_USER', - passwordVariable: 'GITEA_TOKEN')]) { - script { - // Checkout from GitLab (already done implicitly) - sh ''' - git checkout master - git pull origin master - git branch -D development - git branch -D jenkins-build-$BUILD_NUMBER - git rm -f Jenkinsfile - git rm -r --cached .vscode || echo "No .vscode to remove from git" - git commit --amend --no-edit --allow-empty - git remote add master https://sourcecode.confdroid.com/confdroid/confdroid_nagios.git - git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \ - push master --mirror - ''' - } - } - } - } - } -} - diff --git a/doc/_index.html b/doc/_index.html new file mode 100644 index 0000000..832c363 --- /dev/null +++ b/doc/_index.html @@ -0,0 +1,267 @@ + + +
+ + +
+
+
+
|
+
| 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 +124 +125 +126 +127 +128+ |
+
+ # 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) {
+ 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
+ }
+
+ @@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 => $ng_user,
+ group => $ng_user,
+ 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 => $ng_user,
+ group => $ng_user,
+ 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 => $ng_user,
+ group => $ng_user,
+ 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 => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ }
+
+ @@nagios_service { "Total Processes_${fqdn}":
+ ensure => $ng_procs_tot_ensure,
+ 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 => $ng_user,
+ group => $ng_user,
+ 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 => $ng_user,
+ group => $ng_user,
+ 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 => $ng_user,
+ group => $ng_user,
+ 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 +15 +16 +17 +18 +19 +20+ |
+
+ # 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
+ }
+
+ if $ng_enable_target == true {
+ include confdroid_nagios::client::target
+ }
+
+ if $ng_enable_fail2ban == true {
+ include confdroid_nagios::monitoring::fail2ban
+ }
+}
+ |
+
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+ |
+
+ # 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 $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::monitoring::fail2ban.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+ |
+
+ # File 'manifests/monitoring/fail2ban.pp', line 6
+
+class confdroid_nagios::monitoring::fail2ban (
+
+) inherits confdroid_nagios::params {
+ # we want to create a nagios jail here
+ if ($ng_nagios_server == $fqdn) and ($ng_enable_fail2ban == true) {
+ require confdroid_fail2ban
+
+ # create the jail file
+ file { $fn_jail_file:
+ ensure => file,
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ selrange => s0,
+ selrole => object_r,
+ seltype => etc_t,
+ seluser => system_u,
+ content => template('confdroid_nagios/fail2ban/jail.conf.erb'),
+ notify => Service['fail2ban'],
+ }
+
+ # create the filter rule
+ file { $fn_filter_file:
+ ensure => file,
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ selrange => s0,
+ selrole => object_r,
+ seltype => etc_t,
+ seluser => system_u,
+ content => template('confdroid_nagios/fail2ban/filter.conf.erb'),
+ notify => Service['fail2ban'],
+ }
+ }
+}
+ |
+
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 +40 +41 +42 +43 +44 +45+ |
+
+ # 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',
+ }
+
+ # add default servicegroup rules through defines and parameters
+ confdroid_nagios::nagios::objects::add_servicegroups { $ng_servicegroup_name:
+ ng_servicegroup_name => $ng_servicegroup_name,
+ ng_servicegroup_alias => $ng_servicegroup_alias,
+ }
+ }
+}
+ |
+
confdroid_nagios::nagios::objects::add_timeperiod_rules.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 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58+ |
+
+ # File 'manifests/nagios/objects/add_timeperiod_rules.pp', line 18
+
+class confdroid_nagios::nagios::objects::add_timeperiod_rules (
+
+) inherits confdroid_nagios::params {
+ if $ng_nagios_server == $fqdn {
+ # manage /etc/nagios/conf.d/nagios_timeperiods_add.cfg
+
+ concat { $ng_tgt_timep_add:
+ ensure => present,
+ path => $ng_tgt_timep_add,
+ owner => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_etc_t,
+ seluser => system_u,
+ notify => Service[$ng_service],
+ }
+
+ # manage file header
+
+ concat::fragment { 'timeperiods_header':
+ target => $ng_tgt_timep_add,
+ content => template($ng_tgt_timep_head_erb),
+ order => '000',
+ }
+
+ # default timeperiod rule 24x7
+ confdroid_nagios::nagios::objects::add_timeperiods { '24x7':
+ ng_timep_name => '24x7',
+ ng_timep_alias => '24x7',
+ ng_timep_monday => '00:00-24:00',
+ ng_timep_tuesday => '00:00-24:00',
+ ng_timep_wednesday => '00:00-24:00',
+ ng_timep_thursday => '00:00-24:00',
+ ng_timep_friday => '00:00-24:00',
+ ng_timep_saturday => '00:00-24:00',
+ ng_timep_sunday => '00:00-24:00',
+ }
+ }
+}
+ |
+
+ + + +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 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232+ |
+
+ # 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 => $ng_user,
+ group => $ng_user,
+ 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 => $ng_user,
+ group => $ng_user,
+ 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 => $ng_user,
+ group => $ng_user,
+ 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 => $ng_user,
+ group => $ng_user,
+ 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 => $ng_user,
+ group => $ng_user,
+ 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 => $ng_user,
+ group => $ng_user,
+ 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 => $ng_user,
+ group => $ng_user,
+ 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 => $ng_user,
+ group => $ng_user,
+ 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 => $ng_user,
+ group => $ng_user,
+ 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 => $ng_user,
+ group => $ng_user,
+ 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 => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ target => $ng_target_command,
+ }
+
+ @@nagios_command { 'check_ssh':
+ ensure => present,
+ command_name => 'check_ssh',
+ command_line => '$USER1$/check_ssh $ARG1$ $HOSTADDRESS$',
+ owner => $ng_user,
+ group => $ng_user,
+ 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 => $ng_user,
+ group => $ng_user,
+ 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 => $ng_user,
+ group => $ng_user,
+ 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 => $ng_user,
+ group => $ng_user,
+ 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 => $ng_user,
+ group => $ng_user,
+ 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 => $ng_user,
+ group => $ng_user,
+ 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 => $ng_user,
+ group => $ng_user,
+ 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 => $ng_user,
+ group => $ng_user,
+ 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 => $ng_user,
+ group => $ng_user,
+ 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 => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ target => $ng_target_command,
+ }
+
+ @@nagios_command { 'check_fail2ban':
+ ensure => present,
+ command_name => 'check_fail2ban',
+ command_line => '$USER1$/check_procs -c $ARG1$ -C $ARG2$',
+ owner => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ target => $ng_target_command,
+ }
+ }
+}
+ |
+
confdroid_nagios::nagios::objects::template_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 +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+ |
+
+ # File 'manifests/nagios/objects/template_rules.pp', line 12
+
+class confdroid_nagios::nagios::objects::template_rules (
+
+) inherits confdroid_nagios::params {
+ if $ng_nagios_server == $fqdn {
+ # create the templates.cfg file
+
+ concat { $ng_target_templates:
+ ensure => present,
+ path => $ng_target_templates,
+ owner => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_etc_t,
+ seluser => system_u,
+ notify => Service[$ng_service],
+ }
+
+ concat::fragment { 'template_header':
+ target => $ng_target_templates,
+ content => template($ng_templates_head_erb),
+ order => '000',
+ }
+
+ # basic templates
+ confdroid_nagios::nagios::objects::templates { 'generic contact':
+ ng_template_object => 'contact',
+ ng_template_object_name => 'generic-contact',
+ }
+ confdroid_nagios::nagios::objects::templates { 'generic-host':
+ ng_template_object => 'host',
+ ng_template_object_name => 'generic-host',
+ }
+ confdroid_nagios::nagios::objects::templates { 'linux-server':
+ ng_template_object => 'host',
+ ng_template_object_name => 'linux-server',
+ ng_template_object_use => 'generic-host',
+ ng_notification_options => 'd,u,r',
+ }
+ confdroid_nagios::nagios::objects::templates { 'windows-server':
+ ng_template_object => 'host',
+ ng_template_object_name => 'windows-server',
+ ng_template_object_use => 'generic-host',
+ ng_notification_options => 'd,u,r',
+ }
+ confdroid_nagios::nagios::objects::templates { 'generic-switch':
+ ng_template_object => 'host',
+ ng_template_object_name => 'generic-switch',
+ ng_template_object_use => 'generic-host',
+ ng_notification_options => 'd,u,r',
+ }
+ confdroid_nagios::nagios::objects::templates { 'generic-printer':
+ ng_template_object => 'host',
+ ng_template_object_name => 'generic-printer',
+ ng_template_object_use => 'generic-host',
+ ng_notification_options => 'd,u,r',
+ }
+ confdroid_nagios::nagios::objects::templates { 'generic-service':
+ ng_template_object => 'service',
+ ng_template_object_name => 'generic-service',
+ ng_max_check_attempts => '3',
+ ng_notification_options => 'w,u,c,r',
+ }
+ confdroid_nagios::nagios::objects::templates { 'local-service':
+ ng_template_object => 'service',
+ ng_template_object_name => 'local-service',
+ ng_max_check_attempts => '4',
+ ng_template_object_use => 'generic-service',
+ }
+ }
+}
+ |
+
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) @param [String] ng_use_ssl_auth Whether to use SSL authentication in Nagios. Default is ‘0’.
+ +
+ + + +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 +612 +613 +614 +615 +616 +617 +618 +619 +620 +621 +622 +623 +624 +625 +626 +627 +628 +629 +630 +631 +632 +633 +634 +635 +636 +637 +638 +639 +640 +641 +642 +643 +644 +645 +646 +647 +648 +649 +650 +651 +652 +653 +654 +655 +656 +657 +658 +659 +660 +661 +662 +663 +664 +665 +666 +667 +668 +669 +670 +671 +672 +673 +674 +675 +676 +677 +678 +679 +680 +681 +682 +683 +684 +685 +686 +687 +688 +689 +690 +691 +692 +693 +694 +695 +696 +697 +698 +699 +700 +701 +702 +703 +704 +705 +706 +707 +708 +709 +710 +711 +712 +713 +714 +715 +716 +717 +718 +719 +720 +721 +722 +723 +724 +725 +726 +727 +728 +729 +730 +731 +732 +733 +734 +735 +736 +737 +738 +739 +740 +741 +742 +743 +744 +745 +746 +747 +748 +749 +750 +751 +752 +753 +754 +755 +756 +757 +758 +759 +760 +761 +762 +763 +764 +765 +766 +767 +768 +769 +770 +771 +772 +773 +774 +775 +776 +777 +778 +779 +780 +781 +782 +783 +784 +785 +786 +787 +788 +789 +790 +791 +792 +793 +794 +795 +796+ |
+
+ # File 'manifests/params.pp', line 449
+
+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,
+ Boolean $ng_purge_target = true,
+ Boolean $ng_use_lb = false,
+ String $ng_trusted_proxy = '10.0.0.10',
+
+# 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',
+
+# servicegroups
+ String $ng_servicegroup_name = 'linux-services',
+ String $ng_servicegroup_alias = 'Linux Services',
+
+# nagios.cfg
+ String $ng_log_file = '/var/log/nagios/nagios.log',
+ String $ng_event_broker_options = '-1',
+ Boolean $ng_enable_query_handler = false,
+ Array $ng_event_broker_module = [],
+ String $ng_log_rotation_method = 'd',
+ String $ng_use_syslog = '1',
+ String $ng_log_notifications = '1',
+ String $ng_log_service_retries = '1',
+ String $ng_log_host_retries = '1',
+ String $ng_log_event_handlers = '1',
+ String $ng_log_initial_states = '0',
+ String $ng_log_current_states = '1',
+ String $ng_log_external_commands = '1',
+ String $ng_log_passive_checks = '1',
+ Array $ng_glob_host_evt_handler = [],
+ Array $ng_glob_svc_evt_handler = [],
+ String $ng_svc_int_check_delay = 's',
+ String $ng_max_svc_check_spread = '30',
+ String $ng_svc_interleave_factor = 's',
+ String $ng_host_int_check_delay = 's',
+ String $ng_max_host_check_spread = '30',
+ String $ng_max_concurrent_checks = '0',
+ String $ng_check_res_reaper_freq = '10',
+ String $ng_max_check_res_reap_time = '30',
+ String $ng_max_check_res_file_age = '3600',
+ String $ng_cached_h_check_horizon = '15',
+ String $ng_cached_s_check_horizon = '15',
+ String $ng_pred_host_dep_checks = '1',
+ String $ng_pred_svc_dep_checks = '1',
+ String $ng_soft_state_dependencies = '0',
+ String $ng_time_change_threshold = '900',
+ String $ng_auto_reschedule_checks = '1',
+ String $ng_auto_reschedule_intval = '30',
+ String $ng_auto_reschedule_window = '180',
+ String $ng_service_check_timeout = '60',
+ String $ng_host_check_timeout = '30',
+ String $ng_event_handler_timeout = '30',
+ String $ng_notification_timeout = '30',
+ String $ng_ocsp_timeout = '5',
+ String $ng_ochp_timeout = '5',
+ String $ng_perfdata_timeout = '5',
+ String $ng_retain_state_inf = '1',
+ String $ng_retention_update_intval = '60',
+ String $ng_use_ret_program_state = '1',
+ String $ng_use_ret_scheduling_info = '1',
+ String $ng_ret_host_attr_mask = '0',
+ String $ng_ret_service_attr_mask = '0',
+ String $ng_ret_proc_host_attr_mask = '0',
+ String $ng_ret_proc_svc_attr_mask = '0',
+ String $ng_ret_contact_h_attr_mask = '0',
+ String $ng_ret_contact_s_attr_mask = '0',
+ String $ng_interval_length = '60',
+ String $ng_check_for_updates = '1',
+ String $ng_bare_update_check = '1',
+ String $ng_use_aggr_host_checking = '0',
+ String $ng_execute_service_checks = '1',
+ String $ng_accept_pass_svc_checks = '1',
+ String $ng_execute_host_checks = '1',
+ String $ng_accept_pass_host_checks = '1',
+ String $ng_enable_notifications = '1',
+ String $ng_enable_event_handlers = '1',
+ String $ng_process_perf_data = '0',
+ String $ng_host_perfdata_command = 'process-host-perfdata',
+ String $ng_svc_perfdata_command = 'process-service-perfdata',
+ String $ng_host_perfdata_template = '[HOSTPERFDATA]\t$TIMET$\t$HOSTNAME$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$',
+ String $ng_svc_perfdata_template = '[SERVICEPERFDATA]\t$TIMET$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICEEXECUTIONTIME$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$',
+ String $ng_host_perfdata_file_mode = 'a',
+ String $ng_svc_perfdata_file_mode = 'a',
+ String $ng_h_perfdata_proc_intval = '0',
+ String $ng_s_perfdata_proc_intval = '0',
+ String $ng_h_perfdata_proc_cmd = 'process-host-perfdata',
+ String $ng_s_perfdata_proc_cmd = 'process-service-perfdata',
+ String $ng_h_perfdata_proc_e_result = '0',
+ String $ng_s_perfdata_proc_e_result = '0',
+ String $ng_obsess_over_services = '0',
+ String $ng_ocsp_command = 'somecommand',
+ String $ng_obsess_over_hosts = '0',
+ String $ng_ochp_command = 'somecommand',
+ String $ng_translate_pass_h_checks = '0',
+ String $ng_pass_h_checks_are_soft = '0',
+ String $ng_check_orphaned_svc = '1',
+ String $ng_check_orphaned_hosts = '1',
+ String $ng_check_service_freshness = '1',
+ String $ng_svc_fresh_check_intval = '60',
+ String $ng_svc_check_timeout_state = 'c',
+ String $ng_check_host_freshness = '1',
+ String $ng_host_fresh_check_intval = '60',
+ String $ng_add_freshness_latency = '15',
+ String $ng_enable_flap_detection = '1',
+ String $ng_low_svc_flap_threshold = '5.0',
+ String $ng_high_svc_flap_threshold = '20.0',
+ String $ng_low_h_flap_threshold = '5.0',
+ String $ng_high_h_flap_threshold = '20.0',
+ String $ng_date_format = 'euro',
+ Boolean $ng_use_timezone_offset = false,
+ String $ng_use_timezone = 'UTC',
+ String $ng_illegal_obj_name_chars = '~!$%^&*|\'"<>?,()=',
+ String $ng_ill_macro_output_chars = '`~$&|\'"<>',
+ String $ng_use_regexp_matching = '0',
+ String $ng_true_regexp_matching = '0',
+ String $ng_mail_user = 'nagios@localhost',
+ String $ng_page_user = 'nagios@localhost',
+ String $ng_daemon_dumps_core = '0',
+ String $ng_use_large_inst_tweaks = '0',
+ String $ng_enable_env_macros = '0',
+ String $ng_free_child_process_mem = '1',
+ String $ng_child_proc_fork_twice = '1',
+ String $ng_debug_level = '0',
+ String $ng_debug_verbosity = '1',
+ String $ng_max_debug_file_size = '1000000',
+ String $ng_allow_empty_hostgroups = '1',
+ String $ng_check_workers = '3',
+ String $ng_host_down_svc_checks = '0',
+ String $ng_svc_skip_chk_dep_status = '-1',
+ String $ng_svc_skip_chk_par_status = '-1',
+ String $ng_svc_skip_chk_par_h_d_sts = '-1',
+ String $ng_host_skip_chk_dep_status = '-1',
+ Boolean $ng_enable_load_ctl_options = false,
+ String $ng_load_ctl_options = 'jobs_max=100;backoff_limit=10;rampup_change=5',
+
+# cgi.cfg
+ String $ng_context_help = '1',
+ String $ng_pending_states = '1',
+ String $ng_use_auth = '1',
+ String $ng_use_ssl_auth = '0',
+ Boolean $ng_enable_def_user = false,
+ String $ng_def_user_name = 'ChangeME',
+ Optional[String] $ng_sysinfo_auth = undef,
+ Optional[String] $ng_confinfo_auth = undef,
+ Optional[String] $ng_command_auth = undef,
+ Optional[String] $ng_hostview_auth = undef,
+ Optional[String] $ng_serviceview_auth = undef,
+ Optional[String] $ng_host_cmd_auth = undef,
+ Optional[String] $ng_svc_cmd_auth = undef,
+ Optional[String] $ng_readonly_auth = undef,
+ Optional[String] $ng_statusmap_img = undef,
+ Boolean $ng_use_colormap = false,
+ String $ng_colormap_red = '255',
+ String $ng_colormap_green = '255',
+ String $ng_colormap_blue = '255',
+ String $ng_statusmap_layout = '6',
+ String $ng_wrl_layout = '4',
+ Boolean $ng_incl_own_wrl = false,
+ Optional[String] $ng_statuswrl_incl = undef,
+ String $ng_ping_syntax = '/bin/ping -n -U -c 5 $HOSTADDRESS$',
+ String $ng_refresh_rate = '90',
+ String $ng_enable_page_tour = '1',
+ String $ng_result_limit = '100',
+ String $ng_escape_html_tags = '1',
+ Boolean $ng_use_sound = false,
+ String $ng_host_unreachable = 'hostdown.wav',
+ String $ng_host_down = 'hostdown.wav',
+ String $ng_svc_critical = 'critical.wav',
+ String $ng_svc_warn = 'warning.wav',
+ String $ng_svc_unknown = 'warning.wav',
+ String $ng_normal_sound = 'noproblem.wav',
+ String $ng_action_url_target = '_blank',
+ String $ng_notes_url_target = '_blank',
+ String $ng_lock_author_names = '1',
+ Boolean $ng_enable_splunk = false,
+ String $ng_splunk_url = 'https://splunk.example.net:8000',
+ String $ng_navbar_addresses = '1',
+ String $ng_navbar_aliases = '1',
+ String $ng_ack_no_sticky = '0',
+ String $ng_ack_no_send = '0',
+ String $ng_tac_cgi_hard_only = '0',
+
+# 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_ensure = '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,
+
+# fail2ban
+ Boolean $ng_enable_fail2ban = false,
+ String $ng_jail_order = '10',
+ Boolean $ng_jail_enable = true,
+ #String $ng_fail2ban_jail = 'httpd',
+ String $ng_fail2ban_logpath = '/var/log/httpd/access_log',
+ #String $ng_fail2ban_regex = 'sshd.*Failed password for',
+ String $ng_fail2ban_maxretry = '5',
+ #String $ng_fail2ban_findtime = '600',
+ String $ng_fail2ban_bantime = '3600',
+ String $ng_fail2ban_ignoreip = '127.0.0.1/8 ::1 192.168.1.0/24'
+
+) {
+# 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'
+ $ng_remoteip_file = '/etc/httpd/conf.d/loadbalancer-remoteip.conf'
+
+# 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.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/spool/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_spool_dir}/status.dat"
+ $ng_command_file = "${ng_cmd_dir}/nagios.cmd"
+ $ng_lock_file = "${ng_run_dir}/nagios.pid"
+ $ng_temp_file = "${ng_spool_dir}/nagios.tmp"
+ $ng_check_result_path = "${ng_spool_dir}/checkresults"
+ $ng_state_retention_file = "${ng_spool_dir}/retention.dat"
+ $ng_host_perfdata_file = "${ng_log_dir}/host-perfdata"
+ $ng_svc_perfdata_file = "${ng_log_dir}/service-perfdata"
+ $ng_debug_file = "${ng_log_dir}/nagios.debug"
+
+# fail2ban
+ $fn_jail_path = '/etc/fail2ban/jail.d'
+ $fn_jail_file = "${fn_jail_path}/${ng_jail_order}-nagios.conf"
+ $fn_filter_path = '/etc/fail2ban/filter.d'
+ $fn_filter_file = "${fn_filter_path}/${ng_jail_order}-nagios.conf"
+
+# 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 +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+ |
+
+ # 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',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_etc_t,
+ seluser => system_u,
+ content => template($ng_nagios_cfg_erb),
+ notify => Service[$ng_service],
+ }
+
+ file { $ng_cgi_cfg_file:
+ ensure => file,
+ owner => 'root',
+ group => 'nagios',
+ mode => '0644',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_etc_t,
+ seluser => system_u,
+ content => template($ng_cgi_cfg_erb),
+ notify => Service[$ng_service],
+ }
+
+ file { $ng_lock_file:
+ ensure => file,
+ owner => 'nagios',
+ group => 'nagios',
+ mode => '0644',
+ selrange => s0,
+ selrole => object_r,
+ seltype => nagios_var_run_t,
+ seluser => system_u,
+ }
+
+ if $ng_use_lb == true {
+ file { $ng_remoteip_file:
+ ensure => file,
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ selrange => s0,
+ selrole => object_r,
+ seltype => httpd_conf_t,
+ seluser => system_u,
+ content => template('confdroid_nagios/loadbalancer/remoteip.conf.erb'),
+ notify => Service['httpd'],
+ }
+ }
+ }
+}
+ |
+
confdroid_nagios::server::nagios.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+ |
+
+ # File 'manifests/server/nagios.pp', line 6
+
+class confdroid_nagios::server::nagios (
+
+) inherits confdroid_nagios::params {
+ if $ng_nagios_server == $fqdn {
+ @@nagios_host { "localhost_${fqdn}":
+ ensure => $ng_ping_ensure,
+ alias => 'localhost',
+ address => '127.0.0.1',
+ use => 'linux-server',
+ target => $ng_target_localhost,
+ hostgroups => 'linux-servers',
+ contacts => $ng_contact_name,
+ 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_host { $fqdn:
+ ensure => $ng_ping_ensure,
+ alias => 'nag001',
+ address => '127.0.0.1',
+ use => 'linux-server',
+ target => $ng_target_localhost,
+ hostgroups => 'linux-servers',
+ contacts => $ng_contact_name,
+ 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 => "check_nagios!${ng_spool_dir}/status.dat!5!/usr/sbin/nagios",
+ use => 'generic-service',
+ host_name => "localhost_${fqdn}",
+ notification_period => '24x7',
+ service_description => 'localhost_nagios_service',
+ target => $ng_target_service,
+ owner => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ contacts => $ng_contact_name,
+ notify => Service[$ng_service],
+ }
+
+ @@nagios_service { 'root_partition_localhost':
+ ensure => $ng_disk_ensure,
+ check_command => "check_nrpe!check_disk!${ng_disk_warn}!${ng_disk_crit}!/",
+ use => 'generic-service',
+ host_name => "localhost_${fqdn}",
+ contacts => $ng_contact_name,
+ notification_period => '24x7',
+ service_description => 'localhost_root_partition',
+ servicegroups => 'linux-services',
+ target => $ng_target_service,
+ owner => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ notify => Service[$ng_service],
+ }
+
+ if $ng_enable_swap_check == true {
+ @@nagios_service { 'Swap_Usage_localhost':
+ ensure => $ng_swap_ensure,
+ check_command => "check_nrpe!check_swap!${ng_swap_warn}!${ng_swap_crit}",
+ use => 'generic-service',
+ host_name => "localhost_${fqdn}",
+ contacts => $ng_contact_name,
+ notification_period => '24x7',
+ service_description => 'localhost_swap_usage',
+ servicegroups => 'linux-services',
+ target => $ng_target_service,
+ owner => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ notify => Service[$ng_service],
+ }
+ }
+
+ @@nagios_service { 'Local_Users_localhost':
+ ensure => $ng_users_ensure,
+ check_command => "check_nrpe!check_users!${ng_users_warn}!${ng_users_crit}",
+ use => 'generic-service',
+ host_name => "localhost_${fqdn}",
+ contacts => $ng_contact_name,
+ notification_period => '24x7',
+ service_description => 'localhost_local_users',
+ servicegroups => 'linux-services',
+ target => $ng_target_service,
+ owner => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ notify => Service[$ng_service],
+ }
+
+ @@nagios_service { 'Total_Processes_localhost':
+ ensure => $ng_procs_tot_ensure,
+ check_command => "check_nrpe!check_procs!${ng_procs_tot_warn}!${ng_procs_tot_crit}!${ng_procs_tot_param}",
+ use => 'generic-service',
+ host_name => "localhost_${fqdn}",
+ contacts => $ng_contact_name,
+ notification_period => '24x7',
+ service_description => 'localhost_total_processes',
+ servicegroups => 'linux-services',
+ target => $ng_target_service,
+ owner => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ notify => Service[$ng_service],
+ }
+
+ @@nagios_service { 'Zombie_Processes_localhost':
+ 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 => "localhost_${fqdn}",
+ contacts => $ng_contact_name,
+ notification_period => '24x7',
+ service_description => 'localhost_zombie_processes',
+ servicegroups => 'linux-services',
+ target => $ng_target_service,
+ owner => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ notify => Service[$ng_service],
+ }
+
+ @@nagios_service { 'Current_Load_localhost':
+ ensure => $ng_load_ensure,
+ check_command => "check_nrpe!check_load!${ng_load_warn}!${ng_load_crit}",
+ use => 'generic-service',
+ host_name => "localhost_${fqdn}",
+ contacts => $ng_contact_name,
+ notification_period => '24x7',
+ service_description => 'localhost_current_load',
+ servicegroups => 'linux-services',
+ target => $ng_target_service,
+ owner => $ng_user,
+ group => $ng_user,
+ mode => '0640',
+ notify => Service[$ng_service],
+ }
+
+ 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::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+ |
+
+ # 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
+ require confdroid_nagios::server::nagios
+
+ 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'],
+ }
+ }
+}
+ |
+
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 = $confdroid_nagios::params::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 = $confdroid_nagios::params::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 = $confdroid_nagios::params::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 = $confdroid_nagios::params::fqdn
+
+ if $ng_nagios_server == $fqdn {
+ concat::fragment { $name:
+ target => $ng_tgt_servicegroup_add,
+ content => template($ng_tgt_svcgrp_rule_erb),
+ }
+ }
+}
+ |
+
confdroid_nagios::nagios::objects::add_timeperiods.pp Module name: confdroid_nagios Author: 12ww160 (12ww160@confdroid.com)
+ +
+ + + +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/nagios/objects/add_timeperiods.pp', line 28
+
+define confdroid_nagios::nagios::objects::add_timeperiods (
+
+ Optional[String] $ng_timep_name = undef,
+ Optional[String] $ng_timep_alias = undef,
+ String $ng_timep_monday = '00:00-24:00',
+ String $ng_timep_tuesday = '00:00-24:00',
+ String $ng_timep_wednesday = '00:00-24:00',
+ String $ng_timep_thursday = '00:00-24:00',
+ String $ng_timep_friday = '00:00-24:00',
+ String $ng_timep_saturday = '00:00-24:00',
+ String $ng_timep_sunday = '00:00-24:00',
+
+) {
+ $ng_nagios_server = $confdroid_nagios::params::ng_nagios_server
+ $ng_tgt_timep_add = $confdroid_nagios::params::ng_tgt_timep_add
+ $ng_tgt_timep_rule_erb = $confdroid_nagios::params::ng_tgt_timep_rule_erb
+ $fqdn = $confdroid_nagios::params::fqdn
+
+ if $ng_nagios_server == $fqdn {
+ concat::fragment { $name:
+ target => $ng_tgt_timep_add,
+ content => template($ng_tgt_timep_rule_erb),
+ }
+ }
+}
+ |
+
confdroid_nagios::nagios::objects::templates.pp Module name: confdroid_nagios Author: 12ww1160 (12ww1160@confdroid.com) notifications. for the defined service or host.
+ +
+ + + +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+ |
+
+ # File 'manifests/nagios/objects/templates.pp', line 79
+
+define confdroid_nagios::nagios::objects::templates (
+ Optional[String] $ng_template_object = undef,
+ Optional[String] $ng_template_object_name = undef,
+ String $ng_svc_notification_period = '24x7',
+ String $ng_host_notification_period = '24x7',
+ String $ng_service_notification_options = 'w,u,c,r,f,s',
+ String $ng_host_notification_options = 'd,u,r,f,s',
+ String $ng_service_notification_commands = 'notify-service-by-email',
+ String $ng_host_notification_commands = 'notify-host-by-email',
+ String $ng_object_register = '0',
+ Optional[String] $ng_template_object_use = undef,
+ String $ng_notifications_enabled = '1',
+ String $ng_event_handler_enabled = '1',
+ String $ng_flap_detection_enabled = '1',
+ String $ng_process_perf_data = '1',
+ String $ng_retain_status_information = '1',
+ String $ng_retain_nonstatus_information = '1',
+ String $ng_notification_period = '24x7',
+ String $ng_notification_interval = '30',
+ String $ng_check_period = '24x7',
+ String $ng_check_interval = '5',
+ String $ng_retry_interval = '1',
+ String $ng_max_check_attempts = '10',
+ String $ng_host_check_command = 'check-host-alive',
+ Optional[String] $ng_notification_options = undef,
+ String $ng_contact_groups = 'admins',
+ String $ng_active_checks_enabled = '1',
+ String $ng_passive_checks_enabled = '1',
+ String $ng_parallelize_check = '1',
+ String $ng_obsess_over_service = '1',
+ String $ng_check_freshness = '0',
+ String $ng_is_volatile = '0',
+
+) {
+ $ng_nagios_server = $confdroid_nagios::params::ng_nagios_server
+ $ng_target_templates = $confdroid_nagios::params::ng_target_templates
+ $ng_templates_rule_erb = $confdroid_nagios::params::ng_templates_rule_erb
+ $fqdn = $confdroid_nagios::params::fqdn
+
+ if $ng_nagios_server == $fqdn {
+ concat::fragment { $name:
+ target => $ng_target_templates,
+ content => template($ng_templates_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),
+ }
+ }
+}
+ |
+