├── .fixtures.yml ├── .gitignore ├── .puppet-lint.rc ├── .sync.yml ├── .travis.yml ├── CHANGELOG.md ├── Gemfile ├── README ├── Rakefile ├── files ├── empty │ └── .placeholder ├── generic-contact.cfg ├── generic-host.cfg ├── generic-service.cfg ├── generic-timeperiod.cfg ├── nrpe.aug └── selinux │ ├── nagiosbase.te │ ├── nagiosreadcollectdrrd.te │ └── nagiosreadpuppetstate.te ├── manifests ├── base.pp ├── base │ └── withwebinterface.pp ├── command.pp ├── debian.pp ├── host.pp ├── host │ ├── nsca.pp │ └── remote.pp ├── init.pp ├── local │ └── hostgroup.pp ├── nrpe │ ├── client.pp │ └── server.pp ├── nsca │ ├── client.pp │ └── server.pp ├── params.pp ├── redhat.pp ├── resource.pp ├── service │ ├── local.pp │ ├── nrpe.pp │ ├── nsca.pp │ └── remote.pp ├── template.pp ├── webadmin.pp └── webinterface.pp ├── metadata.json ├── spec ├── acceptance │ ├── default_spec.rb │ └── nodesets │ │ ├── centos-5.yml │ │ ├── centos-6.yml │ │ ├── centos-7.yml │ │ ├── debian-6.yml │ │ ├── debian-7.yml │ │ ├── debian-8.yml │ │ ├── ubuntu-12.04.yml │ │ ├── ubuntu-14.04.yml │ │ ├── ubuntu-14.10.yml │ │ ├── ubuntu-15.04.yml │ │ ├── ubuntu-15.10.yml │ │ └── ubuntu-16.04.yml ├── classes │ └── nagios_spec.rb ├── spec.opts ├── spec_helper.rb └── spec_helper_acceptance.rb └── templates ├── apache.conf.erb ├── cgi.cfg.erb ├── etc └── default │ └── nagios3.erb ├── generic-command.cfg.erb ├── nagios.cfg.erb ├── nrpe_local.cfg.erb ├── nsca.cfg.erb ├── send_nsca.cfg.erb ├── submit_ochp.erb ├── submit_ocsp.erb └── template-all.erb /.fixtures.yml: -------------------------------------------------------------------------------- 1 | fixtures: 2 | forge_modules: 3 | concat: 'puppetlabs-concat' 4 | selinux: 'camptocamp-selinux' 5 | stdlib: 'puppetlabs-stdlib' 6 | nagios_core: 'puppetlabs-nagios_core' 7 | symlinks: 8 | nagios: "#{source_dir}" 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | pkg/ 2 | Gemfile.lock 3 | vendor/ 4 | spec/fixtures/ 5 | .vagrant/ 6 | .bundle/ 7 | coverage/ 8 | log/ 9 | .*.swp 10 | *~ 11 | -------------------------------------------------------------------------------- /.puppet-lint.rc: -------------------------------------------------------------------------------- 1 | --fail-on-warnings 2 | --relative 3 | --no-140chars 4 | --no-documentation 5 | --no-class_inherits_from_params_class-check 6 | -------------------------------------------------------------------------------- /.sync.yml: -------------------------------------------------------------------------------- 1 | --- 2 | .travis.yml: 3 | forge_password: "lQI5n8NoRxDJsABeWvIRVbigqwdmn5plQjKk/4RYKlDMyUBi7an4wtK7Idprd2OdPamwOGCyLUpoyv79TNo/4ygjSnaeLp8S3G9ONoBdcOGIBgtGZP6U3QkpDmZEbnZsqL8edXxJKSSxVCfovnxAToTho2kMO3lxN9nNYK/1Dk4=" 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: ruby 3 | sudo: false 4 | addons: 5 | apt: 6 | packages: 7 | - libaugeas-dev 8 | sources: 9 | - augeas 10 | cache: bundler 11 | bundler_args: --without system_tests 12 | script: ["bundle exec rake validate", "bundle exec rake lint", "bundle exec rake spec SPEC_OPTS='--format documentation'"] 13 | matrix: 14 | fast_finish: true 15 | include: 16 | - rvm: 2.1.9 17 | env: PUPPET_GEM_VERSION="~> 4.0" 18 | - rvm: 2.4.1 19 | env: PUPPET_GEM_VERSION="~> 5.0" 20 | notifications: 21 | email: false 22 | deploy: 23 | provider: puppetforge 24 | user: camptocamp 25 | password: 26 | secure: "lQI5n8NoRxDJsABeWvIRVbigqwdmn5plQjKk/4RYKlDMyUBi7an4wtK7Idprd2OdPamwOGCyLUpoyv79TNo/4ygjSnaeLp8S3G9ONoBdcOGIBgtGZP6U3QkpDmZEbnZsqL8edXxJKSSxVCfovnxAToTho2kMO3lxN9nNYK/1Dk4=" 27 | on: 28 | tags: true 29 | # all_branches is required to use tags 30 | all_branches: true 31 | # Only publish if our main Ruby target builds 32 | rvm: 2.1.9 33 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 2017-11-07 - Release 1.0.37 2 | 3 | Fix nsca alternate_dump_file and group on RedHat 4 | 5 | ## 2017-10-31 - Release 1.0.36 6 | 7 | Fix path for the nagios-reload command. 8 | 9 | ## 2017-10-31 - Release 1.0.35 10 | 11 | Fix path for the nagios-restart command. 12 | 13 | ## 2017-10-30 - Release 1.0.34 14 | 15 | Remove "ensure" for `concat::fragment` to match with the new version of the concat module. 16 | 17 | ## 2016-09-06 - Release 1.0.33 18 | 19 | EPEL has messed their packaging so it pushes /etc/httpd/conf.d/nagios.conf everywhere now... 20 | 21 | This breaks httpd if mod_version is not loaded. And if you use puppetlabs/apache this is fatal. 22 | 23 | ## 2016-09-06 - Release 1.0.32 24 | 25 | EPEL has now nagios 4.3 so change the values for pid file on rhel6. 26 | 27 | ## 2016-09-06 - Release 1.0.31 28 | 29 | Fix read-write dir creation 30 | 31 | ## 2016-08-17 - Release 1.0.30 32 | 33 | Remove dependency on apache_c2c 34 | Use standard paths for command_file 35 | 36 | ## 2016-02-03 - Release 1.0.29 37 | 38 | Move lock_file definition to params.pp 39 | 40 | ## 2016-01-04 - Release 1.0.28 41 | 42 | Add rw dir in /var/log/nagios for nagios 4 43 | 44 | ## 2015-12-07 - Release 1.0.27 45 | 46 | Fix convergence on Debian 6 47 | 48 | ## 2015-12-07 - Release 1.0.26 49 | 50 | Fix convergence on RedHat 7 51 | 52 | ## 2015-12-04 - Release 1.0.25 53 | 54 | Fix convergence on RedHat 7 55 | 56 | ## 2015-09-30 - Release 1.0.24 57 | 58 | Stop managing files created by nagios 59 | 60 | ## 2015-08-21 - Release 1.0.23 61 | 62 | Use docker for acceptance tests 63 | 64 | ## 2015-07-24 - Release 1.0.22 65 | 66 | Also collect nagios::host on nrpe server 67 | Fix bug in remote host 68 | Fix typo in nsca host definition 69 | 70 | ## 2015-07-24 - Release 1.0.21 71 | 72 | Export nagios::host instead of nagios_host 73 | 74 | ## 2015-07-23 - Release 1.0.20 75 | 76 | Realize file exported resources locally, too 77 | 78 | ## 2015-07-21 - Release 1.0.19 79 | 80 | Use only one nagios_host resource 81 | and realize it locally 82 | 83 | ## 2015-07-21 - Release 1.0.18 84 | 85 | Rename active nagios_host resources 86 | to avoid alias conflict when using Puppet 4 87 | 88 | ## 2015-07-20 - Release 1.0.17 89 | 90 | Use namevar instead of alias for Package[nagios] on Debian 91 | to fix Puppet 4 support. 92 | 93 | ## 2015-07-16 - Release 1.0.16 94 | 95 | Remove nagios_alias from local resource 96 | 97 | ## 2015-07-15 - Release 1.0.15 98 | 99 | Forgot to remove file context for RHEL7 too 100 | 101 | ## 2015-07-15 - Release 1.0.14 102 | 103 | Remove SELinux type for a directory, already managed by RHEL policy. 104 | 105 | ## 2015-07-13 - Release 1.0.13 106 | 107 | Fix a scope issue with generic-command template 108 | 109 | ## 2015-06-26 - Release 1.0.12 110 | 111 | Fix strict_variables activation with rspec-puppet 2.2 112 | 113 | ## 2015-05-28 - Release 1.0.11 114 | 115 | Add beaker_spec_helper to Gemfile 116 | 117 | ## 2015-05-26 - Release 1.0.10 118 | 119 | Use random application order in nodeset 120 | 121 | ## 2015-05-26 - Release 1.0.9 122 | 123 | add utopic & vivid nodesets 124 | 125 | ## 2015-05-25 - Release 1.0.8 126 | 127 | Don't allow failure on Puppet 4 128 | 129 | ## 2015-05-13 - Release 1.0.7 130 | 131 | Add puppet-lint-file_source_rights-check gem 132 | 133 | ## 2015-05-12 - Release 1.0.6 134 | 135 | Don't pin beaker 136 | 137 | ## 2015-04-27 - Release 1.0.5 138 | 139 | Add nodeset ubuntu-12.04-x86_64-openstack 140 | 141 | ## 2015-04-17 - Release 1.0.4 142 | 143 | - Fetch fixtures from puppet forge 144 | 145 | ## 2015-04-15 - Release 1.0.3 146 | 147 | - Use file() function instead of fileserver (way faster) 148 | 149 | ## 2015-04-03 - Release 1.0.2 150 | 151 | - Confine rspec pinning to ruby 1.8 152 | 153 | ## 2015-03-24 - Release 1.0.1 154 | 155 | - Various fixes 156 | 157 | ## 2015-01-19 - Release 1.0.0 158 | 159 | - Initial Forge release 160 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source ENV['GEM_SOURCE'] || "https://rubygems.org" 2 | 3 | group :development, :unit_tests do 4 | gem 'rake', :require => false 5 | gem 'rspec', :require => false 6 | gem 'rspec-puppet', :require => false 7 | gem 'puppetlabs_spec_helper', :require => false 8 | gem 'metadata-json-lint', :require => false 9 | gem 'puppet-lint', :require => false 10 | gem 'puppet-lint-unquoted_string-check', :require => false 11 | gem 'puppet-lint-empty_string-check', :require => false 12 | gem 'puppet-lint-spaceship_operator_without_tag-check', :require => false 13 | gem 'puppet-lint-undef_in_function-check', :require => false 14 | gem 'puppet-lint-leading_zero-check', :require => false 15 | gem 'puppet-lint-trailing_comma-check', :require => false 16 | gem 'puppet-lint-file_ensure-check', :require => false 17 | gem 'puppet-lint-version_comparison-check', :require => false 18 | gem 'puppet-lint-file_source_rights-check', :require => false 19 | gem 'puppet-lint-alias-check', :require => false 20 | gem 'rspec-puppet-facts', :require => false 21 | gem 'ruby-augeas', :require => false 22 | gem 'puppet-blacksmith', :require => false if RUBY_VERSION !~ /^1\./ 23 | gem 'json_pure', '< 2.0.2', :require => false 24 | end 25 | 26 | group :system_tests do 27 | gem 'beaker', '~>3.13', :require => false 28 | gem 'beaker-rspec', '> 5', :require => false 29 | gem 'beaker_spec_helper', :require => false 30 | gem 'serverspec', :require => false 31 | gem 'specinfra', :require => false 32 | end 33 | 34 | if facterversion = ENV['FACTER_GEM_VERSION'] 35 | gem 'facter', facterversion, :require => false 36 | else 37 | gem 'facter', :require => false 38 | end 39 | 40 | if puppetversion = ENV['PUPPET_GEM_VERSION'] 41 | gem 'puppet', puppetversion, :require => false 42 | else 43 | gem 'puppet', :require => false 44 | end 45 | 46 | # vim:ft=ruby 47 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Introduction/Notes 2 | ================== 3 | 4 | The goal of this module is to provide a simple way to use 5 | distributed monitoring as described on this page : 6 | http://nagios.sourceforge.net/docs/3_0/distributed.html 7 | 8 | This module is under development and still requires many 9 | improvements to suit maximum of use-case and to be 10 | cross-distribution. Please don't treat it as stable ! 11 | 12 | 13 | Usage 14 | ================= 15 | 16 | node 'distributed_monitoring_server' { 17 | import "nagios" 18 | 19 | # It is possible to override all standard main configuration 20 | # file options defined in template nagios.cfg.erb with prefix "nagios_" 21 | # 22 | # $nagios_debug_level="-1" 23 | # $nagios_debug_verbosity="3" 24 | 25 | $nagiosadmin_password = "XXXX" 26 | 27 | ... 28 | 29 | include apache::base 30 | 31 | include nagios::base 32 | class { 'nagios::nsca::client': 33 | nsca_server => 'central_monitoring_server', 34 | } 35 | include nagios::webinterface 36 | 37 | # active check on distributed monitoring server 38 | # and passive check on central server 39 | nagios::service::distributed {"check_local_du on $fqdn": 40 | check_command => check_local_du; 41 | } 42 | 43 | nagios::service::distributed {"check_http on $fqdn": 44 | check_command => check_http; 45 | } 46 | 47 | # active check only on central server 48 | nagios::service::remote {"check_url!distributed_monitoring_server!/test/page.php": 49 | description => "check my super test page", 50 | } 51 | 52 | # active check only on distributed monitoring server 53 | nagios::service::local {"check_url!reductivelabs.com!/trac/puppet": 54 | description => "check puppet website", 55 | } 56 | 57 | } 58 | 59 | node 'central_monitoring_server' { 60 | import "nagios" 61 | 62 | $nagiosadmin_password = "XXXX" 63 | 64 | ... 65 | 66 | include apache::base 67 | 68 | include nagios::base 69 | include nagios::nsca::daemon 70 | include nagios::webinterface 71 | } 72 | 73 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'puppetlabs_spec_helper/rake_tasks' 2 | require 'puppet-lint/tasks/puppet-lint' 3 | 4 | Rake::Task[:lint].clear 5 | PuppetLint::RakeTask.new :lint do |config| 6 | config.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp", "vendor/**/*.pp"] 7 | config.disable_checks = ['140chars'] 8 | config.fail_on_warnings = true 9 | end 10 | 11 | PuppetSyntax.exclude_paths = ["spec/fixtures/**/*.pp", "vendor/**/*"] 12 | 13 | # Publishing tasks 14 | unless RUBY_VERSION =~ /^1\./ 15 | require 'puppet_blacksmith' 16 | require 'puppet_blacksmith/rake_tasks' 17 | end 18 | -------------------------------------------------------------------------------- /files/empty/.placeholder: -------------------------------------------------------------------------------- 1 | # file managed by puppet 2 | 3 | # placeholder: dont remove me 4 | -------------------------------------------------------------------------------- /files/generic-contact.cfg: -------------------------------------------------------------------------------- 1 | # file managed by puppet 2 | 3 | define contact { 4 | name generic-contact 5 | service_notification_period 24x7 6 | host_notification_period 24x7 7 | service_notification_options w,u,c,r 8 | host_notification_options d,u,r 9 | service_notification_commands notify-service-by-email 10 | host_notification_commands notify-host-by-email 11 | register 0 12 | } 13 | -------------------------------------------------------------------------------- /files/generic-host.cfg: -------------------------------------------------------------------------------- 1 | # file managed by puppet 2 | 3 | define host{ 4 | name generic-host 5 | notifications_enabled 1 6 | event_handler_enabled 1 7 | flap_detection_enabled 1 8 | failure_prediction_enabled 1 9 | process_perf_data 1 10 | retain_status_information 1 11 | retain_nonstatus_information 1 12 | max_check_attempts 10 13 | notification_interval 0 14 | notification_period 24x7 15 | notification_options d,u,r 16 | contact_groups admins 17 | register 0 18 | active_checks_enabled 0 19 | passive_checks_enabled 0 20 | } 21 | 22 | define host { 23 | name generic-host-active 24 | use generic-host 25 | active_checks_enabled 1 26 | check_command check-host-alive 27 | register 0 28 | } 29 | 30 | define host { 31 | name generic-host-passive 32 | use generic-host 33 | passive_checks_enabled 1 34 | register 0 35 | check_freshness 1 36 | check_command host-is-stale 37 | } 38 | -------------------------------------------------------------------------------- /files/generic-service.cfg: -------------------------------------------------------------------------------- 1 | # file managed by puppet 2 | 3 | define service{ 4 | name generic-service 5 | active_checks_enabled 0 6 | passive_checks_enabled 0 7 | parallelize_check 1 8 | obsess_over_service 1 9 | check_freshness 0 10 | notifications_enabled 1 11 | event_handler_enabled 1 12 | flap_detection_enabled 1 13 | failure_prediction_enabled 1 14 | process_perf_data 1 15 | retain_status_information 1 16 | retain_nonstatus_information 1 17 | notification_interval 0 18 | is_volatile 0 19 | check_period 24x7 20 | check_interval 5 21 | retry_check_interval 3 22 | max_check_attempts 4 23 | notification_period 24x7 24 | notification_options w,u,c,r 25 | contact_groups admins 26 | register 0 27 | } 28 | 29 | define service{ 30 | name generic-service-active 31 | use generic-service 32 | active_checks_enabled 1 33 | register 0 34 | } 35 | 36 | define service{ 37 | name generic-service-passive 38 | use generic-service 39 | passive_checks_enabled 1 40 | register 0 41 | check_freshness 1 42 | freshness_threshold 600 43 | check_command service-is-stale 44 | } 45 | -------------------------------------------------------------------------------- /files/generic-timeperiod.cfg: -------------------------------------------------------------------------------- 1 | # file managed by puppet 2 | 3 | # This defines a timeperiod where all times are valid for checks, 4 | # notifications, etc. The classic "24x7" support nightmare. :-) 5 | define timeperiod{ 6 | timeperiod_name 24x7 7 | alias 24 Hours A Day, 7 Days A Week 8 | sunday 00:00-24:00 9 | monday 00:00-24:00 10 | tuesday 00:00-24:00 11 | wednesday 00:00-24:00 12 | thursday 00:00-24:00 13 | friday 00:00-24:00 14 | saturday 00:00-24:00 15 | } 16 | 17 | # Here is a slightly friendlier period during work hours 18 | define timeperiod{ 19 | timeperiod_name workhours 20 | alias Standard Work Hours 21 | monday 09:00-17:00 22 | tuesday 09:00-17:00 23 | wednesday 09:00-17:00 24 | thursday 09:00-17:00 25 | friday 09:00-17:00 26 | } 27 | 28 | # The complement of workhours 29 | define timeperiod{ 30 | timeperiod_name nonworkhours 31 | alias Non-Work Hours 32 | sunday 00:00-24:00 33 | monday 00:00-09:00,17:00-24:00 34 | tuesday 00:00-09:00,17:00-24:00 35 | wednesday 00:00-09:00,17:00-24:00 36 | thursday 00:00-09:00,17:00-24:00 37 | friday 00:00-09:00,17:00-24:00 38 | saturday 00:00-24:00 39 | } 40 | 41 | # This one is a favorite: never :) 42 | define timeperiod{ 43 | timeperiod_name never 44 | alias Never 45 | } 46 | 47 | -------------------------------------------------------------------------------- /files/nrpe.aug: -------------------------------------------------------------------------------- 1 | (* 2 | Module: Nrpe 3 | Parses nagios-nrpe configuration files. 4 | 5 | Author: Marc Fournier 6 | 7 | About: License 8 | This file is licensed under the LGPL v2+, like the rest of Augeas. 9 | *) 10 | 11 | module Nrpe = 12 | autoload xfm 13 | 14 | 15 | let eol = Util.eol 16 | let eq = Sep.equal 17 | 18 | (* View: word *) 19 | let word = /[^=\n\t ]+/ 20 | 21 | (* View: item_re *) 22 | let item_re = /[^#=\n\t\/ ]+/ - (/command\[[^]\/\n]+\]/ | "include" | "include_dir") 23 | 24 | (* View: command 25 | nrpe.cfg usually has many entries defining commands to run 26 | 27 | > command[check_foo]=/path/to/nagios/plugin -w 123 -c 456 28 | > command[check_bar]=/path/to/another/nagios/plugin --option 29 | *) 30 | let command = 31 | let obrkt = del /\[/ "[" in 32 | let cbrkt = del /\]/ "]" in 33 | [ key "command" . 34 | [ obrkt . key /[^]\/\n]+/ . cbrkt . eq 35 | . store /[^\n]+/ . del /\n/ "\n" ] 36 | ] 37 | 38 | 39 | (* View: item 40 | regular entries 41 | 42 | > allow_bash_command_substitution=0 43 | *) 44 | let item = [ key item_re . eq . store word . eol ] 45 | 46 | (* View: include 47 | An include entry. 48 | 49 | nrpe.cfg can include more than one file or directory of files 50 | 51 | > include=/path/to/file1.cfg 52 | > include=/path/to/file2.cfg 53 | *) 54 | let include = [ key "include" . 55 | [ label "file" . eq . store word . eol ] 56 | ] 57 | 58 | (* View: include_dir 59 | > include_dir=/path/to/dir/ 60 | *) 61 | let include_dir = [ key "include_dir" . 62 | [ label "dir" . eq . store word . eol ] 63 | ] 64 | 65 | 66 | (* View: comment 67 | Nrpe comments must start at beginning of line *) 68 | let comment = Util.comment_generic /#[ \t]*/ "# " 69 | 70 | (* blank lines and empty comments *) 71 | let empty = Util.empty 72 | 73 | (* View: lns 74 | The Nrpe lens *) 75 | let lns = ( command | include | include_dir | item | comment | empty ) * 76 | 77 | (* View: filter 78 | File filter *) 79 | let filter = incl "/etc/nrpe.cfg" . 80 | incl "/etc/nagios/nrpe.cfg" 81 | 82 | let xfm = transform lns (filter) 83 | 84 | -------------------------------------------------------------------------------- /files/selinux/nagiosbase.te: -------------------------------------------------------------------------------- 1 | 2 | module nagiosbase 1.3; 3 | 4 | require { 5 | type admin_home_t; 6 | type auditd_log_t; 7 | type binfmt_misc_fs_t; 8 | type boot_t; 9 | type chkpwd_t; 10 | type devpts_t; 11 | type initrc_t; 12 | type nscd_var_run_t; 13 | type nagios_t; 14 | type nagios_log_t; 15 | type nagios_exec_t; 16 | type nagios_admin_plugin_exec_t; 17 | type nagios_checkdisk_plugin_t; 18 | type nagios_services_plugin_t; 19 | type nagios_system_plugin_t; 20 | type nrpe_t; 21 | type ping_t; 22 | type proc_t; 23 | type semanage_t; 24 | type setfiles_t; 25 | type sshd_t; 26 | type sysfs_t; 27 | type sysctl_fs_t; 28 | type sysstat_t; 29 | type tmp_t; 30 | type tmpfs_t; 31 | type var_run_t; 32 | 33 | class dir { write search read remove_name open getattr add_name }; 34 | class file { execute read create getattr execute_no_trans write ioctl unlink open }; 35 | class process { siginh noatsecure rlimitinh }; 36 | class sock_file write; 37 | class tcp_socket { read write }; 38 | class unix_stream_socket connectto; 39 | } 40 | 41 | #============= nagios_services_plugin_t ============== 42 | allow nagios_services_plugin_t initrc_t:unix_stream_socket connectto; 43 | 44 | allow nagios_services_plugin_t nagios_exec_t:file { read getattr open execute execute_no_trans }; 45 | 46 | allow nagios_services_plugin_t nagios_log_t:dir { read search open write remove_name add_name }; 47 | allow nagios_services_plugin_t nagios_log_t:file { create open read write unlink }; 48 | 49 | allow nagios_services_plugin_t ping_t:process { siginh rlimitinh noatsecure }; 50 | 51 | allow nagios_services_plugin_t proc_t:file { read getattr open }; 52 | 53 | allow nagios_services_plugin_t tmp_t:dir read; 54 | 55 | allow nagios_services_plugin_t var_run_t:sock_file write; 56 | 57 | #============= nagios_system_plugin_t ============== 58 | allow nagios_system_plugin_t nagios_log_t:dir search; 59 | allow nagios_system_plugin_t nagios_log_t:file { read write open }; 60 | 61 | allow nagios_system_plugin_t nrpe_t:tcp_socket { read write }; 62 | 63 | #============= nagios_t ============== 64 | allow nagios_t admin_home_t:dir getattr; 65 | 66 | allow nagios_t auditd_log_t:dir getattr; 67 | 68 | allow nagios_t nagios_admin_plugin_exec_t:file ioctl; 69 | 70 | allow nagios_t nagios_checkdisk_plugin_t:process { siginh rlimitinh noatsecure }; 71 | 72 | allow nagios_t nagios_services_plugin_t:process { siginh rlimitinh noatsecure }; 73 | 74 | allow nagios_t nagios_system_plugin_t:process { siginh rlimitinh noatsecure }; 75 | 76 | allow nagios_t nscd_var_run_t:file read; 77 | 78 | -------------------------------------------------------------------------------- /files/selinux/nagiosreadcollectdrrd.te: -------------------------------------------------------------------------------- 1 | 2 | module nagiosreadcollectdrrd 1.0; 3 | 4 | require { 5 | type nagios_t; 6 | type var_lib_t; 7 | class file { read getattr open }; 8 | } 9 | 10 | #============= nagios_t ============== 11 | allow nagios_t var_lib_t:file { read getattr open }; 12 | -------------------------------------------------------------------------------- /files/selinux/nagiosreadpuppetstate.te: -------------------------------------------------------------------------------- 1 | 2 | module nagiosreadpuppetstate 1.1; 3 | 4 | require { 5 | type nagios_t; 6 | type puppet_var_lib_t; 7 | class file { getattr }; 8 | class dir { read getattr link lock search }; 9 | } 10 | 11 | #============= nagios_t ============== 12 | allow nagios_t puppet_var_lib_t:dir { read getattr link lock search }; 13 | allow nagios_t puppet_var_lib_t:file getattr; 14 | 15 | -------------------------------------------------------------------------------- /manifests/base.pp: -------------------------------------------------------------------------------- 1 | # == Class: nagios::base 2 | # 3 | # Define common resources between debian and redhat based systems. It shouldn't 4 | # be necessary to include this class directly. Instead, you should use: 5 | # 6 | # include nagios 7 | # 8 | class nagios::base { 9 | assert_private() 10 | 11 | # purge 12 | if $nagios::ensure == 'absent' { 13 | $pkg_ensure = $::osfamily ? { 14 | 'RedHat' => 'absent', 15 | 'Debian' => 'purged', 16 | } 17 | 18 | purge { 'package': 19 | if => [ 20 | ['name', '=~', 'monitoring-.*'], 21 | ['name', '=~', 'nsca.*'], 22 | ], 23 | state => $pkg_ensure, 24 | } 25 | } 26 | 27 | include ::nagios::params 28 | 29 | # variables used in ERB template 30 | $basename = $nagios::params::basename 31 | $nagios_p1_file = $nagios::params::p1file 32 | $nagios_debug_level = '0' 33 | $nagios_debug_verbosity = '0' 34 | $pidfile = $nagios::params::pidfile 35 | 36 | case $::osfamily { 37 | 'Debian': { $nagios_mail_path = '/usr/bin/mail' } 38 | 'RedHat': { $nagios_mail_path = '/bin/mail' } 39 | default: { fail ("OS family ${::osfamily} not yet implemented !") } 40 | } 41 | 42 | # Common resources between base, redhat, and debian 43 | 44 | user { 'nagios': 45 | ensure => $nagios::ensure, 46 | shell => '/bin/sh', 47 | require => Package['nagios'], 48 | } 49 | 50 | $svc_ensure = $nagios::ensure ? { 51 | present => running, 52 | default => stopped, 53 | } 54 | 55 | $svc_enable = $nagios::ensure ? { 56 | present => true, 57 | default => false, 58 | } 59 | 60 | service { 'nagios': 61 | ensure => $svc_ensure, 62 | enable => $svc_enable, 63 | hasrestart => true, 64 | require => Package['nagios'], 65 | } 66 | 67 | exec { 'nagios-restart': 68 | command => "${nagios::params::basename} -v ${nagios::params::conffile} && /etc/init.d/${nagios::params::basename} restart", 69 | refreshonly => true, 70 | path => $::path, 71 | onlyif => "test -f ${nagios::params::conffile}", 72 | } 73 | 74 | exec { 'nagios-reload': 75 | command => "${nagios::params::basename} -v ${nagios::params::conffile} && /etc/init.d/${nagios::params::basename} reload", 76 | refreshonly => true, 77 | path => $::path, 78 | onlyif => "test -f ${nagios::params::conffile}", 79 | } 80 | 81 | $read_write_dir = $::osfamily ? { 82 | 'Debian' => '/var/lib/nagios3/rw', 83 | 'RedHat' => '/var/spool/nagios/cmd', 84 | } 85 | $command_file = "${read_write_dir}/nagios.cmd" 86 | 87 | $file_ensure = $nagios::ensure ? { 88 | present => file, 89 | default => absent, 90 | } 91 | 92 | $dir_ensure = $nagios::ensure ? { 93 | present => directory, 94 | default => absent, 95 | } 96 | 97 | file { 'nagios read-write dir': 98 | ensure => $dir_ensure, 99 | force => true, 100 | path => $read_write_dir, 101 | owner => 'nagios', 102 | group => 'nagios', 103 | mode => '2710', 104 | require => Package['nagios'], 105 | } 106 | 107 | file { 'nagios query-handler read-write dir': 108 | ensure => $dir_ensure, 109 | force => true, 110 | path => "/var/log/${nagios::params::basename}/rw", 111 | owner => 'nagios', 112 | group => 'nagios', 113 | mode => '2710', 114 | require => Package['nagios'], 115 | } 116 | 117 | file {[ 118 | "/var/run/${nagios::params::basename}", 119 | "/var/log/${nagios::params::basename}", 120 | "/var/lib/${nagios::params::basename}", 121 | "/var/lib/${nagios::params::basename}/spool", 122 | "/var/lib/${nagios::params::basename}/spool/checkresults", 123 | "/var/cache/${nagios::params::basename}", 124 | ]: 125 | ensure => $dir_ensure, 126 | force => true, 127 | owner => nagios, 128 | group => nagios, 129 | mode => '0755', 130 | require => Package['nagios'], 131 | before => Service['nagios'], 132 | } 133 | 134 | nagios::resource { 'USER1': value => $nagios::params::user1 } 135 | 136 | concat {[ 137 | $nagios::params::conffile, 138 | "${nagios::params::rootdir}/resource.cfg", 139 | ]: 140 | ensure => $nagios::ensure, 141 | notify => Exec['nagios-restart'], 142 | require => Package['nagios'], 143 | } 144 | 145 | $use_syslog = $nagios::use_syslog 146 | concat::fragment {'main': 147 | target => $nagios::params::conffile, 148 | content => template('nagios/nagios.cfg.erb'), 149 | } 150 | 151 | # other common resources below 152 | 153 | file { ["${nagios::params::rootdir}/conf.d", 154 | "${nagios::params::rootdir}/auto-puppet", 155 | "${nagios::params::rootdir}/nagios.d"]: 156 | ensure => absent, 157 | force => true, 158 | recurse => true, 159 | require => Package['nagios'], 160 | } 161 | 162 | $res_source = $dir_ensure ? { 163 | directory => 'puppet:///modules/nagios/empty', 164 | absent => undef, 165 | } 166 | 167 | 168 | file { '/etc/nagios-plugins': 169 | ensure => $dir_ensure, 170 | purge => true, 171 | force => true, 172 | } 173 | 174 | # purge undefined nagios resources 175 | file { $nagios::params::resourcedir: 176 | ensure => $dir_ensure, 177 | # lint:ignore:fileserver 178 | source => $res_source, 179 | # lint:endignore 180 | owner => root, 181 | group => root, 182 | mode => '0644', 183 | purge => true, 184 | force => true, 185 | recurse => true, 186 | notify => Exec['nagios-restart'], 187 | } 188 | 189 | $module_path = get_module_path($module_name) 190 | file {"${nagios::params::resourcedir}/generic-host.cfg": 191 | ensure => $file_ensure, 192 | owner => root, 193 | group => root, 194 | mode => '0644', 195 | content => file("${module_path}/files/generic-host.cfg"), 196 | notify => Exec['nagios-restart'], 197 | } 198 | 199 | $check_ping_ipv = $::nagios::check_ping_ipv 200 | file {"${nagios::params::resourcedir}/generic-command.cfg": 201 | ensure => $file_ensure, 202 | owner => root, 203 | group => root, 204 | mode => '0644', 205 | content => template('nagios/generic-command.cfg.erb'), 206 | notify => Exec['nagios-restart'], 207 | } 208 | 209 | file {"${nagios::params::resourcedir}/generic-timeperiod.cfg": 210 | ensure => $file_ensure, 211 | owner => root, 212 | group => root, 213 | mode => '0644', 214 | content => file("${module_path}/files/generic-timeperiod.cfg"), 215 | notify => Exec['nagios-restart'], 216 | } 217 | 218 | file {"${nagios::params::resourcedir}/base-contacts.cfg": 219 | ensure => $file_ensure, 220 | owner => 'root', 221 | mode => '0644', 222 | } 223 | 224 | nagios_contact { 'root': 225 | ensure => $nagios::ensure, 226 | contact_name => 'root', 227 | # lint:ignore:alias_parameter 228 | alias => 'Root', 229 | # lint:endignore 230 | service_notification_period => '24x7', 231 | host_notification_period => '24x7', 232 | service_notification_options => 'w,u,c,r', 233 | host_notification_options => 'd,r', 234 | service_notification_commands => 'notify-service-by-email', 235 | host_notification_commands => 'notify-host-by-email', 236 | email => 'root', 237 | target => "${nagios::params::resourcedir}/base-contacts.cfg", 238 | notify => Exec['nagios-restart'], 239 | require => File["${nagios::params::resourcedir}/base-contacts.cfg"], 240 | } 241 | 242 | file {"${nagios::params::resourcedir}/base-contactgroups.cfg": 243 | ensure => $file_ensure, 244 | owner => 'root', 245 | mode => '0644', 246 | } 247 | 248 | nagios_contactgroup { 'admins': 249 | ensure => $nagios::ensure, 250 | contactgroup_name => 'admins', 251 | # lint:ignore:alias_parameter 252 | alias => 'Nagios Administrators', 253 | # lint:endignore 254 | members => 'root', 255 | target => "${nagios::params::resourcedir}/base-contactgroups.cfg", 256 | notify => Exec['nagios-restart'], 257 | require => [ 258 | Nagios_contact['root'], 259 | File["${nagios::params::resourcedir}/base-contactgroups.cfg"] 260 | ], 261 | } 262 | 263 | file {"${nagios::params::resourcedir}/base-servicegroup.cfg": 264 | ensure => $file_ensure, 265 | owner => 'root', 266 | mode => '0644', 267 | } 268 | 269 | nagios_servicegroup { 'default': 270 | ensure => $nagios::ensure, 271 | # lint:ignore:alias_parameter 272 | alias => 'Default Service Group', 273 | # lint:endignore 274 | target => "${nagios::params::resourcedir}/base-servicegroup.cfg", 275 | notify => Exec['nagios-restart'], 276 | require => File["${nagios::params::resourcedir}/base-servicegroup.cfg"], 277 | } 278 | 279 | } 280 | -------------------------------------------------------------------------------- /manifests/base/withwebinterface.pp: -------------------------------------------------------------------------------- 1 | class nagios::base::withwebinterface inherits nagios::base { 2 | case $::osfamily { 3 | 'Debian': { 4 | $group = 'www-data' 5 | } 6 | 'RedHat': { 7 | $group = 'apache' 8 | } 9 | default: { 10 | fail "Unsupported osfamily: ${::osfamily}" 11 | } 12 | } 13 | File['nagios read-write dir'] { 14 | group => $group, 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /manifests/command.pp: -------------------------------------------------------------------------------- 1 | # == Definition: nagios::command 2 | # 3 | # Simple wrapper to create a nagios_command resource and associated file. 4 | # 5 | # Example: 6 | # 7 | # nagios::command { "check_service": 8 | # command_line => "/usr/lib/nagios/plugins/check_dummy 0 ok" 9 | # } 10 | 11 | define nagios::command ( 12 | $command_line, 13 | $ensure = present, 14 | ) { 15 | 16 | include ::nagios::params 17 | 18 | $fname = regsubst($name, '\W', '_', 'G') 19 | 20 | nagios_command { $name: 21 | ensure => $ensure, 22 | command_line => $command_line, 23 | target => "${nagios::params::resourcedir}/command-${fname}.cfg", 24 | notify => Exec['nagios-restart'], 25 | } 26 | 27 | file { "${nagios::params::resourcedir}/command-${fname}.cfg": 28 | ensure => $ensure, 29 | owner => 'root', 30 | mode => '0644', 31 | before => Nagios_command[$name], 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /manifests/debian.pp: -------------------------------------------------------------------------------- 1 | # == Class: nagios::debian 2 | # 3 | # Define common resources specific to debian based systems. It shouldn't be 4 | # necessary to include this class directly. Instead, you should use: 5 | # 6 | # include nagios 7 | # 8 | class nagios::debian inherits nagios::base { 9 | assert_private() 10 | 11 | include ::nagios::params 12 | 13 | # Common resources between base, redhat, and debian 14 | 15 | $pkg_ensure = $nagios::ensure ? { 16 | present => installed, 17 | default => purged, 18 | } 19 | 20 | package {[ 21 | 'nagios3-common', 22 | 'nagios-plugins', 23 | 'nagios-plugins-standard', 24 | 'nagios-plugins-basic', 25 | ]: 26 | ensure => $pkg_ensure, 27 | } 28 | package {'nagios': 29 | ensure => $pkg_ensure, 30 | name => 'nagios3-core', 31 | } 32 | 33 | Service['nagios'] { 34 | name => 'nagios3', 35 | } 36 | 37 | File['/var/lib/nagios3'] { 38 | mode => '0751', 39 | } 40 | 41 | 42 | # debian specific resources below 43 | $niceness = $nagios::niceness 44 | 45 | $file_ensure = $nagios::ensure ? { 46 | present => file, 47 | default => absent, 48 | } 49 | 50 | file {'/etc/default/nagios3': 51 | ensure => $file_ensure, 52 | owner => root, 53 | group => root, 54 | mode => '0644', 55 | content => template('nagios/etc/default/nagios3.erb'), 56 | require => Package['nagios'], 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /manifests/host.pp: -------------------------------------------------------------------------------- 1 | # == Definition: nagios::host 2 | # 3 | # Define a host resource on the local nagios instance. 4 | # 5 | # Example: 6 | # 7 | # nagios::host { $fqdn: 8 | # ensure => "present", 9 | # } 10 | 11 | define nagios::host ( 12 | $ensure=present, 13 | $address=false, 14 | $nagios_alias=undef, 15 | $hostgroups=undef, 16 | $contact_groups=undef, 17 | $use='generic-host-active', 18 | ) { 19 | 20 | include ::nagios::params 21 | 22 | $fname = regsubst($name, '\W', '_', 'G') 23 | $nagios_address = $address ? { 24 | false => $::ipaddress, 25 | default => $address, 26 | } 27 | 28 | nagios_host { $name: 29 | ensure => $ensure, 30 | use => $use, 31 | address => $nagios_address, 32 | # lint:ignore:alias_parameter 33 | alias => $nagios_alias, 34 | # lint:endignore 35 | hostgroups => $hostgroups, 36 | contact_groups => $contact_groups, 37 | target => "${nagios::params::resourcedir}/host-${fname}.cfg", 38 | notify => Exec['nagios-restart'], 39 | } 40 | 41 | file { "${nagios::params::resourcedir}/host-${fname}.cfg": 42 | ensure => $ensure, 43 | owner => 'root', 44 | mode => '0644', 45 | before => Nagios_host[$name], 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /manifests/host/nsca.pp: -------------------------------------------------------------------------------- 1 | # == Definition: nagios::host::nsca 2 | # 3 | # Define a host resource on the local nagios instance and export the same 4 | # resource to a remote nagios nsca server. 5 | # 6 | # Example: 7 | # 8 | # nagios::host::nsca { $fqdn: 9 | # ensure => "present", 10 | # export_for => "nagios-nsca.example.com", 11 | # } 12 | # 13 | define nagios::host::nsca ( 14 | $export_for, 15 | $ensure=present, 16 | $address=false, 17 | $nagios_alias=undef, 18 | $hostgroups=undef, 19 | $contact_groups=undef 20 | ) { 21 | 22 | include ::nagios::params 23 | 24 | $fname = regsubst($name, '\W', '_', 'G') 25 | $nagios_host_address = $address ? { 26 | false => $::ipaddress, 27 | default => $address, 28 | } 29 | 30 | nagios_host {$name: 31 | ensure => $ensure, 32 | use => 'generic-host-active', 33 | address => $nagios_host_address, 34 | # lint:ignore:alias_parameter 35 | alias => $nagios_alias, 36 | # lint:endignore 37 | target => "${nagios::params::resourcedir}/host-${fname}.cfg", 38 | notify => Exec['nagios-restart'], 39 | } 40 | 41 | file { "${nagios::params::resourcedir}/host-${fname}.cfg": 42 | ensure => $ensure, 43 | owner => 'root', 44 | mode => '0644', 45 | before => Nagios_host[$name], 46 | } 47 | 48 | @@nagios::host {$name: 49 | ensure => $ensure, 50 | address => $nagios_host_address, 51 | nagios_alias => $nagios_alias, 52 | hostgroups => $hostgroups, 53 | contact_groups => $contact_groups, 54 | use => 'generic-host-passive', 55 | tag => $export_for, 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /manifests/host/remote.pp: -------------------------------------------------------------------------------- 1 | # == Definition: nagios::host::remote 2 | # 3 | # Define a host resource on the local nagios instance and export the same 4 | # resource to a remote nagios server. 5 | # 6 | # Example: 7 | # 8 | # nagios::host::remote { $fqdn: 9 | # ensure => "present", 10 | # export_for => "nagios-nsca.example.com", 11 | # } 12 | # 13 | define nagios::host::remote ( 14 | $export_for, 15 | $ensure = present, 16 | $address = false, 17 | $nagios_alias = undef, 18 | $hostgroups = undef, 19 | $contact_groups = undef, 20 | ) { 21 | 22 | include ::nagios::params 23 | 24 | $fname = regsubst($name, '\W', '_', 'G') 25 | $host_address = $address ? { 26 | false => $::ipaddress, 27 | default => $address, 28 | } 29 | 30 | nagios_host {$name: 31 | ensure => $ensure, 32 | use => 'generic-host-active', 33 | host_name => $name, 34 | address => $host_address, 35 | # lint:ignore:alias_parameter 36 | alias => $nagios_alias, 37 | # lint:endignore 38 | target => "${nagios::params::resourcedir}/host-${fname}.cfg", 39 | notify => Exec['nagios-restart'], 40 | } 41 | 42 | file { "${nagios::params::resourcedir}/host-${fname}.cfg": 43 | ensure => $ensure, 44 | owner => 'root', 45 | mode => '0644', 46 | before => Nagios_host[$name], 47 | } 48 | 49 | @@nagios::host {$name: 50 | ensure => $ensure, 51 | address => $host_address, 52 | nagios_alias => $nagios_alias, 53 | hostgroups => $hostgroups, 54 | contact_groups => $contact_groups, 55 | use => 'generic-host-active', 56 | tag => $export_for, 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /manifests/init.pp: -------------------------------------------------------------------------------- 1 | class nagios( 2 | Enum['present', 'absent'] $ensure = 'present', 3 | $use_syslog = '1', 4 | $check_ping_ipv = undef, 5 | $nrpe_server_tag = $::fqdn, 6 | $nsca_server_tag = $::fqdn, 7 | $niceness = 5, 8 | ) { 9 | case $::osfamily { 10 | 'Debian': { include ::nagios::debian } 11 | 'RedHat': { include ::nagios::redhat } 12 | default: { fail ("OS family ${::osfamily} not yet implemented !")} 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /manifests/local/hostgroup.pp: -------------------------------------------------------------------------------- 1 | # == Definition: nagios::local::hostgroup 2 | # 3 | # Define a hostgroup resource on the local nagios instance. 4 | # 5 | # Example: 6 | # 7 | # nagios::local::hostgroup { "my-hostgroup": 8 | # ensure => present, 9 | # } 10 | # 11 | define nagios::local::hostgroup ($ensure=present) { 12 | 13 | include ::nagios::params 14 | 15 | $fname = regsubst($name, '\W', '_', 'G') 16 | 17 | nagios_hostgroup { $name: 18 | ensure => $ensure, 19 | target => "${nagios::params::resourcedir}/hostgroup-${fname}.cfg", 20 | notify => Exec['nagios-restart'], 21 | } 22 | 23 | file { "${nagios::params::resourcedir}/hostgroup-${fname}.cfg": 24 | ensure => $ensure, 25 | owner => 'root', 26 | mode => '0644', 27 | before => Nagios_hostgroup[$name], 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /manifests/nrpe/client.pp: -------------------------------------------------------------------------------- 1 | # == Class: nagios::nrpe::client 2 | # 3 | # Installs nrpe and ensures the service is up and running. 4 | # 5 | # NB: the class name can be confusing. The idea is that leaf nodes are nagios 6 | # "clients", even if they run a service such as nrpe. 7 | # 8 | # Example usage: 9 | # 10 | # include nagios 11 | # include nagios::nrpe::client 12 | # 13 | class nagios::nrpe::client ( 14 | Enum['present', 'absent'] $ensure = 'present', 15 | ) { 16 | case $ensure { 17 | 'present': { 18 | $pkg_ensure = $ensure 19 | } 20 | 21 | default: { 22 | $pkg_ensure = $::osfamily ? { 23 | 'RedHat' => 'absent', 24 | 'Debian' => 'purged', 25 | } 26 | } 27 | } 28 | 29 | $package_name = $::osfamily ? { 30 | 'Debian' => 'nagios-nrpe-server', 31 | 'RedHat' => 'nrpe', 32 | } 33 | 34 | $service_name = $::osfamily ? { 35 | 'Debian' => 'nagios-nrpe-server', 36 | 'RedHat' => 'nrpe', 37 | } 38 | 39 | package { 'nrpe': 40 | ensure => $pkg_ensure, 41 | name => $package_name, 42 | } 43 | 44 | $nologin_path = $::osfamily ? { 45 | 'Debian' => '/usr/sbin/nologin', 46 | 'RedHat' => '/sbin/nologin', 47 | } 48 | 49 | user{ 'nrpe': 50 | ensure => $ensure, 51 | shell => $nologin_path, 52 | require => Package['nrpe'], 53 | } 54 | 55 | if $::osfamily == 'RedHat' and $::operatingsystemmajrelease == '7' { 56 | $provider = 'redhat' 57 | } else { 58 | $provider = undef 59 | } 60 | 61 | if $::operatingsystem == 'Debian' and $::operatingsystemmajrelease == '6' { 62 | $hasstatus = false 63 | } else { 64 | $hasstatus = undef 65 | } 66 | 67 | $svc_ensure = $ensure ? { 68 | present => running, 69 | absent => stopped, 70 | } 71 | 72 | $svc_enable = $ensure ? { 73 | present => true, 74 | absent => false, 75 | } 76 | 77 | service { 'nrpe': 78 | ensure => $svc_ensure, 79 | provider => $provider, 80 | hasstatus => $hasstatus, 81 | name => $service_name, 82 | enable => $svc_enable, 83 | pattern => '/usr/sbin/nrpe', 84 | require => Package['nrpe'], 85 | } 86 | 87 | $module_path = get_module_path($module_name) 88 | augeas::lens { 'nrpe': 89 | ensure => $ensure, 90 | lens_content => file("${module_path}/files/nrpe.aug"), 91 | stock_since => '1.1.0', 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /manifests/nrpe/server.pp: -------------------------------------------------------------------------------- 1 | # == Class: nagios::nrpe::server 2 | # 3 | # Installs the check_nrpe plugin and collects the resources tagged with 4 | # "nagios-${::fqdn}". They typically got exported using nagios::service::nrpe. 5 | # 6 | # NB: the class name can be confusing. The idea is that central nodes are nagios 7 | # "servers", even if they just execute plugins. 8 | # 9 | # Example usage: 10 | # 11 | # include nagios 12 | # include nagios::nrpe::server 13 | # 14 | class nagios::nrpe::server ( 15 | Enum['present', 'absent'] $ensure = 'present', 16 | ) { 17 | include ::nagios::params 18 | 19 | case $ensure { 20 | 'present': { 21 | $pkg_ensure = $ensure 22 | } 23 | 24 | default: { 25 | $pkg_ensure = $::osfamily ? { 26 | 'RedHat' => 'absent', 27 | 'Debian' => 'purged', 28 | } 29 | } 30 | } 31 | 32 | case $::osfamily { 33 | 'Debian': { 34 | package {'nagios-nrpe-plugin': 35 | ensure => $pkg_ensure, 36 | } 37 | } 38 | 'RedHat': { 39 | package {'nagios-plugins-nrpe': 40 | ensure => $pkg_ensure, 41 | } 42 | } 43 | 44 | default: { fail ("OS family ${::osfamily} not yet implemented !")} 45 | } 46 | 47 | if $ensure == 'present' { 48 | $get_tag = "nagios-${::nagios::nrpe_server_tag}" 49 | 50 | Nagios::Host <<| tag == $get_tag |>> 51 | Nagios_service <<| tag == $get_tag |>> 52 | Nagios_command <<| tag == $get_tag |>> 53 | File <<| tag == $get_tag |>> 54 | 55 | Nagios_host { require => File[$nagios::params::resourcedir] } 56 | Nagios_service { require => File[$nagios::params::resourcedir] } 57 | Nagios_command { require => File[$nagios::params::resourcedir] } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /manifests/nsca/client.pp: -------------------------------------------------------------------------------- 1 | # == Class: nagios::nsca::client 2 | # 3 | # Installs the nsca client and configures nagios to send status information to 4 | # the central nsca server. 5 | # 6 | # Example usage: 7 | # 8 | # include nagios 9 | # include nagios::nsca::client 10 | # 11 | class nagios::nsca::client( 12 | $nsca_server, 13 | Enum['present', 'absent'] $ensure = 'present', 14 | ) { 15 | 16 | include ::nagios::params 17 | 18 | case $ensure { 19 | 'present': { 20 | $pkg_ensure = $ensure 21 | } 22 | 23 | default: { 24 | $pkg_ensure = $::osfamily ? { 25 | 'RedHat' => 'absent', 26 | 'Debian' => 'purged', 27 | } 28 | } 29 | } 30 | 31 | if !defined (Package['nsca']) { 32 | package {'nsca': 33 | ensure => $pkg_ensure; 34 | } 35 | } 36 | 37 | if $::osfamily == 'RedHat' { 38 | if !defined (Package['nsca-client']) { 39 | package { 'nsca-client': ensure => $pkg_ensure } 40 | } 41 | } 42 | 43 | # variables used in ERB template 44 | $nsca_cfg = "${nagios::params::rootdir}/send_nsca.cfg" 45 | 46 | $file_ensure = $nagios::ensure ? { 47 | present => file, 48 | default => absent, 49 | } 50 | 51 | file { "${nagios::params::rootdir}/send_nsca.cfg": 52 | ensure => $file_ensure, 53 | owner => root, 54 | group => nagios, 55 | mode => '0640', 56 | content => template('nagios/send_nsca.cfg.erb'), 57 | require => [Package['nsca'], Package['nagios']], 58 | notify => Service['nagios'], 59 | } 60 | 61 | file {'/usr/local/bin/submit_ocsp': 62 | ensure => $file_ensure, 63 | owner => root, 64 | group => root, 65 | mode => '0755', 66 | content => template('nagios/submit_ocsp.erb'), 67 | require => File["${nagios::params::rootdir}/send_nsca.cfg"], 68 | } 69 | 70 | file {'/usr/local/bin/submit_ochp': 71 | ensure => $file_ensure, 72 | owner => root, 73 | group => root, 74 | mode => '0755', 75 | content => template('nagios/submit_ochp.erb'), 76 | require => File["${nagios::params::rootdir}/send_nsca.cfg"], 77 | } 78 | 79 | file { "${nagios::params::resourcedir}/command-submit_ocsp.cfg": 80 | ensure => $file_ensure, 81 | owner => 'root', 82 | mode => '0644', 83 | } 84 | 85 | nagios_command {'submit_ocsp': 86 | ensure => $ensure, 87 | command_line => '/usr/local/bin/submit_ocsp $HOSTNAME$ \'$SERVICEDESC$\' $SERVICESTATEID$ \'$SERVICEOUTPUT$\'', 88 | target => "${nagios::params::resourcedir}/command-submit_ocsp.cfg", 89 | notify => Exec['nagios-restart'], 90 | require => File["${nagios::params::resourcedir}/command-submit_ocsp.cfg"], 91 | } 92 | 93 | file { "${nagios::params::resourcedir}/command-submit_ochp.cfg": 94 | ensure => $file_ensure, 95 | owner => 'root', 96 | mode => '0644', 97 | } 98 | 99 | nagios_command {'submit_ochp': 100 | ensure => $ensure, 101 | command_line => '/usr/local/bin/submit_ochp $HOSTNAME$ $HOSTSTATE$ \'$HOSTOUTPUT$\'', 102 | target => "${nagios::params::resourcedir}/command-submit_ochp.cfg", 103 | notify => Exec['nagios-restart'], 104 | require => File["${nagios::params::resourcedir}/command-submit_ochp.cfg"], 105 | } 106 | 107 | concat::fragment {'submit_ocsp': 108 | target => $nagios::params::conffile, 109 | content => "ocsp_command=submit_ocsp\n", 110 | } 111 | 112 | concat::fragment {'submit_ochp': 113 | target => $nagios::params::conffile, 114 | content => "ochp_command=submit_ochp\n", 115 | } 116 | 117 | #TODO: remove this resource in a while 118 | file { '/etc/send_nsca.cfg': ensure => absent } 119 | 120 | } 121 | -------------------------------------------------------------------------------- /manifests/nsca/server.pp: -------------------------------------------------------------------------------- 1 | # == Class: nagios::nsca::server 2 | # 3 | # Installs and configures the nsca server and ensure it's up and running. This 4 | # class also collects the resources tagged with "nagios-${fqdn}". They typically 5 | # got exported using nagios::service::nsca. 6 | # 7 | # Example usage: 8 | # 9 | # include nagios 10 | # include nagios::nsca::server 11 | # 12 | class nagios::nsca::server( 13 | Enum['present', 'absent'] $ensure = 'present', 14 | $decryption_method = '0', 15 | 16 | $debug = 0, 17 | ) { 18 | 19 | include ::nagios::params 20 | 21 | case $ensure { 22 | 'present': { 23 | $pkg_ensure = $ensure 24 | } 25 | 26 | default: { 27 | $pkg_ensure = $::osfamily ? { 28 | 'RedHat' => 'absent', 29 | 'Debian' => 'purged', 30 | } 31 | } 32 | } 33 | 34 | # variables used in ERB template 35 | $basename = $nagios::params::basename 36 | 37 | if !defined (Package['nsca']) { 38 | package {'nsca': 39 | ensure => $pkg_ensure; 40 | } 41 | } 42 | 43 | $svc_ensure = $nagios::ensure ? { 44 | present => running, 45 | default => stopped, 46 | } 47 | 48 | $svc_enable = $nagios::ensure ? { 49 | present => true, 50 | default => false, 51 | } 52 | 53 | service {'nsca': 54 | ensure => $svc_ensure, 55 | enable => $svc_enable, 56 | hasrestart => true, 57 | hasstatus => false, 58 | pattern => '/usr/sbin/nsca', 59 | require => Package['nsca'], 60 | } 61 | 62 | if $ensure == 'present' { 63 | $get_tag = "nagios-${::nagios::nsca_server_tag}" 64 | 65 | Nagios::Host <<| tag == $get_tag |>> 66 | Nagios_service <<| tag == $get_tag |>> 67 | Nagios_command <<| tag == $get_tag |>> 68 | File <<| tag == $get_tag |>> 69 | } 70 | 71 | Nagios_host { require => File[$nagios::params::resourcedir] } 72 | Nagios_service { require => File[$nagios::params::resourcedir] } 73 | Nagios_command { require => File[$nagios::params::resourcedir] } 74 | 75 | $nsca_group = $::osfamily ? { 76 | 'Debian' => 'nogroup', 77 | 'RedHat' => 'nagios', 78 | } 79 | 80 | $nagios_nsca_cfg = $::osfamily ? { 81 | 'Debian' => '/etc/nsca.cfg', 82 | 'RedHat' => "${nagios::params::rootdir}/nsca.cfg", 83 | } 84 | 85 | $command_file = $::osfamily ? { 86 | 'Debian' => '/var/lib/nagios3/rw/nagios.cmd', 87 | 'RedHat' => '/var/spool/nagios/cmd/nagios.cmd', 88 | } 89 | 90 | $alternate_dump_file = $::osfamily ? { 91 | 'Debian' => '/var/run/nagios/nsca.dump', 92 | 'RedHat' => '/var/spool/nagios/cmd/nsca.dump', 93 | } 94 | 95 | $file_ensure = $nagios::ensure ? { 96 | present => file, 97 | default => absent, 98 | } 99 | 100 | file {$nagios_nsca_cfg: 101 | ensure => $file_ensure, 102 | owner => root, 103 | group => nagios, 104 | mode => '0640', 105 | content => template('nagios/nsca.cfg.erb'), 106 | require => [Package['nsca'], Package['nagios']], 107 | notify => Service['nsca'], 108 | } 109 | 110 | } 111 | -------------------------------------------------------------------------------- /manifests/params.pp: -------------------------------------------------------------------------------- 1 | # == Class: nagios::params 2 | # 3 | # This class defines a few of attributes which are used in many classes and 4 | # definitions of this module. 5 | # 6 | class nagios::params { 7 | 8 | $basename = $::osfamily ? { 9 | 'Debian' => 'nagios3', 10 | 'RedHat' => 'nagios', 11 | } 12 | 13 | $user1 = $::osfamily ? { 14 | 'Debian' => '/usr/lib/nagios/plugins', 15 | 'RedHat' => $::architecture ? { 16 | 'x86_64' => '/usr/lib64/nagios/plugins', 17 | default => '/usr/lib/nagios/plugins', 18 | }, 19 | } 20 | 21 | $p1file = $::osfamily ? { 22 | 'Debian' => '/usr/lib/nagios3/p1.pl', 23 | 'RedHat' => '/usr/sbin/p1.pl', 24 | } 25 | 26 | $resourcedir = '/etc/nagios.d' 27 | $rootdir = "/etc/${basename}" 28 | $conffile = "${rootdir}/nagios.cfg" 29 | 30 | case $::osfamily { 31 | 'RedHat': { 32 | if versioncmp($::operatingsystemmajrelease, '5') <= 0 { 33 | $pidfile = "/var/run/${basename}.pid" 34 | } else { 35 | $pidfile = "/var/run/${basename}/${basename}.pid" 36 | } 37 | } 38 | default: { 39 | $pidfile = "/var/run/${basename}/${basename}.pid" 40 | } 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /manifests/redhat.pp: -------------------------------------------------------------------------------- 1 | # == Class: nagios::redhat 2 | # 3 | # Define common resources specific to redhat based systems. It shouldn't be 4 | # necessary to include this class directly. Instead, you should use: 5 | # 6 | # include nagios 7 | # 8 | class nagios::redhat inherits nagios::base { 9 | assert_private() 10 | 11 | include ::nagios::params 12 | 13 | # Common resources between base, redhat, and debian 14 | 15 | package { 'nagios': 16 | ensure => $nagios::ensure, 17 | } 18 | 19 | # redhat specific resources below 20 | 21 | file {'/etc/default/nagios': ensure => absent } 22 | 23 | file {'/etc/nagios3': ensure => absent } 24 | 25 | file {'/etc/httpd/conf.d/nagios.conf': 26 | ensure => absent, 27 | require => Package['nagios'], 28 | } 29 | 30 | case $::operatingsystemmajrelease { 31 | 32 | '5','6': { 33 | File[ 34 | '/var/log/nagios', 35 | '/var/lib/nagios', 36 | '/var/lib/nagios/spool', 37 | '/var/lib/nagios/spool/checkresults', 38 | '/var/cache/nagios' 39 | ] { 40 | seltype => 'nagios_log_t', 41 | } 42 | 43 | Service['nagios'] { 44 | hasstatus => false, 45 | pattern => '/usr/sbin/nagios -d /etc/nagios/nagios.cfg', 46 | } 47 | 48 | # workaround broken init-script 49 | Exec['nagios-restart'] { 50 | command => "nagios -v ${nagios::params::conffile} && pkill -P 1 -f '^/usr/sbin/nagios' && /etc/init.d/nagios start", 51 | } 52 | 53 | Exec['nagios-reload'] { 54 | command => "nagios -v ${nagios::params::conffile} && pkill -P 1 -HUP -f '^/usr/sbin/nagios'", 55 | } 56 | } 57 | 58 | '7': { 59 | Service['nagios'] { 60 | provider => 'redhat', 61 | } 62 | 63 | Exec['nagios-restart'] { 64 | command => "nagios -v ${nagios::params::conffile} && systemctl restart nagios.service", 65 | } 66 | 67 | Exec['nagios-reload'] { 68 | command => "nagios -v ${nagios::params::conffile} && systemctl reload nagios.service", 69 | } 70 | 71 | } 72 | 73 | default: { 74 | fail "nagios::redhat doesn't support ${::operatingsystemmajrelease} yet" 75 | } 76 | 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /manifests/resource.pp: -------------------------------------------------------------------------------- 1 | # == Definition: nagios::resource 2 | # 3 | # Add macros to nagios's resource.cfg configuration file. 4 | # 5 | # Example: 6 | # 7 | # nagios::resource { "USER1": 8 | # value => "/usr/lib/nagios/plugins", 9 | # } 10 | # 11 | # Further reading: 12 | # http://nagios.sourceforge.net/docs/3_0/configmain.html#resource_file 13 | # 14 | define nagios::resource( 15 | $value, 16 | ) { 17 | 18 | include ::nagios::params 19 | 20 | concat::fragment {$name: 21 | target => "${nagios::params::rootdir}/resource.cfg", 22 | content => "\$${name}\$=\"${value}\"\n", 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /manifests/service/local.pp: -------------------------------------------------------------------------------- 1 | # == Definition: nagios::service::local 2 | # 3 | # Define a service resource on the local nagios instance. 4 | # 5 | # Example: 6 | # 7 | # nagios::service::local { 'check process': 8 | # ensure => present, 9 | # command_line => '$USER1$/check_procs', 10 | # normal_check_interval => 5, 11 | # package => 'nagios-plugins-procs', 12 | # } 13 | 14 | define nagios::service::local ( 15 | $command_line, 16 | $codename, 17 | $ensure=present, 18 | $service_description=undef, 19 | $host_name=false, 20 | $check_command=false, 21 | $contact_groups=undef, 22 | $service_groups=undef, 23 | $normal_check_interval=undef, 24 | $retry_check_interval=undef, 25 | $max_check_attempts=undef, 26 | $package=false, 27 | $use='generic-service-active', 28 | ) { 29 | 30 | include ::nagios::params 31 | 32 | $fname = regsubst($name, '\W', '_', 'G') 33 | 34 | $nagios_service_host_name = $host_name ? { 35 | false => $::hostname, 36 | default => $host_name, 37 | } 38 | $nagios_service_check_command = $check_command ? { 39 | false => $name, 40 | default => $check_command, 41 | } 42 | 43 | nagios_service { $name: 44 | ensure => $ensure, 45 | use => $use, 46 | host_name => $nagios_service_host_name, 47 | check_command => $nagios_service_check_command, 48 | service_description => $service_description, 49 | contact_groups => $contact_groups, 50 | servicegroups => $service_groups, 51 | normal_check_interval => $normal_check_interval, 52 | retry_check_interval => $retry_check_interval, 53 | max_check_attempts => $max_check_attempts, 54 | target => "${nagios::params::resourcedir}/service-${fname}.cfg", 55 | require => Nagios::Command[$codename], 56 | notify => Exec['nagios-restart'], 57 | } 58 | 59 | file { "${nagios::params::resourcedir}/service-${fname}.cfg": 60 | ensure => $ensure, 61 | owner => 'root', 62 | mode => '0644', 63 | before => Nagios_service[$name], 64 | } 65 | 66 | nagios::command { $codename: 67 | ensure => $ensure, 68 | command_line => $command_line, 69 | } 70 | 71 | if $package { 72 | if !defined(Package[$package]) { 73 | package { $package: 74 | ensure => present, 75 | } 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /manifests/service/nrpe.pp: -------------------------------------------------------------------------------- 1 | # == Definition: nagios::service::nrpe 2 | # 3 | # Define a command in the local nrpe server configuration, and export the 4 | # associated nagios service and command resources to a remote nagios instance. 5 | # 6 | # Example: 7 | # 8 | # nagios::service::nrpe { 'check process': 9 | # ensure => present, 10 | # command_line => '/usr/lib/nagios/plugins/check_procs', 11 | # normal_check_interval => 5, 12 | # package => 'nagios-plugins-procs', 13 | # export_for => 'nagios-nrpe.example.com', 14 | # } 15 | # 16 | define nagios::service::nrpe ( 17 | $export_for, 18 | $command_line, 19 | $ensure = present, 20 | $service_description = undef, 21 | $host_name = false, 22 | $contact_groups = undef, 23 | $service_groups = undef, 24 | $normal_check_interval = undef, 25 | $retry_check_interval = undef, 26 | $max_check_attempts = undef, 27 | $package = false, 28 | ) { 29 | 30 | include ::nagios::params 31 | 32 | $fname = regsubst($name, '\W', '_', 'G') 33 | 34 | nrpe_command {$name: 35 | ensure => present, 36 | command => $command_line, 37 | notify => Service['nrpe'], 38 | require => Package['nrpe'], 39 | } 40 | 41 | $service_host_name = $host_name ? { 42 | false => $::hostname, 43 | default => $host_name, 44 | } 45 | 46 | @@nagios_service { "@@${name} on ${::hostname}": 47 | ensure => $ensure, 48 | use => 'generic-service-active', 49 | host_name => $service_host_name, 50 | check_command => "nrpe_${name}_on_${::hostname}", 51 | tag => $export_for, 52 | service_description => $service_description, 53 | contact_groups => $contact_groups, 54 | servicegroups => $service_groups, 55 | normal_check_interval => $normal_check_interval, 56 | retry_check_interval => $retry_check_interval, 57 | max_check_attempts => $max_check_attempts, 58 | target => "${nagios::params::resourcedir}/collected-service-${fname}_on_${::hostname}.cfg", 59 | require => Nagios_command["nrpe_${name}_on_${::hostname}"], 60 | notify => Exec['nagios-restart'], 61 | } 62 | 63 | @@file { "${nagios::params::resourcedir}/collected-service-${fname}_on_${::hostname}.cfg": 64 | ensure => $ensure, 65 | owner => 'root', 66 | mode => '0644', 67 | tag => $export_for, 68 | } 69 | 70 | @@nagios_command { "nrpe_${name}_on_${::hostname}": 71 | ensure => $ensure, 72 | command_line => "\$USER1\$/check_nrpe -H ${::fqdn} -u -t 120 -c ${name}", 73 | target => "${nagios::params::resourcedir}/collected-command-nrpe_${fname}_on_${::hostname}.cfg", 74 | tag => $export_for, 75 | notify => Exec['nagios-restart'], 76 | } 77 | 78 | @@file { "${nagios::params::resourcedir}/collected-command-nrpe_${fname}_on_${::hostname}.cfg": 79 | ensure => $ensure, 80 | owner => 'root', 81 | mode => '0644', 82 | tag => $export_for, 83 | } 84 | 85 | if $package { 86 | if !defined(Package[$package]) { 87 | package { $package: 88 | ensure => present, 89 | } 90 | } 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /manifests/service/nsca.pp: -------------------------------------------------------------------------------- 1 | # == Definition: nagios::service::nsca 2 | # 3 | # Define a service resource on the local nagios instance and export the same 4 | # resource to a remote nagios nsca server. 5 | # 6 | # Example: 7 | # 8 | # nagios::service::nsca { 'check process': 9 | # ensure => present, 10 | # command_line => '/usr/lib/nagios/plugins/check_procs', 11 | # normal_check_interval => 5, 12 | # package => 'nagios-plugins-procs', 13 | # export_for => 'nagios-nsca.example.com', 14 | # } 15 | # 16 | define nagios::service::nsca ( 17 | $export_for, 18 | $command_line, 19 | $codename, 20 | $ensure = present, 21 | $service_description = false, 22 | $host_name = false, 23 | $contact_groups = undef, 24 | $service_groups = undef, 25 | $normal_check_interval = undef, 26 | $retry_check_interval = undef, 27 | $max_check_attempts = undef, 28 | $use_active = 'generic-service-active', 29 | $use_passive = 'generic-service-passive', 30 | $package = false, 31 | ) { 32 | 33 | include ::nagios::params 34 | 35 | $fname = regsubst($name, '\W', '_', 'G') 36 | 37 | $nagios_host_name = $host_name ? { 38 | false => $::hostname, 39 | default => $host_name, 40 | } 41 | 42 | nagios::service::local { $name: 43 | ensure => $ensure, 44 | use => $use_active, 45 | command_line => $command_line, 46 | codename => $codename, 47 | host_name => $nagios_host_name, 48 | contact_groups => $contact_groups, 49 | service_groups => $service_groups, 50 | normal_check_interval => $normal_check_interval, 51 | retry_check_interval => $retry_check_interval, 52 | max_check_attempts => $max_check_attempts, 53 | service_description => $service_description, 54 | } 55 | 56 | @@nagios_service { "@@${name} on ${::hostname}": 57 | ensure => $ensure, 58 | use => $use_passive, 59 | host_name => $nagios_host_name, 60 | tag => $export_for, 61 | target => "${nagios::params::resourcedir}/collected-service-${fname}_on_${::hostname}.cfg", 62 | notify => Exec['nagios-restart'], 63 | contact_groups => $contact_groups, 64 | servicegroups => $service_groups, 65 | normal_check_interval => $normal_check_interval, 66 | retry_check_interval => $retry_check_interval, 67 | max_check_attempts => $max_check_attempts, 68 | service_description => $service_description, 69 | } 70 | 71 | @@file { "${nagios::params::resourcedir}/collected-service-${fname}_on_${::hostname}.cfg": 72 | ensure => $ensure, 73 | owner => 'root', 74 | mode => '0644', 75 | tag => $export_for, 76 | } 77 | 78 | if $package { 79 | if !defined(Package[$package]) { 80 | package { $package: 81 | ensure => present, 82 | } 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /manifests/service/remote.pp: -------------------------------------------------------------------------------- 1 | # == Definition: nagios::service::remote 2 | # 3 | # Define a service resource on a remote nagios instance using exported 4 | # resources. 5 | # 6 | # Example: 7 | # 8 | # nagios::service::remote { "check ssh": 9 | # ensure => present, 10 | # command_line => '/usr/lib/nagios/plugins/check_ssh', 11 | # normal_check_interval => 5, 12 | # export_for => "nagios-nsca.example.com", 13 | # } 14 | # 15 | define nagios::service::remote ( 16 | $export_for, 17 | $command_line, 18 | $ensure = present, 19 | $service_description = undef, 20 | $host_name = false, 21 | $contact_groups = undef, 22 | $service_groups = undef, 23 | $normal_check_interval = undef, 24 | $retry_check_interval = undef, 25 | $max_check_attempts = undef, 26 | ) { 27 | 28 | include ::nagios::params 29 | 30 | $fname = regsubst($name, '\W', '_', 'G') 31 | 32 | $nagios_host_name = $host_name ? { 33 | false => $::hostname, 34 | default => $host_name, 35 | } 36 | 37 | @@nagios_service { "@@${name} on ${::hostname}": 38 | ensure => $ensure, 39 | use => 'generic-service-active', 40 | host_name => $nagios_host_name, 41 | check_command => "${name}_on_${::hostname}", 42 | tag => $export_for, 43 | service_description => $service_description, 44 | contact_groups => $contact_groups, 45 | servicegroups => $service_groups, 46 | normal_check_interval => $normal_check_interval, 47 | retry_check_interval => $retry_check_interval, 48 | max_check_attempts => $max_check_attempts, 49 | target => "${nagios::params::resourcedir}/collected-service-${fname}_on_${::hostname}.cfg", 50 | require => Nagios_command["${name}_on_${::hostname}"], 51 | notify => Exec['nagios-restart'], 52 | } 53 | 54 | @@file { "${nagios::params::resourcedir}/collected-service-${fname}_on_${::hostname}.cfg": 55 | ensure => $ensure, 56 | owner => 'root', 57 | mode => '0644', 58 | tag => $export_for, 59 | } 60 | 61 | @@nagios_command { "${name}_on_${::hostname}": 62 | ensure => $ensure, 63 | command_line => $command_line, 64 | target => "${nagios::params::resourcedir}/collected-command-${fname}_on_${::hostname}.cfg", 65 | tag => $export_for, 66 | notify => Exec['nagios-restart'], 67 | } 68 | 69 | @@file { "${nagios::params::resourcedir}/collected-command-${fname}_on_${::hostname}.cfg": 70 | ensure => $ensure, 71 | owner => 'root', 72 | mode => '0644', 73 | tag => $export_for, 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /manifests/template.pp: -------------------------------------------------------------------------------- 1 | # == Definition: nagios::template 2 | # 3 | # Simple wrapper around a file resource, to ease nagios template creation. 4 | # 5 | # Example: 6 | # 7 | # nagios::template {"generic-service-active": 8 | # conf_type => "service", 9 | # content => " 10 | # use generic-service 11 | # active_checks_enabled 1 12 | # register 0", 13 | # } 14 | # 15 | define nagios::template( 16 | $content, 17 | $conf_type, 18 | $ensure = present, 19 | ) { 20 | 21 | include ::nagios::params 22 | 23 | # set rights and owner 24 | file {"${nagios::params::resourcedir}/${conf_type}-${name}.cfg": 25 | ensure => $ensure, 26 | owner => root, 27 | group => root, 28 | mode => '0644', 29 | content => template('nagios/template-all.erb'), 30 | notify => Exec['nagios-restart'], 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /manifests/webadmin.pp: -------------------------------------------------------------------------------- 1 | # == Definition: nagios::webadmin 2 | # 3 | # Simple wrapper to ease apache configuration for nagios. 4 | # 5 | define nagios::webadmin( 6 | $vhost, 7 | $htpasswd_file, 8 | $ensure = present, 9 | ) { 10 | 11 | file {"/var/www/${vhost}/conf/nagios.conf": 12 | ensure => $ensure, 13 | owner => root, 14 | group => root, 15 | mode => '0644', 16 | content => template('nagios/apache.conf.erb'), 17 | notify => Exec['apache-graceful'], 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /manifests/webinterface.pp: -------------------------------------------------------------------------------- 1 | # == Class: nagios::webinterface 2 | # 3 | # This class takes care of all the bits needed to run the CGIs used to display 4 | # nagios's status in a web browser. 5 | # 6 | # Example usage: 7 | # include nagios 8 | # include nagios::webinterface 9 | # 10 | class nagios::webinterface( 11 | $authorized_for_system_information = 'nagiosadmin', 12 | $authorized_for_configuration_information = 'nagiosadmin', 13 | $authorized_for_system_commands = 'nagiosadmin', 14 | $authorized_for_all_services = 'nagiosadmin', 15 | $authorized_for_all_hosts = 'nagiosadmin', 16 | $authorized_for_all_host_commands = 'nagiosadmin', 17 | $authorized_for_all_service_commands = 'nagiosadmin', 18 | $use_authentication = '1', 19 | $default_user_name = undef, 20 | 21 | $action_url_target = '_blank', 22 | $default_statusmap_layout = 5, 23 | $default_statuswrl_layout = 4, 24 | $escape_html_tags = 1, 25 | $lock_author_names = 1, 26 | $notes_url_target = '_blank', 27 | $ping_syntax = '/bin/ping -n -U -c 5 $HOSTADDRESS$', 28 | $result_limit = 100, 29 | $refresh_rate = 90, 30 | $show_context_help = 0, 31 | $use_pending_states = 1, 32 | ) { 33 | 34 | include ::nagios::params 35 | 36 | # variables used in erb template. 37 | $nagios_main_config_file = $nagios::params::conffile 38 | $nagios_physical_html_path = "/usr/share/${nagios::params::basename}" 39 | $nagios_url_html_path = "/${nagios::params::basename}" 40 | $nagios_nagios_check_command = "${nagios::params::user1}/check_nagios /var/cache/${nagios::params::basename}/status.dat 5 '/usr/sbin/${nagios::params::basename}'" 41 | 42 | file {"${nagios::params::rootdir}/cgi.cfg": 43 | ensure => file, 44 | owner => root, 45 | group => root, 46 | mode => '0644', 47 | content => template('nagios/cgi.cfg.erb'), 48 | require => Class['nagios'], 49 | notify => Exec['apache-graceful'], 50 | } 51 | 52 | case $::osfamily { 53 | 54 | 'RedHat': { 55 | package {['nagios-www', 'nagios-plugins-nagios']: 56 | ensure => present, 57 | } 58 | 59 | #SELinux - see 60 | # http://grokbase.com/post/2008/12/06/centos-trying-to-setting-a-selinux-policy-to-nagios-3-0-6-on-centos-5-2/u-x2GXaK02ZlLVNVs_Mkq0G2hDg 61 | selinux::module {'nagios-httpd': 62 | content => " 63 | module nagios-httpd 1.1; 64 | require { 65 | type var_t; 66 | type httpd_t; 67 | type nagios_log_t; 68 | type httpd_nagios_script_t; 69 | class fifo_file { write getattr read create }; 70 | class file { rename setattr read create write getattr unlink }; 71 | } 72 | #============= httpd_nagios_script_t ============== 73 | allow httpd_nagios_script_t var_t:fifo_file { write getattr }; 74 | allow httpd_nagios_script_t var_t:file { read getattr }; 75 | #============= httpd_t ============== 76 | allow httpd_t nagios_log_t:file read; 77 | ", 78 | } 79 | } 80 | 81 | 'Debian': { 82 | 83 | package {'nagios3-cgi': 84 | ensure => present, 85 | } 86 | 87 | file {'/etc/apache2/conf.d/nagios3.conf': 88 | ensure => absent, 89 | notify => Exec['apache-graceful'], 90 | } 91 | } 92 | 93 | default: { 94 | fail "Unknown osfamily: ${::osfamily}" 95 | } 96 | } 97 | 98 | include ::nagios::base::withwebinterface 99 | 100 | } 101 | -------------------------------------------------------------------------------- /metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "camptocamp-nagios", 3 | "version": "1.0.37", 4 | "author": "Camptocamp", 5 | "summary": "Puppet Nagios module", 6 | "license": "Apache-2.0", 7 | "source": "https://github.com/camptocamp/puppet-nagios", 8 | "project_page": "https://github.com/camptocamp/puppet-nagios", 9 | "issues_url": "https://github.com/camptocamp/puppet-nagios/issues", 10 | "dependencies": [ 11 | { 12 | "name": "camptocamp/selinux", 13 | "version_requirement": ">=0.1.0 <1.0.0" 14 | }, 15 | { 16 | "name": "puppetlabs/concat", 17 | "version_requirement": ">=1.0.0 <2.0.0" 18 | }, 19 | { 20 | "name": "puppetlabs/stdlib", 21 | "version_requirement": ">=3.2.0 <5.0.0" 22 | } 23 | ], 24 | "requirements": [ 25 | { 26 | "name": "puppet", 27 | "version_requirement": "3.x" 28 | } 29 | ], 30 | "operatingsystem_support": [ 31 | { 32 | "operatingsystem": "Debian", 33 | "operatingsystemrelease": [ 34 | "6", 35 | "7", 36 | "8" 37 | ] 38 | }, 39 | { 40 | "operatingsystem": "Ubuntu", 41 | "operatingsystemrelease": [ 42 | "12.04", 43 | "14.04", 44 | "16.04" 45 | ] 46 | }, 47 | { 48 | "operatingsystem": "RedHat", 49 | "operatingsystemrelease": [ 50 | "5", 51 | "6", 52 | "7" 53 | ] 54 | } 55 | ] 56 | } 57 | -------------------------------------------------------------------------------- /spec/acceptance/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_acceptance' 2 | 3 | describe 'nagios class' do 4 | 5 | context 'with default parameters' do 6 | it 'should idempotently install' do 7 | pp = <<-EOS 8 | Exec { path => '/usr/bin:/usr/sbin/:/bin:/sbin:/usr/local/bin:/usr/local/sbin' } 9 | 10 | if $::osfamily == 'RedHat' { 11 | class {'::selinux::base':} 12 | 13 | yumrepo {'epel': 14 | baseurl => 'http://mirror.switch.ch/ftp/mirror/epel/7/$basearch', 15 | enabled => 1, 16 | gpgcheck => 0, 17 | } 18 | } 19 | 20 | class { '::nagios': } 21 | 22 | nagios::template {'generic-service': 23 | conf_type => 'service', 24 | content => " 25 | active_checks_enabled 0 26 | passive_checks_enabled 0 27 | parallelize_check 1 28 | obsess_over_service 1 29 | check_freshness 0 30 | notifications_enabled 1 31 | event_handler_enabled 1 32 | flap_detection_enabled 1 33 | failure_prediction_enabled 1 34 | process_perf_data 1 35 | retain_status_information 1 36 | retain_nonstatus_information 1 37 | notification_interval 0 38 | is_volatile 0 39 | check_period 24x7 40 | normal_check_interval 5 41 | retry_check_interval 1 42 | max_check_attempts 4 43 | notification_period 24x7 44 | notification_options w,u,c,r 45 | contact_groups admins 46 | register 0", 47 | } 48 | 49 | nagios::template {'generic-service-active': 50 | conf_type => 'service', 51 | content => " 52 | use generic-service 53 | active_checks_enabled 1 54 | register 0", 55 | } 56 | 57 | nagios::host { $::hostname:} 58 | 59 | nagios::service::local {'check_ssh_process': 60 | use => 'generic-service-active', 61 | command_line => '/usr/lib/nagios/plugins/check_procs -p 1 -w 1: -c 1: -C sshd', 62 | codename => 'check_ssh_process', 63 | service_description => 'check_ssh', 64 | } 65 | EOS 66 | 67 | # Run it twice and test for idempotency 68 | apply_manifest(pp, :catch_failures => true) 69 | expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero 70 | end 71 | 72 | describe service('nagios') do 73 | it { should be_running } 74 | it { should be_enabled } 75 | end 76 | end 77 | 78 | end 79 | 80 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/centos-5.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-5-x64: 3 | default_apply_opts: 4 | order: random 5 | strict_variables: 6 | platform: el-5-x86_64 7 | hypervisor : docker 8 | image: tianon/centos:5.10 9 | docker_preserve_image: true 10 | docker_cmd: '["/sbin/init"]' 11 | docker_image_commands: 12 | - 'yum install -y crontabs tar wget which' 13 | - 'sed -i -e "/mingetty/d" /etc/inittab' 14 | CONFIG: 15 | type: aio 16 | log_level: debug 17 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/centos-6.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-6-x64: 3 | default_apply_opts: 4 | order: random 5 | strict_variables: 6 | platform: el-6-x86_64 7 | hypervisor : docker 8 | image: centos:6 9 | docker_preserve_image: true 10 | docker_cmd: '["/sbin/init"]' 11 | docker_image_commands: 12 | - 'rm -rf /var/run/network/*' 13 | - 'yum install -y crontabs tar wget' 14 | - 'rm /etc/init/tty.conf' 15 | CONFIG: 16 | type: aio 17 | log_level: debug 18 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/centos-7.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-7-x64: 3 | default_apply_opts: 4 | order: random 5 | strict_variables: 6 | platform: el-7-x86_64 7 | hypervisor : docker 8 | image: centos:7 9 | docker_preserve_image: true 10 | docker_cmd: '["/usr/sbin/init"]' 11 | docker_image_commands: 12 | - 'yum install -y crontabs tar wget iproute' 13 | CONFIG: 14 | type: aio 15 | log_level: debug 16 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/debian-6.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | debian-6-x64: 3 | default_apply_opts: 4 | order: random 5 | strict_variables: 6 | platform: debian-6-amd64 7 | hypervisor : docker 8 | image: debian/eol:squeeze 9 | docker_preserve_image: true 10 | docker_cmd: '["/sbin/init"]' 11 | docker_image_commands: 12 | - 'apt-get install -y cron locales-all net-tools wget' 13 | CONFIG: 14 | type: aio 15 | log_level: debug 16 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/debian-7.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | debian-7-x64: 3 | default_apply_opts: 4 | order: random 5 | strict_variables: 6 | platform: debian-7-amd64 7 | hypervisor : docker 8 | image: debian:7 9 | docker_preserve_image: true 10 | docker_cmd: '["/sbin/init"]' 11 | docker_image_commands: 12 | - 'apt-get install -y cron locales-all net-tools wget' 13 | CONFIG: 14 | type: aio 15 | log_level: debug 16 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/debian-8.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | debian-8-x64: 3 | default_apply_opts: 4 | order: random 5 | strict_variables: 6 | platform: debian-8-amd64 7 | hypervisor : docker 8 | image: debian:8 9 | docker_preserve_image: true 10 | docker_cmd: '["/sbin/init"]' 11 | docker_image_commands: 12 | - 'apt-get install -y cron locales-all net-tools wget' 13 | - 'rm -f /usr/sbin/policy-rc.d' 14 | CONFIG: 15 | type: aio 16 | log_level: debug 17 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/ubuntu-12.04.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu-1204-x64: 3 | default_apply_opts: 4 | order: random 5 | strict_variables: 6 | platform: ubuntu-12.04-amd64 7 | hypervisor : docker 8 | image: ubuntu:12.04 9 | docker_preserve_image: true 10 | docker_cmd: '["/sbin/init"]' 11 | docker_image_commands: 12 | - 'apt-get install -y net-tools wget' 13 | - 'locale-gen en_US.UTF-8' 14 | CONFIG: 15 | type: aio 16 | log_level: debug 17 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/ubuntu-14.04.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu-1404-x64: 3 | default_apply_opts: 4 | order: random 5 | strict_variables: 6 | platform: ubuntu-14.04-amd64 7 | hypervisor : docker 8 | image: ubuntu:14.04 9 | docker_preserve_image: true 10 | docker_cmd: '["/sbin/init"]' 11 | docker_image_commands: 12 | - 'rm /usr/sbin/policy-rc.d' 13 | - 'rm /sbin/initctl; dpkg-divert --rename --remove /sbin/initctl' 14 | - 'apt-get install -y net-tools wget' 15 | - 'locale-gen en_US.UTF-8' 16 | CONFIG: 17 | type: aio 18 | log_level: debug 19 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/ubuntu-14.10.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu-1410-x64: 3 | default_apply_opts: 4 | order: random 5 | strict_variables: 6 | platform: ubuntu-14.10-amd64 7 | hypervisor : docker 8 | image: ubuntu:14.10 9 | docker_preserve_image: true 10 | docker_cmd: '["/sbin/init"]' 11 | docker_image_commands: 12 | - 'rm /usr/sbin/policy-rc.d' 13 | - 'rm /sbin/initctl; dpkg-divert --rename --remove /sbin/initctl' 14 | - 'apt-get install -y net-tools wget' 15 | - 'locale-gen en_US.UTF-8' 16 | CONFIG: 17 | type: aio 18 | log_level: debug 19 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/ubuntu-15.04.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu-1504-x64: 3 | default_apply_opts: 4 | order: random 5 | strict_variables: 6 | platform: ubuntu-15.04-amd64 7 | hypervisor : docker 8 | image: ubuntu:15.04 9 | docker_preserve_image: true 10 | docker_cmd: '["/sbin/init"]' 11 | docker_image_commands: 12 | - 'apt-get install -y net-tools wget' 13 | - 'locale-gen en_US.UTF-8' 14 | CONFIG: 15 | type: aio 16 | log_level: debug 17 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/ubuntu-15.10.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu-1510-x64: 3 | default_apply_opts: 4 | order: random 5 | strict_variables: 6 | platform: ubuntu-15.10-amd64 7 | hypervisor : docker 8 | image: ubuntu:15.10 9 | docker_preserve_image: true 10 | docker_cmd: '["/sbin/init"]' 11 | docker_image_commands: 12 | - 'apt-get install -y net-tools wget' 13 | - 'locale-gen en_US.UTF-8' 14 | CONFIG: 15 | type: aio 16 | log_level: debug 17 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/ubuntu-16.04.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu-1604-x64: 3 | default_apply_opts: 4 | order: random 5 | strict_variables: 6 | platform: ubuntu-16.04-amd64 7 | hypervisor : docker 8 | image: ubuntu:16.04 9 | docker_preserve_image: true 10 | docker_cmd: '["/sbin/init"]' 11 | docker_image_commands: 12 | - 'apt-get install -y net-tools wget' 13 | - 'locale-gen en_US.UTF-8' 14 | CONFIG: 15 | type: aio 16 | log_level: debug 17 | -------------------------------------------------------------------------------- /spec/classes/nagios_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'nagios' do 4 | let :pre_condition do 5 | "Exec { path => '/foo', }" 6 | end 7 | 8 | on_supported_os.each do |os, facts| 9 | context "on #{os}" do 10 | let(:facts) do 11 | facts.merge({ 12 | :concat_basedir => '/foo', 13 | }) 14 | end 15 | 16 | it 'should compile' do 17 | should compile.with_all_deps 18 | end 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format 2 | s 3 | --colour 4 | --loadby 5 | mtime 6 | --backtrace 7 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'puppetlabs_spec_helper/module_spec_helper' 2 | require 'rspec-puppet-facts' 3 | include RspecPuppetFacts 4 | 5 | 6 | RSpec.configure do |c| 7 | c.include PuppetlabsSpec::Files 8 | 9 | c.before :each do 10 | # Store any environment variables away to be restored later 11 | @old_env = {} 12 | ENV.each_key {|k| @old_env[k] = ENV[k]} 13 | 14 | c.strict_variables = Gem::Version.new(Puppet.version) >= Gem::Version.new('3.5') 15 | Puppet.features.stubs(:root?).returns(true) 16 | end 17 | 18 | c.after :each do 19 | PuppetlabsSpec::Files.cleanup 20 | end 21 | end 22 | 23 | require 'pathname' 24 | dir = Pathname.new(__FILE__).parent 25 | Puppet[:modulepath] = File.join(dir, 'fixtures', 'modules') 26 | 27 | # There's no real need to make this version dependent, but it helps find 28 | # regressions in Puppet 29 | # 30 | # 1. Workaround for issue #16277 where default settings aren't initialised from 31 | # a spec and so the libdir is never initialised (3.0.x) 32 | # 2. Workaround for 2.7.20 that now only loads types for the current node 33 | # environment (#13858) so Puppet[:modulepath] seems to get ignored 34 | # 3. Workaround for 3.5 where context hasn't been configured yet, 35 | # ticket https://tickets.puppetlabs.com/browse/MODULES-823 36 | # 37 | ver = Gem::Version.new(Puppet.version.split('-').first) 38 | if Gem::Requirement.new("~> 2.7.20") =~ ver || Gem::Requirement.new("~> 3.0.0") =~ ver || Gem::Requirement.new("~> 3.5") =~ ver || Gem::Requirement.new("~> 4.0") 39 | puts "augeasproviders: setting Puppet[:libdir] to work around broken type autoloading" 40 | # libdir is only a single dir, so it can only workaround loading of one external module 41 | Puppet[:libdir] = "#{Puppet[:modulepath]}/augeasproviders_core/lib" 42 | end 43 | -------------------------------------------------------------------------------- /spec/spec_helper_acceptance.rb: -------------------------------------------------------------------------------- 1 | require 'beaker-rspec' 2 | 3 | hosts.each do |host| 4 | # Install puppet 5 | install_puppet_agent_on host, {} 6 | install_package host, 'git' 7 | case fact('osfamily') 8 | when 'Debian' 9 | install_package host, 'libaugeas-ruby' 10 | when 'RedHat' 11 | install_package host, 'net-tools' 12 | install_package host, 'gcc' 13 | install_package host, 'ruby-devel' 14 | install_package host, 'augeas-devel' 15 | on host, 'gem install ruby-augeas --no-ri --no-rdoc' 16 | else 17 | puts 'Sorry, this osfamily is not supported.' 18 | exit 19 | end 20 | end 21 | 22 | ### 23 | # Copied/pasted/adapted from puppetlabs_spec_helper's lib/puppetlabs_spec_helper/rake_tasks.rb 24 | # 25 | def fixtures(host, category) 26 | begin 27 | fixtures = YAML.load_file(".fixtures.yml")["fixtures"] 28 | rescue Errno::ENOENT 29 | return {} 30 | end 31 | 32 | if not fixtures 33 | abort("malformed fixtures.yml") 34 | end 35 | 36 | result = {} 37 | if fixtures.include? category and fixtures[category] != nil 38 | fixtures[category].each do |fixture, opts| 39 | if opts.instance_of?(String) 40 | source = opts 41 | target = "#{host['distmoduledir']}/#{fixture}" 42 | real_source = eval('"'+source+'"') 43 | result[real_source] = target 44 | elsif opts.instance_of?(Hash) 45 | target = "#{host['distmoduledir']}/#{fixture}" 46 | real_source = eval('"'+opts["repo"]+'"') 47 | result[real_source] = { "target" => target, "ref" => opts["ref"], "scm" => opts["scm"] } 48 | end 49 | end 50 | end 51 | return result 52 | end 53 | 54 | def clone(host, scm, remote, target, ref=nil) 55 | args = [] 56 | case scm 57 | when 'hg' 58 | args.push('clone') 59 | args.push('-u', ref) if ref 60 | args.push(remote, target) 61 | when 'git' 62 | args.push('clone', remote, target) 63 | else 64 | fail "Unfortunately #{scm} is not supported yet" 65 | end 66 | on host, "#{scm} #{args.flatten.join ' '} || true" 67 | end 68 | 69 | #def revision(scm, target, ref) 70 | def revision(host, scm, target, ref) 71 | args = [] 72 | case scm 73 | when 'hg' 74 | args.push('update', 'clean', '-r', ref) 75 | when 'git' 76 | args.push('reset', '--hard', ref) 77 | else 78 | fail "Unfortunately #{scm} is not supported yet" 79 | end 80 | on host, "cd #{target} && #{scm} #{args.flatten.join ' '}" 81 | end 82 | 83 | def spec_prep(host) 84 | fixtures(host, "repositories").each do |remote, opts| 85 | scm = 'git' 86 | if opts.instance_of?(String) 87 | target = opts 88 | elsif opts.instance_of?(Hash) 89 | target = opts["target"] 90 | ref = opts["ref"] 91 | scm = opts["scm"] if opts["scm"] 92 | end 93 | 94 | unless File::exists?(target) || clone(host, scm, remote, target, ref) 95 | fail "Failed to clone #{scm} repository #{remote} into #{target}" 96 | end 97 | #revision(scm, target, ref) if ref 98 | revision(host, scm, target, ref) if ref 99 | end 100 | 101 | fixtures(host, "forge_modules").each do |remote, opts| 102 | if opts.instance_of?(String) 103 | target = opts 104 | ref = "" 105 | elsif opts.instance_of?(Hash) 106 | target = opts["target"] 107 | ref = "--version #{opts['ref']}" 108 | end 109 | next if File::exists?(target) 110 | on host, puppet('module', 'install', ref), { :acceptable_exit_codes => [0,1] } 111 | end 112 | end 113 | 114 | RSpec.configure do |c| 115 | # Project root 116 | proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) 117 | 118 | # Readable test descriptions 119 | c.formatter = :documentation 120 | 121 | # Configure all nodes in nodeset 122 | c.before :suite do 123 | # Install module and dependencies 124 | puppet_module_install(:source => proj_root, :module_name => 'nagios') 125 | hosts.each do |host| 126 | spec_prep(host) 127 | end 128 | end 129 | end 130 | -------------------------------------------------------------------------------- /templates/apache.conf.erb: -------------------------------------------------------------------------------- 1 | # file managed by puppet 2 | 3 | ScriptAlias /cgi-bin/nagios3 <%= @nagios_cgi_dir %> 4 | ScriptAlias /nagios3/cgi-bin <%= @nagios_cgi_dir %> 5 | Alias /nagios3/stylesheets <%= @nagios_stylesheets_dir %> 6 | Alias /nagios3 <%= @nagios_physical_html_path %> 7 | 8 | |<%= @nagios_cgi_dir %>)> 9 | Options FollowSymLinks 10 | AllowOverride AuthConfig 11 | Order Allow,Deny 12 | Allow From All 13 | 14 | AuthName "Nagios Access" 15 | AuthType Basic 16 | AuthUserFile /var/www/<%= vhost %>/private/<%= htpasswd_file %> 17 | require valid-user 18 | 19 | -------------------------------------------------------------------------------- /templates/cgi.cfg.erb: -------------------------------------------------------------------------------- 1 | # file managed by puppet 2 | 3 | ################################################################# 4 | # 5 | # CGI.CFG - Sample CGI Configuration File for Nagios 6 | # 7 | ################################################################# 8 | 9 | 10 | # MAIN CONFIGURATION FILE 11 | # This tells the CGIs where to find your main configuration file. 12 | # The CGIs will read the main and host config files for any other 13 | # data they might need. 14 | <% if has_variable?("nagios_main_config_file") %> 15 | main_config_file=<%= @nagios_main_config_file %> 16 | <% else %> 17 | main_config_file=/etc/nagios3/nagios.cfg 18 | <% end %> 19 | 20 | # PHYSICAL HTML PATH 21 | # This is the path where the HTML files for Nagios reside. This 22 | # value is used to locate the logo images needed by the statusmap 23 | # and statuswrl CGIs. 24 | <% if has_variable?("nagios_physical_html_path") %> 25 | physical_html_path=<%= @nagios_physical_html_path %> 26 | <% else %> 27 | physical_html_path=/usr/share/nagios3/htdocs 28 | <% end %> 29 | 30 | # URL HTML PATH 31 | # This is the path portion of the URL that corresponds to the 32 | # physical location of the Nagios HTML files (as defined above). 33 | # This value is used by the CGIs to locate the online documentation 34 | # and graphics. If you access the Nagios pages with an URL like 35 | # http://www.myhost.com/nagios, this value should be '/nagios' 36 | # (without the quotes). 37 | <% if has_variable?("nagios_url_html_path") %> 38 | url_html_path=<%= @nagios_url_html_path %> 39 | <% else %> 40 | url_html_path=/nagios3 41 | <% end %> 42 | 43 | # CONTEXT-SENSITIVE HELP 44 | # This option determines whether or not a context-sensitive 45 | # help icon will be displayed for most of the CGIs. 46 | # Values: 0 = disables context-sensitive help 47 | # 1 = enables context-sensitive help 48 | show_context_help=<%= @show_context_help %> 49 | 50 | # PENDING STATES OPTION 51 | # This option determines what states should be displayed in the web 52 | # interface for hosts/services that have not yet been checked. 53 | # Values: 0 = leave hosts/services that have not been check yet in their original state 54 | # 1 = mark hosts/services that have not been checked yet as PENDING 55 | use_pending_states=<%= @use_pending_states %> 56 | 57 | <% if has_variable?("nagios_nagios_check_command") %> 58 | nagios_check_command=<%= @nagios_nagios_check_command %> 59 | <% else %> 60 | nagios_check_command=/usr/lib/nagios/plugins/check_nagios /var/cache/nagios3/status.dat 5 '/usr/sbin/nagios3' 61 | <% end %> 62 | 63 | # AUTHENTICATION USAGE 64 | # This option controls whether or not the CGIs will use any 65 | # authentication when displaying host and service information, as 66 | # well as committing commands to Nagios for processing. 67 | # 68 | # Read the HTML documentation to learn how the authorization works! 69 | # 70 | # NOTE: It is a really *bad* idea to disable authorization, unless 71 | # you plan on removing the command CGI (cmd.cgi)! Failure to do 72 | # so will leave you wide open to kiddies messing with Nagios and 73 | # possibly hitting you with a denial of service attack by filling up 74 | # your drive by continuously writing to your command file! 75 | # 76 | # Setting this value to 0 will cause the CGIs to *not* use 77 | # authentication (bad idea), while any other value will make them 78 | # use the authentication functions (the default). 79 | 80 | use_authentication=<%= @use_authentication %> 81 | 82 | 83 | # DEFAULT USER 84 | # Setting this variable will define a default user name that can 85 | # access pages without authentication. This allows people within a 86 | # secure domain (i.e., behind a firewall) to see the current status 87 | # without authenticating. You may want to use this to avoid basic 88 | # authentication if you are not using a secure server since basic 89 | # authentication transmits passwords in the clear. 90 | # 91 | # Important: Do not define a default username unless you are 92 | # running a secure web server and are sure that everyone who has 93 | # access to the CGIs has been authenticated in some manner! If you 94 | # define this variable, anyone who has not authenticated to the web 95 | # server will inherit all rights you assign to this user! 96 | 97 | <% if @default_user_name %> 98 | default_user_name=<%= @default_user_name %> 99 | <% end %> 100 | #default_user_name=guest 101 | 102 | # SYSTEM/PROCESS INFORMATION ACCESS 103 | # This option is a comma-delimited list of all usernames that 104 | # have access to viewing the Nagios process information as 105 | # provided by the Extended Information CGI (extinfo.cgi). By 106 | # default, *no one* has access to this unless you choose to 107 | # not use authorization. You may use an asterisk (*) to 108 | # authorize any user who has authenticated to the web server. 109 | 110 | authorized_for_system_information=<%= @authorized_for_system_information %> 111 | 112 | 113 | # CONFIGURATION INFORMATION ACCESS 114 | # This option is a comma-delimited list of all usernames that 115 | # can view ALL configuration information (hosts, commands, etc). 116 | # By default, users can only view configuration information 117 | # for the hosts and services they are contacts for. You may use 118 | # an asterisk (*) to authorize any user who has authenticated 119 | # to the web server. 120 | 121 | authorized_for_configuration_information=<%= @authorized_for_configuration_information %> 122 | 123 | 124 | # SYSTEM/PROCESS COMMAND ACCESS 125 | # This option is a comma-delimited list of all usernames that 126 | # can issue shutdown and restart commands to Nagios via the 127 | # command CGI (cmd.cgi). Users in this list can also change 128 | # the program mode to active or standby. By default, *no one* 129 | # has access to this unless you choose to not use authorization. 130 | # You may use an asterisk (*) to authorize any user who has 131 | # authenticated to the web server. 132 | 133 | authorized_for_system_commands=<%= @authorized_for_system_commands %> 134 | 135 | 136 | # GLOBAL HOST/SERVICE VIEW ACCESS 137 | # These two options are comma-delimited lists of all usernames that 138 | # can view information for all hosts and services that are being 139 | # monitored. By default, users can only view information 140 | # for hosts or services that they are contacts for (unless you 141 | # you choose to not use authorization). You may use an asterisk (*) 142 | # to authorize any user who has authenticated to the web server. 143 | 144 | authorized_for_all_services=<%= @authorized_for_all_services %> 145 | 146 | 147 | 148 | authorized_for_all_hosts=<%= @authorized_for_all_hosts %> 149 | 150 | 151 | # GLOBAL HOST/SERVICE COMMAND ACCESS 152 | # These two options are comma-delimited lists of all usernames that 153 | # can issue host or service related commands via the command 154 | # CGI (cmd.cgi) for all hosts and services that are being monitored. 155 | # By default, users can only issue commands for hosts or services 156 | # that they are contacts for (unless you you choose to not use 157 | # authorization). You may use an asterisk (*) to authorize any 158 | # user who has authenticated to the web server. 159 | 160 | authorized_for_all_service_commands=<%= @authorized_for_all_service_commands %> 161 | 162 | 163 | 164 | authorized_for_all_host_commands=<%= @authorized_for_all_host_commands %> 165 | 166 | 167 | # STATUSMAP BACKGROUND IMAGE 168 | # This option allows you to specify an image to be used as a 169 | # background in the statusmap CGI. It is assumed that the image 170 | # resides in the HTML images path (i.e. /usr/local/nagios/share/images). 171 | # This path is automatically determined by appending "/images" 172 | # to the path specified by the 'physical_html_path' directive. 173 | # Note: The image file may be in GIF, PNG, JPEG, or GD2 format. 174 | # However, I recommend that you convert your image to GD2 format 175 | # (uncompressed), as this will cause less CPU load when the CGI 176 | # generates the image. 177 | 178 | #statusmap_background_image=smbackground.gd2 179 | 180 | # DEFAULT STATUSMAP LAYOUT METHOD 181 | # This option allows you to specify the default layout method 182 | # the statusmap CGI should use for drawing hosts. If you do 183 | # not use this option, the default is to use user-defined 184 | # coordinates. Valid options are as follows: 185 | # 0 = User-defined coordinates 186 | # 1 = Depth layers 187 | # 2 = Collapsed tree 188 | # 3 = Balanced tree 189 | # 4 = Circular 190 | default_statusmap_layout=<%= @default_statusmap_layout %> 191 | 192 | # DEFAULT STATUSWRL LAYOUT METHOD 193 | # This option allows you to specify the default layout method 194 | # the statuswrl (VRML) CGI should use for drawing hosts. If you 195 | # do not use this option, the default is to use user-defined 196 | # coordinates. Valid options are as follows: 197 | # 0 = User-defined coordinates 198 | # 2 = Collapsed tree 199 | # 3 = Balanced tree 200 | # 4 = Circular 201 | default_statuswrl_layout=<%= @default_statuswrl_layout %> 202 | 203 | # STATUSWRL INCLUDE 204 | # This option allows you to include your own objects in the 205 | # generated VRML world. It is assumed that the file 206 | # resides in the HTML path (i.e. /usr/local/nagios/share). 207 | 208 | #statuswrl_include=myworld.wrl 209 | 210 | 211 | 212 | # PING SYNTAX 213 | # This option determines what syntax should be used when 214 | # attempting to ping a host from the WAP interface (using 215 | # the statuswml CGI. You must include the full path to 216 | # the ping binary, along with all required options. The 217 | # $HOSTADDRESS$ macro is substituted with the address of 218 | # the host before the command is executed. 219 | # Please note that the syntax for the ping binary is 220 | # notorious for being different on virtually ever *NIX 221 | # OS and distribution, so you may have to tweak this to 222 | # work on your system. 223 | ping_syntax=<%= @ping_syntax %> 224 | 225 | # REFRESH RATE 226 | # This option allows you to specify the refresh rate in seconds 227 | # of various CGIs (status, statusmap, extinfo, and outages). 228 | refresh_rate=<%= @refresh_rate %> 229 | 230 | # DEFAULT PAGE LIMIT 231 | # This option allows you to specify the default number of results 232 | # displayed on the status.cgi. This number can be adjusted from 233 | # within the UI after the initial page load. Setting this to 0 234 | # will show all results. 235 | result_limit=<%= @result_limit %> 236 | 237 | # ESCAPE HTML TAGS 238 | # This option determines whether HTML tags in host and service 239 | # status output is escaped in the web interface. If enabled, 240 | # your plugin output will not be able to contain clickable links. 241 | escape_html_tags=<%= @escape_html_tags %> 242 | 243 | # SOUND OPTIONS 244 | # These options allow you to specify an optional audio file 245 | # that should be played in your browser window when there are 246 | # problems on the network. The audio files are used only in 247 | # the status CGI. Only the sound for the most critical problem 248 | # will be played. Order of importance (higher to lower) is as 249 | # follows: unreachable hosts, down hosts, critical services, 250 | # warning services, and unknown services. If there are no 251 | # visible problems, the sound file optionally specified by 252 | # 'normal_sound' variable will be played. 253 | # 254 | # 255 | # = 256 | # 257 | # Note: All audio files must be placed in the /media subdirectory 258 | # under the HTML path (i.e. /usr/local/nagios/share/media/). 259 | 260 | #host_unreachable_sound=hostdown.wav 261 | #host_down_sound=hostdown.wav 262 | #service_critical_sound=critical.wav 263 | #service_warning_sound=warning.wav 264 | #service_unknown_sound=warning.wav 265 | #normal_sound=noproblem.wav 266 | 267 | # URL TARGET FRAMES 268 | # These options determine the target frames in which notes and 269 | # action URLs will open. 270 | action_url_target=<%= @action_url_target %> 271 | 272 | notes_url_target=<%= @notes_url_target %> 273 | 274 | # LOCK AUTHOR NAMES OPTION 275 | # This option determines whether users can change the author name 276 | # when submitting comments, scheduling downtime. If disabled, the 277 | # author names will be locked into their contact name, as defined in Nagios. 278 | # Values: 0 = allow editing author names 279 | # 1 = lock author names (disallow editing) 280 | lock_author_names=<%= @lock_author_names %> 281 | 282 | # SPLUNK INTEGRATION OPTIONS 283 | # These options allow you to enable integration with Splunk 284 | # in the web interface. If enabled, you'll be presented with 285 | # "Splunk It" links in various places in the CGIs (log file, 286 | # alert history, host/service detail, etc). Useful if you're 287 | # trying to research why a particular problem occurred. 288 | # For more information on Splunk, visit http://www.splunk.com/ 289 | 290 | # This option determines whether the Splunk integration is enabled 291 | # Values: 0 = disable Splunk integration 292 | # 1 = enable Splunk integration 293 | 294 | #enable_splunk_integration=1 295 | 296 | # This option should be the URL used to access your instance of Splunk 297 | 298 | #splunk_url=http://127.0.0.1:8000/ 299 | 300 | 301 | -------------------------------------------------------------------------------- /templates/etc/default/nagios3.erb: -------------------------------------------------------------------------------- 1 | # file managed by puppet 2 | 3 | # location of the nagios configuration file 4 | NAGIOSCFG="/etc/nagios3/nagios.cfg" 5 | 6 | # location of the CGI configuration file 7 | CGICFG="/etc/nagios3/cgi.cfg" 8 | 9 | # nicelevel to run nagios daemon with 10 | NICENESS=<%= @niceness %> 11 | 12 | # if you use pam_tmpdir, you need to explicitly set TMPDIR: 13 | #TMPDIR=/tmp 14 | -------------------------------------------------------------------------------- /templates/generic-command.cfg.erb: -------------------------------------------------------------------------------- 1 | # file managed by puppet 2 | 3 | define command{ 4 | name notify-host-by-email 5 | command_name notify-host-by-email 6 | command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | <%= @nagios_mail_path %> -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$ 7 | } 8 | 9 | define command{ 10 | name notify-service-by-email 11 | command_name notify-service-by-email 12 | 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$" | <%= @nagios_mail_path %> -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$ 13 | } 14 | 15 | define command{ 16 | name service-is-stale 17 | command_name service-is-stale 18 | command_line $USER1$/check_dummy 3 "Service results are stale" 19 | } 20 | 21 | define command{ 22 | name host-is-stale 23 | command_name host-is-stale 24 | command_line $USER1$/check_dummy 3 "Host results are stale" 25 | } 26 | 27 | define command{ 28 | name check-host-alive 29 | command_name check-host-alive 30 | command_line $USER1$/check_ping <%- if ( @check_ping_ipv and ( @check_ping_ipv=="4" or @check_ping_ipv=="6" ) ) -%>-<%= @check_ping_ipv %> <% end -%>-H $HOSTADDRESS$ -w 5000,100% -c 5000,100% -p 1 31 | } 32 | -------------------------------------------------------------------------------- /templates/nagios.cfg.erb: -------------------------------------------------------------------------------- 1 | # file managed by puppet 2 | 3 | ############################################################################## 4 | # 5 | # NAGIOS.CFG - Sample Main Config File for Nagios 6 | # 7 | ############################################################################## 8 | 9 | # LOG FILE 10 | # This is the main log file where service and host events are logged 11 | # for historical purposes. This should be the first option specified 12 | # in the config file!!! 13 | log_file=/var/log/<%= @basename %>/nagios.log 14 | 15 | # OBJECT CONFIGURATION FILE(S) 16 | # These are the object configuration files in which you define hosts, 17 | # host groups, contacts, contact groups, services, etc. 18 | # You can split your object definitions across several config files 19 | # if you wish (as shown below), or keep them all in a single config file. 20 | 21 | # You can also tell Nagios to process all config files (with a .cfg 22 | # extension) in a particular directory by using the cfg_dir 23 | # directive as shown below: 24 | cfg_dir=/etc/nagios.d 25 | 26 | # OBJECT CACHE FILE 27 | # This option determines where object definitions are cached when 28 | # Nagios starts/restarts. The CGIs read object definitions from 29 | # this cache file (rather than looking at the object config files 30 | # directly) in order to prevent inconsistencies that can occur 31 | # when the config files are modified after Nagios starts. 32 | object_cache_file=/var/cache/<%= @basename %>/objects.cache 33 | 34 | # PRE-CACHED OBJECT FILE 35 | # This options determines the location of the precached object file. 36 | # If you run Nagios with the -p command line option, it will preprocess 37 | # your object configuration file(s) and write the cached config to this 38 | # file. You can then start Nagios with the -u option to have it read 39 | # object definitions from this precached file, rather than the standard 40 | # object configuration files (see the cfg_file and cfg_dir options above). 41 | # Using a precached object file can speed up the time needed to (re)start 42 | # the Nagios process if you've got a large and/or complex configuration. 43 | # Read the documentation section on optimizing Nagios to find our more 44 | # about how this feature works. 45 | precached_object_file=/var/cache/<%= @basename %>/objects.precache 46 | 47 | # RESOURCE FILE 48 | # This is an optional resource file that contains $USERx$ macro 49 | # definitions. Multiple resource files can be specified by using 50 | # multiple resource_file definitions. The CGIs will not attempt to 51 | # read the contents of resource files, so information that is 52 | # considered to be sensitive (usernames, passwords, etc) can be 53 | # defined as macros in this file and restrictive permissions (600) 54 | # can be placed on this file. 55 | resource_file=/etc/<%= @basename %>/resource.cfg 56 | 57 | # STATUS FILE 58 | # This is where the current status of all monitored services and 59 | # hosts is stored. Its contents are read and processed by the CGIs. 60 | # The contents of the status file are deleted every time Nagios 61 | # restarts. 62 | status_file=/var/cache/<%= @basename %>/status.dat 63 | 64 | # STATUS FILE UPDATE INTERVAL 65 | # This option determines the frequency (in seconds) that 66 | # Nagios will periodically dump program, host, and 67 | # service status data. 68 | <% if @nagios_status_update_interval %> 69 | status_update_interval=<%= @nagios_status_update_interval %> 70 | <% else %> 71 | status_update_interval=10 72 | <% end %> 73 | 74 | # NAGIOS USER 75 | # This determines the effective user that Nagios should run as. 76 | # You can either supply a username or a UID. 77 | <% if @nagios_user %> 78 | nagios_user=<%= @nagios_nagios_user %> 79 | <% else %> 80 | nagios_user=nagios 81 | <% end %> 82 | 83 | # NAGIOS GROUP 84 | # This determines the effective group that Nagios should run as. 85 | # You can either supply a group name or a GID. 86 | <% if @nagios_group %> 87 | nagios_group=<%= @nagios_nagios_group %> 88 | <% else %> 89 | nagios_group=nagios 90 | <% end %> 91 | 92 | # EXTERNAL COMMAND OPTION 93 | # This option allows you to specify whether or not Nagios should check 94 | # for external commands (in the command file defined below). By default 95 | # Nagios will *not* check for external commands, just to be on the 96 | # cautious side. If you want to be able to use the CGI command interface 97 | # you will have to enable this. 98 | # Values: 0 = disable commands, 1 = enable commands 99 | <% if @nagios_check_external_commands %> 100 | check_external_commands=<%= @nagios_check_external_commands %> 101 | <% else %> 102 | check_external_commands=1 103 | <% end %> 104 | 105 | # EXTERNAL COMMAND CHECK INTERVAL 106 | # This is the interval at which Nagios should check for external commands. 107 | # This value works of the interval_length you specify later. If you leave 108 | # that at its default value of 60 (seconds), a value of 1 here will cause 109 | # Nagios to check for external commands every minute. If you specify a 110 | # number followed by an "s" (i.e. 15s), this will be interpreted to mean 111 | # actual seconds rather than a multiple of the interval_length variable. 112 | # Note: In addition to reading the external command file at regularly 113 | # scheduled intervals, Nagios will also check for external commands after 114 | # event handlers are executed. 115 | # NOTE: Setting this value to -1 causes Nagios to check the external 116 | # command file as often as possible. 117 | #command_check_interval=15s 118 | <% if @nagios_command_check_interval %> 119 | command_check_interval=<%= @nagios_command_check_interval %> 120 | <% else %> 121 | command_check_interval=-1 122 | <% end %> 123 | 124 | # EXTERNAL COMMAND FILE 125 | # This is the file that Nagios checks for external command requests. 126 | # It is also where the command CGI will write commands that are submitted 127 | # by users, so it must be writeable by the user that the web server 128 | # is running as (usually 'nobody'). Permissions should be set at the 129 | # directory level instead of on the file, as the file is deleted every 130 | # time its contents are processed. 131 | # Debian Users: In case you didn't read README.Debian yet, _NOW_ is the 132 | # time to do it. 133 | command_file=<%= @command_file %> 134 | 135 | # EXTERNAL COMMAND BUFFER SLOTS 136 | # This settings is used to tweak the number of items or "slots" that 137 | # the Nagios daemon should allocate to the buffer that holds incoming 138 | # external commands before they are processed. As external commands 139 | # are processed by the daemon, they are removed from the buffer. 140 | <% if @nagios_external_command_buffer_slots %> 141 | external_command_buffer_slots=<%= @nagios_external_command_buffer_slots %> 142 | <% else %> 143 | external_command_buffer_slots=4096 144 | <% end %> 145 | 146 | # LOCK FILE 147 | # This is the lockfile that Nagios will use to store its PID number 148 | # in when it is running in daemon mode. 149 | lock_file=<%= @pidfile %> 150 | 151 | # TEMP FILE 152 | # This is a temporary file that is used as scratch space when Nagios 153 | # updates the status log, cleans the comment file, etc. This file 154 | # is created, used, and deleted throughout the time that Nagios is 155 | # running. 156 | temp_file=/var/cache/<%= @basename %>/nagios.tmp 157 | 158 | # TEMP PATH 159 | # This is path where Nagios can create temp files for service and 160 | # host check results, etc. 161 | <% if @nagios_temp_path %> 162 | temp_path=<%= @nagios_temp_path %> 163 | <% else %> 164 | temp_path=/tmp 165 | <% end %> 166 | 167 | # EVENT BROKER OPTIONS 168 | # Controls what (if any) data gets sent to the event broker. 169 | # Values: 0 = Broker nothing 170 | # -1 = Broker everything 171 | # = See documentation 172 | <% if @nagios_event_broker_options %> 173 | event_broker_options=<%= @nagios_event_broker_options %> 174 | <% else %> 175 | event_broker_options=-1 176 | <% end %> 177 | 178 | # EVENT BROKER MODULE(S) 179 | # This directive is used to specify an event broker module that should 180 | # by loaded by Nagios at startup. Use multiple directives if you want 181 | # to load more than one module. Arguments that should be passed to 182 | # the module at startup are seperated from the module path by a space. 183 | # 184 | #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 185 | # WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING 186 | #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 187 | # 188 | # Do NOT overwrite modules while they are being used by Nagios or Nagios 189 | # will crash in a fiery display of SEGFAULT glory. This is a bug/limitation 190 | # either in dlopen(), the kernel, and/or the filesystem. And maybe Nagios... 191 | # 192 | # The correct/safe way of updating a module is by using one of these methods: 193 | # 1. Shutdown Nagios, replace the module file, restart Nagios 194 | # 2. Delete the original module file, move the new module file into place, restart Nagios 195 | # 196 | # Example: 197 | # 198 | # broker_module= [moduleargs] 199 | 200 | #broker_module=/somewhere/module1.o 201 | #broker_module=/somewhere/module2.o arg1 arg2=3 debug=0 202 | 203 | # LOG ROTATION METHOD 204 | # This is the log rotation method that Nagios should use to rotate 205 | # the main log file. Values are as follows.. 206 | # n = None - don't rotate the log 207 | # h = Hourly rotation (top of the hour) 208 | # d = Daily rotation (midnight every day) 209 | # w = Weekly rotation (midnight on Saturday evening) 210 | # m = Monthly rotation (midnight last day of month) 211 | <% if @nagios_log_rotation_method %> 212 | log_rotation_method=<%= @nagios_log_rotation_method %> 213 | <% else %> 214 | log_rotation_method=d 215 | <% end %> 216 | 217 | # LOG ARCHIVE PATH 218 | # This is the directory where archived (rotated) log files should be 219 | # placed (assuming you've chosen to do log rotation). 220 | log_archive_path=/var/log/<%= @basename %>/archives 221 | 222 | # LOGGING OPTIONS 223 | # If you want messages logged to the syslog facility, as well as the 224 | # Nagios log file set this option to 1. If not, set it to 0. 225 | 226 | use_syslog=<%= @use_syslog %> 227 | 228 | 229 | # NOTIFICATION LOGGING OPTION 230 | # If you don't want notifications to be logged, set this value to 0. 231 | # If notifications should be logged, set the value to 1. 232 | <% if @nagios_log_notifications %> 233 | log_notifications=<%= @nagios_log_notifications %> 234 | <% else %> 235 | log_notifications=0 236 | <% end %> 237 | 238 | # SERVICE RETRY LOGGING OPTION 239 | # If you don't want service check retries to be logged, set this value 240 | # to 0. If retries should be logged, set the value to 1. 241 | <% if @nagios_log_service_retries %> 242 | log_service_retries=<%= @nagios_log_service_retries %> 243 | <% else %> 244 | log_service_retries=0 245 | <% end %> 246 | 247 | # HOST RETRY LOGGING OPTION 248 | # If you don't want host check retries to be logged, set this value to 249 | # 0. If retries should be logged, set the value to 1. 250 | <% if @nagios_log_host_retries %> 251 | log_host_retries=<%= @nagios_log_host_retries %> 252 | <% else %> 253 | log_host_retries=0 254 | <% end %> 255 | 256 | # EVENT HANDLER LOGGING OPTION 257 | # If you don't want host and service event handlers to be logged, set 258 | # this value to 0. If event handlers should be logged, set the value 259 | # to 1. 260 | <% if @nagios_log_event_handlers %> 261 | log_event_handlers=<%= @nagios_log_event_handlers %> 262 | <% else %> 263 | log_event_handlers=0 264 | <% end %> 265 | 266 | # INITIAL STATES LOGGING OPTION 267 | # If you want Nagios to log all initial host and service states to 268 | # the main log file (the first time the service or host is checked) 269 | # you can enable this option by setting this value to 1. If you 270 | # are not using an external application that does long term state 271 | # statistics reporting, you do not need to enable this option. In 272 | # this case, set the value to 0. 273 | <% if @nagios_log_initial_states %> 274 | log_initial_states=<%= @nagios_log_initial_states %> 275 | <% else %> 276 | log_initial_states=0 277 | <% end %> 278 | 279 | # EXTERNAL COMMANDS LOGGING OPTION 280 | # If you don't want Nagios to log external commands, set this value 281 | # to 0. If external commands should be logged, set this value to 1. 282 | # Note: This option does not include logging of passive service 283 | # checks - see the option below for controlling whether or not 284 | # passive checks are logged. 285 | <% if @nagios_log_external_commands %> 286 | log_external_commands=<%= @nagios_log_external_commands %> 287 | <% else %> 288 | log_external_commands=0 289 | <% end %> 290 | 291 | # PASSIVE CHECKS LOGGING OPTION 292 | # If you don't want Nagios to log passive host and service checks, set 293 | # this value to 0. If passive checks should be logged, set 294 | # this value to 1. 295 | <% if @nagios_log_passive_checks %> 296 | log_passive_checks=<%= @nagios_log_passive_checks %> 297 | <% else %> 298 | log_passive_checks=0 299 | <% end %> 300 | 301 | # GLOBAL HOST AND SERVICE EVENT HANDLERS 302 | # These options allow you to specify a host and service event handler 303 | # command that is to be run for every host or service state change. 304 | # The global event handler is executed immediately prior to the event 305 | # handler that you have optionally specified in each host or 306 | # service definition. The command argument is the short name of a 307 | # command definition that you define in your host configuration file. 308 | # Read the HTML docs for more information. 309 | 310 | #global_host_event_handler=somecommand 311 | #global_service_event_handler=somecommand 312 | 313 | # SERVICE INTER-CHECK DELAY METHOD 314 | # This is the method that Nagios should use when initially 315 | # "spreading out" service checks when it starts monitoring. The 316 | # default is to use smart delay calculation, which will try to 317 | # space all service checks out evenly to minimize CPU load. 318 | # Using the dumb setting will cause all checks to be scheduled 319 | # at the same time (with no delay between them)! This is not a 320 | # good thing for production, but is useful when testing the 321 | # parallelization functionality. 322 | # n = None - don't use any delay between checks 323 | # d = Use a "dumb" delay of 1 second between checks 324 | # s = Use "smart" inter-check delay calculation 325 | # x.xx = Use an inter-check delay of x.xx seconds 326 | <% if @nagios_service_inter_check_delay_method %> 327 | service_inter_check_delay_method=<%= @nagios_service_inter_check_delay_method %> 328 | <% else %> 329 | service_inter_check_delay_method=s 330 | <% end %> 331 | 332 | # MAXIMUM SERVICE CHECK SPREAD 333 | # This variable determines the timeframe (in minutes) from the 334 | # program start time that an initial check of all services should 335 | # be completed. Default is 30 minutes. 336 | <% if @nagios_max_service_check_spread %> 337 | max_service_check_spread=<%= @nagios_max_service_check_spread %> 338 | <% else %> 339 | max_service_check_spread=30 340 | <% end %> 341 | 342 | # SERVICE CHECK INTERLEAVE FACTOR 343 | # This variable determines how service checks are interleaved. 344 | # Interleaving the service checks allows for a more even 345 | # distribution of service checks and reduced load on remote 346 | # hosts. Setting this value to 1 is equivalent to how versions 347 | # of Nagios previous to 0.0.5 did service checks. Set this 348 | # value to s (smart) for automatic calculation of the interleave 349 | # factor unless you have a specific reason to change it. 350 | # s = Use "smart" interleave factor calculation 351 | # x = Use an interleave factor of x, where x is a 352 | # number greater than or equal to 1. 353 | <% if @nagios_service_interleave_factor %> 354 | service_interleave_factor=<%= @nagios_service_interleave_factor %> 355 | <% else %> 356 | service_interleave_factor=s 357 | <% end %> 358 | 359 | # HOST INTER-CHECK DELAY METHOD 360 | # This is the method that Nagios should use when initially 361 | # "spreading out" host checks when it starts monitoring. The 362 | # default is to use smart delay calculation, which will try to 363 | # space all host checks out evenly to minimize CPU load. 364 | # Using the dumb setting will cause all checks to be scheduled 365 | # at the same time (with no delay between them)! 366 | # n = None - don't use any delay between checks 367 | # d = Use a "dumb" delay of 1 second between checks 368 | # s = Use "smart" inter-check delay calculation 369 | # x.xx = Use an inter-check delay of x.xx seconds 370 | <% if @nagios_host_inter_check_delay_method %> 371 | host_inter_check_delay_method=<%= @nagios_host_inter_check_delay_method %> 372 | <% else %> 373 | host_inter_check_delay_method=s 374 | <% end %> 375 | 376 | # MAXIMUM HOST CHECK SPREAD 377 | # This variable determines the timeframe (in minutes) from the 378 | # program start time that an initial check of all hosts should 379 | # be completed. Default is 30 minutes. 380 | <% if @nagios_max_host_check_spread %> 381 | max_host_check_spread=<%= @nagios_max_host_check_spread %> 382 | <% else %> 383 | max_host_check_spread=30 384 | <% end %> 385 | 386 | # MAXIMUM CONCURRENT SERVICE CHECKS 387 | # This option allows you to specify the maximum number of 388 | # service checks that can be run in parallel at any given time. 389 | # Specifying a value of 1 for this variable essentially prevents 390 | # any service checks from being parallelized. A value of 0 391 | # will not restrict the number of concurrent checks that are 392 | # being executed. 393 | <% if @nagios_max_concurrent_checks %> 394 | max_concurrent_checks=<%= @nagios_max_concurrent_checks %> 395 | <% else %> 396 | max_concurrent_checks=0 397 | <% end %> 398 | 399 | # HOST AND SERVICE CHECK REAPER FREQUENCY 400 | # This is the frequency (in seconds!) that Nagios will process 401 | # the results of host and service checks. 402 | <% if @nagios_check_result_reaper_frequency %> 403 | check_result_reaper_frequency=<%= @nagios_check_result_reaper_frequency %> 404 | <% else %> 405 | check_result_reaper_frequency=10 406 | <% end %> 407 | 408 | # MAX CHECK RESULT REAPER TIME 409 | # This is the max amount of time (in seconds) that a single 410 | # check result reaper event will be allowed to run before 411 | # returning control back to Nagios so it can perform other 412 | # duties. 413 | <% if @nagios_max_check_result_reaper_time %> 414 | max_check_result_reaper_time=<%= @nagios_max_check_result_reaper_time %> 415 | <% else %> 416 | max_check_result_reaper_time=30 417 | <% end %> 418 | 419 | # CHECK RESULT PATH 420 | # This is directory where Nagios stores the results of host and 421 | # service checks that have not yet been processed. 422 | # 423 | # Note: Make sure that only one instance of Nagios has access 424 | # to this directory! 425 | check_result_path=/var/lib/<%= @basename %>/spool/checkresults 426 | 427 | # MAX CHECK RESULT FILE AGE 428 | # This option determines the maximum age (in seconds) which check 429 | # result files are considered to be valid. Files older than this 430 | # threshold will be mercilessly deleted without further processing. 431 | <% if @nagios_max_check_result_file_age %> 432 | max_check_result_file_age=<%= @nagios_max_check_result_file_age %> 433 | <% else %> 434 | max_check_result_file_age=3600 435 | <% end %> 436 | 437 | # CACHED HOST CHECK HORIZON 438 | # This option determines the maximum amount of time (in seconds) 439 | # that the state of a previous host check is considered current. 440 | # Cached host states (from host checks that were performed more 441 | # recently that the timeframe specified by this value) can immensely 442 | # improve performance in regards to the host check logic. 443 | # Too high of a value for this option may result in inaccurate host 444 | # states being used by Nagios, while a lower value may result in a 445 | # performance hit for host checks. Use a value of 0 to disable host 446 | # check caching. 447 | <% if @nagios_cached_host_check_horizon %> 448 | cached_host_check_horizon=<%= @nagios_cached_host_check_horizon %> 449 | <% else %> 450 | cached_host_check_horizon=15 451 | <% end %> 452 | 453 | # CACHED SERVICE CHECK HORIZON 454 | # This option determines the maximum amount of time (in seconds) 455 | # that the state of a previous service check is considered current. 456 | # Cached service states (from service checks that were performed more 457 | # recently that the timeframe specified by this value) can immensely 458 | # improve performance in regards to predictive dependency checks. 459 | # Use a value of 0 to disable service check caching. 460 | <% if @nagios_cached_service_check_horizon %> 461 | cached_service_check_horizon=<%= @nagios_cached_service_check_horizon %> 462 | <% else %> 463 | cached_service_check_horizon=15 464 | <% end %> 465 | 466 | # ENABLE PREDICTIVE HOST DEPENDENCY CHECKS 467 | # This option determines whether or not Nagios will attempt to execute 468 | # checks of hosts when it predicts that future dependency logic test 469 | # may be needed. These predictive checks can help ensure that your 470 | # host dependency logic works well. 471 | # Values: 472 | # 0 = Disable predictive checks 473 | # 1 = Enable predictive checks (default) 474 | <% if @nagios_enable_predictive_host_dependency_checks %> 475 | enable_predictive_host_dependency_checks=<%= @nagios_enable_predictive_host_dependency_checks %> 476 | <% else %> 477 | enable_predictive_host_dependency_checks=1 478 | <% end %> 479 | 480 | # ENABLE PREDICTIVE SERVICE DEPENDENCY CHECKS 481 | # This option determines whether or not Nagios will attempt to execute 482 | # checks of service when it predicts that future dependency logic test 483 | # may be needed. These predictive checks can help ensure that your 484 | # service dependency logic works well. 485 | # Values: 486 | # 0 = Disable predictive checks 487 | # 1 = Enable predictive checks (default) 488 | <% if @nagios_enable_predictive_service_dependency_checks %> 489 | enable_predictive_service_dependency_checks=<%= @nagios_enable_predictive_service_dependency_checks %> 490 | <% else %> 491 | enable_predictive_service_dependency_checks=1 492 | <% end %> 493 | 494 | # SOFT STATE DEPENDENCIES 495 | # This option determines whether or not Nagios will use soft state 496 | # information when checking host and service dependencies. Normally 497 | # Nagios will only use the latest hard host or service state when 498 | # checking dependencies. If you want it to use the latest state (regardless 499 | # of whether its a soft or hard state type), enable this option. 500 | # Values: 501 | # 0 = Don't use soft state dependencies (default) 502 | # 1 = Use soft state dependencies 503 | <% if @nagios_soft_state_dependencies %> 504 | soft_state_dependencies=<%= @nagios_soft_state_dependencies %> 505 | <% else %> 506 | soft_state_dependencies=0 507 | <% end %> 508 | 509 | # AUTO-RESCHEDULING OPTION 510 | # This option determines whether or not Nagios will attempt to 511 | # automatically reschedule active host and service checks to 512 | # "smooth" them out over time. This can help balance the load on 513 | # the monitoring server. 514 | # WARNING: THIS IS AN EXPERIMENTAL FEATURE - IT CAN DEGRADE 515 | # PERFORMANCE, RATHER THAN INCREASE IT, IF USED IMPROPERLY 516 | <% if @nagios_auto_reschedule_checks %> 517 | auto_reschedule_checks=<%= @nagios_auto_reschedule_checks %> 518 | <% else %> 519 | auto_reschedule_checks=0 520 | <% end %> 521 | 522 | # AUTO-RESCHEDULING INTERVAL 523 | # This option determines how often (in seconds) Nagios will 524 | # attempt to automatically reschedule checks. This option only 525 | # has an effect if the auto_reschedule_checks option is enabled. 526 | # Default is 30 seconds. 527 | # WARNING: THIS IS AN EXPERIMENTAL FEATURE - IT CAN DEGRADE 528 | # PERFORMANCE, RATHER THAN INCREASE IT, IF USED IMPROPERLY 529 | <% if @nagios_auto_rescheduling_interval %> 530 | auto_rescheduling_interval=<%= @nagios_auto_rescheduling_interval %> 531 | <% else %> 532 | auto_rescheduling_interval=30 533 | <% end %> 534 | 535 | # AUTO-RESCHEDULING WINDOW 536 | # This option determines the "window" of time (in seconds) that 537 | # Nagios will look at when automatically rescheduling checks. 538 | # Only host and service checks that occur in the next X seconds 539 | # (determined by this variable) will be rescheduled. This option 540 | # only has an effect if the auto_reschedule_checks option is 541 | # enabled. Default is 180 seconds (3 minutes). 542 | # WARNING: THIS IS AN EXPERIMENTAL FEATURE - IT CAN DEGRADE 543 | # PERFORMANCE, RATHER THAN INCREASE IT, IF USED IMPROPERLY 544 | <% if @nagios_auto_rescheduling_window %> 545 | auto_rescheduling_window=<%= @nagios_auto_rescheduling_window %> 546 | <% else %> 547 | auto_rescheduling_window=180 548 | <% end %> 549 | 550 | # SLEEP TIME 551 | # This is the number of seconds to sleep between checking for system 552 | # events and service checks that need to be run. 553 | <% if @nagios_sleep_time %> 554 | sleep_time=<%= @nagios_sleep_time %> 555 | <% else %> 556 | sleep_time=0.25 557 | <% end %> 558 | 559 | # TIMEOUT VALUES 560 | # These options control how much time Nagios will allow various 561 | # types of commands to execute before killing them off. Options 562 | # are available for controlling maximum time allotted for 563 | # service checks, host checks, event handlers, notifications, the 564 | # ocsp command, and performance data commands. All values are in 565 | # seconds. 566 | <% if @nagios_service_check_timeout %> 567 | service_check_timeout=<%= @nagios_service_check_timeout %> 568 | <% else %> 569 | service_check_timeout=60 570 | <% end %> 571 | 572 | <% if @nagios_host_check_timeout %> 573 | host_check_timeout=<%= @nagios_host_check_timeout %> 574 | <% else %> 575 | host_check_timeout=60 576 | <% end %> 577 | 578 | <% if @nagios_event_handler_timeout %> 579 | event_handler_timeout=<%= @nagios_event_handler_timeout %> 580 | <% else %> 581 | event_handler_timeout=30 582 | <% end %> 583 | 584 | <% if @nagios_notification_timeout %> 585 | notification_timeout=<%= @nagios_notification_timeout %> 586 | <% else %> 587 | notification_timeout=30 588 | <% end %> 589 | 590 | <% if @nagios_ocsp_timeout %> 591 | ocsp_timeout=<%= @nagios_ocsp_timeout %> 592 | <% else %> 593 | ocsp_timeout=10 594 | <% end %> 595 | 596 | <% if @nagios_perfdata_timeout %> 597 | perfdata_timeout=<%= @nagios_perfdata_timeout %> 598 | <% else %> 599 | perfdata_timeout=5 600 | <% end %> 601 | 602 | # RETAIN STATE INFORMATION 603 | # This setting determines whether or not Nagios will save state 604 | # information for services and hosts before it shuts down. Upon 605 | # startup Nagios will reload all saved service and host state 606 | # information before starting to monitor. This is useful for 607 | # maintaining long-term data on state statistics, etc, but will 608 | # slow Nagios down a bit when it (re)starts. Since its only 609 | # a one-time penalty, I think its well worth the additional 610 | # startup delay. 611 | <% if @nagios_retain_state_information %> 612 | retain_state_information=<%= @nagios_retain_state_information %> 613 | <% else %> 614 | retain_state_information=1 615 | <% end %> 616 | 617 | # STATE RETENTION FILE 618 | # This is the file that Nagios should use to store host and 619 | # service state information before it shuts down. The state 620 | # information in this file is also read immediately prior to 621 | # starting to monitor the network when Nagios is restarted. 622 | # This file is used only if the preserve_state_information 623 | # variable is set to 1. 624 | state_retention_file=/var/lib/<%= @basename %>/retention.dat 625 | 626 | # RETENTION DATA UPDATE INTERVAL 627 | # This setting determines how often (in minutes) that Nagios 628 | # will automatically save retention data during normal operation. 629 | # If you set this value to 0, Nagios will not save retention 630 | # data at regular interval, but it will still save retention 631 | # data before shutting down or restarting. If you have disabled 632 | # state retention, this option has no effect. 633 | <% if @nagios_retention_update_interval %> 634 | retention_update_interval=<%= @nagios_retention_update_interval %> 635 | <% else %> 636 | retention_update_interval=60 637 | <% end %> 638 | 639 | # USE RETAINED PROGRAM STATE 640 | # This setting determines whether or not Nagios will set 641 | # program status variables based on the values saved in the 642 | # retention file. If you want to use retained program status 643 | # information, set this value to 1. If not, set this value 644 | # to 0. 645 | <% if @nagios_use_retained_program_state %> 646 | use_retained_program_state=<%= @nagios_use_retained_program_state %> 647 | <% else %> 648 | use_retained_program_state=0 649 | <% end %> 650 | 651 | # USE RETAINED SCHEDULING INFO 652 | # This setting determines whether or not Nagios will retain 653 | # the scheduling info (next check time) for hosts and services 654 | # based on the values saved in the retention file. If you 655 | # If you want to use retained scheduling info, set this 656 | # value to 1. If not, set this value to 0. 657 | <% if @nagios_use_retained_scheduling_info %> 658 | use_retained_scheduling_info=<%= @nagios_use_retained_scheduling_info %> 659 | <% else %> 660 | use_retained_scheduling_info=1 661 | <% end %> 662 | 663 | # RETAINED ATTRIBUTE MASKS (ADVANCED FEATURE) 664 | # The following variables are used to specify specific host and 665 | # service attributes that should *not* be retained by Nagios during 666 | # program restarts. 667 | # 668 | # The values of the masks are bitwise ANDs of values specified 669 | # by the "MODATTR_" definitions found in include/common.h. 670 | # For example, if you do not want the current enabled/disabled state 671 | # of flap detection and event handlers for hosts to be retained, you 672 | # would use a value of 24 for the host attribute mask... 673 | # MODATTR_EVENT_HANDLER_ENABLED (8) + MODATTR_FLAP_DETECTION_ENABLED (16) = 24 674 | 675 | # This mask determines what host attributes are not retained 676 | <% if @nagios_retained_host_attribute_mask %> 677 | retained_host_attribute_mask=<%= @nagios_retained_host_attribute_mask %> 678 | <% else %> 679 | retained_host_attribute_mask=0 680 | <% end %> 681 | 682 | # This mask determines what service attributes are not retained 683 | <% if @nagios_retained_service_attribute_mask %> 684 | retained_service_attribute_mask=<%= @nagios_retained_service_attribute_mask %> 685 | <% else %> 686 | retained_service_attribute_mask=0 687 | <% end %> 688 | 689 | # These two masks determine what process attributes are not retained. 690 | # There are two masks, because some process attributes have host and service 691 | # options. For example, you can disable active host checks, but leave active 692 | # service checks enabled. 693 | <% if @nagios_retained_process_host_attribute_mask %> 694 | retained_process_host_attribute_mask=<%= @nagios_retained_process_host_attribute_mask %> 695 | <% else %> 696 | retained_process_host_attribute_mask=0 697 | <% end %> 698 | 699 | <% if @nagios_retained_process_service_attribute_mask %> 700 | retained_process_service_attribute_mask=<%= @nagios_retained_process_service_attribute_mask %> 701 | <% else %> 702 | retained_process_service_attribute_mask=0 703 | <% end %> 704 | 705 | # These two masks determine what contact attributes are not retained. 706 | # There are two masks, because some contact attributes have host and 707 | # service options. For example, you can disable host notifications for 708 | # a contact, but leave service notifications enabled for them. 709 | <% if @nagios_retained_contact_host_attribute_mask %> 710 | retained_contact_host_attribute_mask=<%= @nagios_retained_contact_host_attribute_mask %> 711 | <% else %> 712 | retained_contact_host_attribute_mask=0 713 | <% end %> 714 | 715 | <% if @nagios_retained_contact_service_attribute_mask %> 716 | retained_contact_service_attribute_mask=<%= @nagios_retained_contact_service_attribute_mask %> 717 | <% else %> 718 | retained_contact_service_attribute_mask=0 719 | <% end %> 720 | 721 | # INTERVAL LENGTH 722 | # This is the seconds per unit interval as used in the 723 | # host/contact/service configuration files. Setting this to 60 means 724 | # that each interval is one minute long (60 seconds). Other settings 725 | # have not been tested much, so your mileage is likely to vary... 726 | <% if @nagios_interval_length %> 727 | interval_length=<%= @nagios_interval_length %> 728 | <% else %> 729 | interval_length=60 730 | <% end %> 731 | 732 | # AGGRESSIVE HOST CHECKING OPTION 733 | # If you don't want to turn on aggressive host checking features, set 734 | # this value to 0 (the default). Otherwise set this value to 1 to 735 | # enable the aggressive check option. Read the docs for more info 736 | # on what aggressive host check is or check out the source code in 737 | # base/checks.c 738 | <% if @nagios_use_aggressive_host_checking %> 739 | use_aggressive_host_checking=<%= @nagios_use_aggressive_host_checking %> 740 | <% else %> 741 | use_aggressive_host_checking=0 742 | <% end %> 743 | 744 | # SERVICE CHECK EXECUTION OPTION 745 | # This determines whether or not Nagios will actively execute 746 | # service checks when it initially starts. If this option is 747 | # disabled, checks are not actively made, but Nagios can still 748 | # receive and process passive check results that come in. Unless 749 | # you're implementing redundant hosts or have a special need for 750 | # disabling the execution of service checks, leave this enabled! 751 | # Values: 1 = enable checks, 0 = disable checks 752 | <% if @nagios_execute_service_checks %> 753 | execute_service_checks=<%= @nagios_execute_service_checks %> 754 | <% else %> 755 | execute_service_checks=1 756 | <% end %> 757 | 758 | # PASSIVE SERVICE CHECK ACCEPTANCE OPTION 759 | # This determines whether or not Nagios will accept passive 760 | # service checks results when it initially (re)starts. 761 | # Values: 1 = accept passive checks, 0 = reject passive checks 762 | <% if @nagios_accept_passive_service_checks %> 763 | accept_passive_service_checks=<%= @nagios_accept_passive_service_checks %> 764 | <% else %> 765 | accept_passive_service_checks=1 766 | <% end %> 767 | 768 | # HOST CHECK EXECUTION OPTION 769 | # This determines whether or not Nagios will actively execute 770 | # host checks when it initially starts. If this option is 771 | # disabled, checks are not actively made, but Nagios can still 772 | # receive and process passive check results that come in. Unless 773 | # you're implementing redundant hosts or have a special need for 774 | # disabling the execution of host checks, leave this enabled! 775 | # Values: 1 = enable checks, 0 = disable checks 776 | <% if @nagios_execute_host_checks %> 777 | execute_host_checks=<%= @nagios_execute_host_checks %> 778 | <% else %> 779 | execute_host_checks=1 780 | <% end %> 781 | 782 | # PASSIVE HOST CHECK ACCEPTANCE OPTION 783 | # This determines whether or not Nagios will accept passive 784 | # host checks results when it initially (re)starts. 785 | # Values: 1 = accept passive checks, 0 = reject passive checks 786 | <% if @nagios_accept_passive_host_checks %> 787 | accept_passive_host_checks=<%= @nagios_accept_passive_host_checks %> 788 | <% else %> 789 | accept_passive_host_checks=1 790 | <% end %> 791 | 792 | # NOTIFICATIONS OPTION 793 | # This determines whether or not Nagios will sent out any host or 794 | # service notifications when it is initially (re)started. 795 | # Values: 1 = enable notifications, 0 = disable notifications 796 | <% if @nagios_enable_notifications %> 797 | enable_notifications=<%= @nagios_enable_notifications %> 798 | <% else %> 799 | enable_notifications=1 800 | <% end %> 801 | 802 | # EVENT HANDLER USE OPTION 803 | # This determines whether or not Nagios will run any host or 804 | # service event handlers when it is initially (re)started. Unless 805 | # you're implementing redundant hosts, leave this option enabled. 806 | # Values: 1 = enable event handlers, 0 = disable event handlers 807 | <% if @nagios_enable_event_handlers %> 808 | enable_event_handlers=<%= @nagios_enable_event_handlers %> 809 | <% else %> 810 | enable_event_handlers=1 811 | <% end %> 812 | 813 | # PROCESS PERFORMANCE DATA OPTION 814 | # This determines whether or not Nagios will process performance 815 | # data returned from service and host checks. If this option is 816 | # enabled, host performance data will be processed using the 817 | # host_perfdata_command (defined below) and service performance 818 | # data will be processed using the service_perfdata_command (also 819 | # defined below). Read the HTML docs for more information on 820 | # performance data. 821 | # Values: 1 = process performance data, 0 = do not process performance data 822 | <% if @nagios_process_performance_data %> 823 | process_performance_data=<%= @nagios_process_performance_data %> 824 | <% else %> 825 | process_performance_data=0 826 | <% end %> 827 | 828 | # HOST AND SERVICE PERFORMANCE DATA PROCESSING COMMANDS 829 | # These commands are run after every host and service check is 830 | # performed. These commands are executed only if the 831 | # enable_performance_data option (above) is set to 1. The command 832 | # argument is the short name of a command definition that you 833 | # define in your host configuration file. Read the HTML docs for 834 | # more information on performance data. 835 | 836 | #host_perfdata_command=process-host-perfdata 837 | #service_perfdata_command=process-service-perfdata 838 | 839 | 840 | # HOST AND SERVICE PERFORMANCE DATA FILES 841 | # These files are used to store host and service performance data. 842 | # Performance data is only written to these files if the 843 | # enable_performance_data option (above) is set to 1. 844 | 845 | #host_perfdata_file=/tmp/host-perfdata 846 | #service_perfdata_file=/tmp/service-perfdata 847 | 848 | # HOST AND SERVICE PERFORMANCE DATA FILE TEMPLATES 849 | # These options determine what data is written (and how) to the 850 | # performance data files. The templates may contain macros, special 851 | # characters (\t for tab, \r for carriage return, \n for newline) 852 | # and plain text. A newline is automatically added after each write 853 | # to the performance data file. Some examples of what you can do are 854 | # shown below. 855 | 856 | #host_perfdata_file_template=[HOSTPERFDATA]\t$TIMET$\t$HOSTNAME$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$ 857 | #service_perfdata_file_template=[SERVICEPERFDATA]\t$TIMET$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$ 858 | 859 | 860 | # HOST AND SERVICE PERFORMANCE DATA FILE MODES 861 | # This option determines whether or not the host and service 862 | # performance data files are opened in write ("w") or append ("a") 863 | # mode. If you want to use named pipes, you should use the special 864 | # pipe ("p") mode which avoid blocking at startup, otherwise you will 865 | # likely want the defult append ("a") mode. 866 | 867 | #host_perfdata_file_mode=a 868 | #service_perfdata_file_mode=a 869 | 870 | 871 | # HOST AND SERVICE PERFORMANCE DATA FILE PROCESSING INTERVAL 872 | # These options determine how often (in seconds) the host and service 873 | # performance data files are processed using the commands defined 874 | # below. A value of 0 indicates the files should not be periodically 875 | # processed. 876 | 877 | #host_perfdata_file_processing_interval=0 878 | #service_perfdata_file_processing_interval=0 879 | 880 | 881 | # HOST AND SERVICE PERFORMANCE DATA FILE PROCESSING COMMANDS 882 | # These commands are used to periodically process the host and 883 | # service performance data files. The interval at which the 884 | # processing occurs is determined by the options above. 885 | 886 | #host_perfdata_file_processing_command=process-host-perfdata-file 887 | #service_perfdata_file_processing_command=process-service-perfdata-file 888 | 889 | 890 | # OBSESS OVER SERVICE CHECKS OPTION 891 | # This determines whether or not Nagios will obsess over service 892 | # checks and run the ocsp_command defined below. Unless you're 893 | # planning on implementing distributed monitoring, do not enable 894 | # this option. Read the HTML docs for more information on 895 | # implementing distributed monitoring. 896 | # Values: 1 = obsess over services, 0 = do not obsess (default) 897 | <% if @nagios_obsess_over_services %> 898 | obsess_over_services=<%= @nagios_obsess_over_services %> 899 | <% else %> 900 | obsess_over_services=1 901 | <% end %> 902 | 903 | # OBSESSIVE COMPULSIVE SERVICE PROCESSOR COMMAND 904 | # This is the command that is run for every service check that is 905 | # processed by Nagios. This command is executed only if the 906 | # obsess_over_services option (above) is set to 1. The command 907 | # argument is the short name of a command definition that you 908 | # define in your host configuration file. Read the HTML docs for 909 | # more information on implementing distributed monitoring. 910 | 911 | #ocsp_command=somecommand 912 | 913 | # OBSESS OVER HOST CHECKS OPTION 914 | # This determines whether or not Nagios will obsess over host 915 | # checks and run the ochp_command defined below. Unless you're 916 | # planning on implementing distributed monitoring, do not enable 917 | # this option. Read the HTML docs for more information on 918 | # implementing distributed monitoring. 919 | # Values: 1 = obsess over hosts, 0 = do not obsess (default) 920 | <% if @nagios_obsess_over_hosts %> 921 | obsess_over_hosts=<%= @nagios_obsess_over_hosts %> 922 | <% else %> 923 | obsess_over_hosts=1 924 | <% end %> 925 | 926 | # OBSESSIVE COMPULSIVE HOST PROCESSOR COMMAND 927 | # This is the command that is run for every host check that is 928 | # processed by Nagios. This command is executed only if the 929 | # obsess_over_hosts option (above) is set to 1. The command 930 | # argument is the short name of a command definition that you 931 | # define in your host configuration file. Read the HTML docs for 932 | # more information on implementing distributed monitoring. 933 | 934 | #ochp_command=somecommand 935 | 936 | # TRANSLATE PASSIVE HOST CHECKS OPTION 937 | # This determines whether or not Nagios will translate 938 | # DOWN/UNREACHABLE passive host check results into their proper 939 | # state for this instance of Nagios. This option is useful 940 | # if you have distributed or failover monitoring setup. In 941 | # these cases your other Nagios servers probably have a different 942 | # "view" of the network, with regards to the parent/child relationship 943 | # of hosts. If a distributed monitoring server thinks a host 944 | # is DOWN, it may actually be UNREACHABLE from the point of 945 | # this Nagios instance. Enabling this option will tell Nagios 946 | # to translate any DOWN or UNREACHABLE host states it receives 947 | # passively into the correct state from the view of this server. 948 | # Values: 1 = perform translation, 0 = do not translate (default) 949 | <% if @nagios_translate_passive_host_checks %> 950 | translate_passive_host_checks=<%= @nagios_translate_passive_host_checks %> 951 | <% else %> 952 | translate_passive_host_checks=0 953 | <% end %> 954 | 955 | # PASSIVE HOST CHECKS ARE SOFT OPTION 956 | # This determines whether or not Nagios will treat passive host 957 | # checks as being HARD or SOFT. By default, a passive host check 958 | # result will put a host into a HARD state type. This can be changed 959 | # by enabling this option. 960 | # Values: 0 = passive checks are HARD, 1 = passive checks are SOFT 961 | <% if @nagios_passive_host_checks_are_soft %> 962 | passive_host_checks_are_soft=<%= @nagios_passive_host_checks_are_soft %> 963 | <% else %> 964 | passive_host_checks_are_soft=0 965 | <% end %> 966 | 967 | # ORPHANED HOST/SERVICE CHECK OPTIONS 968 | # These options determine whether or not Nagios will periodically 969 | # check for orphaned host service checks. Since service checks are 970 | # not rescheduled until the results of their previous execution 971 | # instance are processed, there exists a possibility that some 972 | # checks may never get rescheduled. A similar situation exists for 973 | # host checks, although the exact scheduling details differ a bit 974 | # from service checks. Orphaned checks seem to be a rare 975 | # problem and should not happen under normal circumstances. 976 | # If you have problems with service checks never getting 977 | # rescheduled, make sure you have orphaned service checks enabled. 978 | # Values: 1 = enable checks, 0 = disable checks 979 | <% if @nagios_check_for_orphaned_services %> 980 | check_for_orphaned_services=<%= @nagios_check_for_orphaned_services %> 981 | <% else %> 982 | check_for_orphaned_services=1 983 | <% end %> 984 | 985 | <% if @nagios_check_for_orphaned_hosts %> 986 | check_for_orphaned_hosts=<%= @nagios_check_for_orphaned_hosts %> 987 | <% else %> 988 | check_for_orphaned_hosts=1 989 | <% end %> 990 | 991 | # SERVICE FRESHNESS CHECK OPTION 992 | # This option determines whether or not Nagios will periodically 993 | # check the "freshness" of service results. Enabling this option 994 | # is useful for ensuring passive checks are received in a timely 995 | # manner. 996 | # Values: 1 = enabled freshness checking, 0 = disable freshness checking 997 | <% if @nagios_check_service_freshness %> 998 | check_service_freshness=<%= @nagios_check_service_freshness %> 999 | <% else %> 1000 | check_service_freshness=1 1001 | <% end %> 1002 | 1003 | # SERVICE FRESHNESS CHECK INTERVAL 1004 | # This setting determines how often (in seconds) Nagios will 1005 | # check the "freshness" of service check results. If you have 1006 | # disabled service freshness checking, this option has no effect. 1007 | <% if @nagios_service_freshness_check_interval %> 1008 | service_freshness_check_interval=<%= @nagios_service_freshness_check_interval %> 1009 | <% else %> 1010 | service_freshness_check_interval=60 1011 | <% end %> 1012 | 1013 | # HOST FRESHNESS CHECK OPTION 1014 | # This option determines whether or not Nagios will periodically 1015 | # check the "freshness" of host results. Enabling this option 1016 | # is useful for ensuring passive checks are received in a timely 1017 | # manner. 1018 | # Values: 1 = enabled freshness checking, 0 = disable freshness checking 1019 | <% if @nagios_check_host_freshness %> 1020 | check_host_freshness=<%= @nagios_check_host_freshness %> 1021 | <% else %> 1022 | check_host_freshness=1 1023 | <% end %> 1024 | 1025 | # HOST FRESHNESS CHECK INTERVAL 1026 | # This setting determines how often (in seconds) Nagios will 1027 | # check the "freshness" of host check results. If you have 1028 | # disabled host freshness checking, this option has no effect. 1029 | <% if @nagios_host_freshness_check_interval %> 1030 | host_freshness_check_interval=<%= @nagios_host_freshness_check_interval %> 1031 | <% else %> 1032 | host_freshness_check_interval=60 1033 | <% end %> 1034 | 1035 | # ADDITIONAL FRESHNESS THRESHOLD LATENCY 1036 | # This setting determines the number of seconds that Nagios 1037 | # will add to any host and service freshness thresholds that 1038 | # it calculates (those not explicitly specified by the user). 1039 | <% if @nagios_additional_freshness_latency %> 1040 | additional_freshness_latency=<%= @nagios_additional_freshness_latency %> 1041 | <% else %> 1042 | additional_freshness_latency=15 1043 | <% end %> 1044 | 1045 | # FLAP DETECTION OPTION 1046 | # This option determines whether or not Nagios will try 1047 | # and detect hosts and services that are "flapping". 1048 | # Flapping occurs when a host or service changes between 1049 | # states too frequently. When Nagios detects that a 1050 | # host or service is flapping, it will temporarily suppress 1051 | # notifications for that host/service until it stops 1052 | # flapping. Flap detection is very experimental, so read 1053 | # the HTML documentation before enabling this feature! 1054 | # Values: 1 = enable flap detection 1055 | # 0 = disable flap detection (default) 1056 | <% if @nagios_enable_flap_detection %> 1057 | enable_flap_detection=<%= @nagios_enable_flap_detection %> 1058 | <% else %> 1059 | enable_flap_detection=1 1060 | <% end %> 1061 | 1062 | # FLAP DETECTION THRESHOLDS FOR HOSTS AND SERVICES 1063 | # Read the HTML documentation on flap detection for 1064 | # an explanation of what this option does. This option 1065 | # has no effect if flap detection is disabled. 1066 | <% if @nagios_low_service_flap_threshold %> 1067 | low_service_flap_threshold=<%= @nagios_low_service_flap_threshold %> 1068 | <% else %> 1069 | low_service_flap_threshold=5.0 1070 | <% end %> 1071 | 1072 | <% if @nagios_high_service_flap_threshold %> 1073 | high_service_flap_threshold=<%= @nagios_high_service_flap_threshold %> 1074 | <% else %> 1075 | high_service_flap_threshold=20.0 1076 | <% end %> 1077 | 1078 | <% if @nagios_low_host_flap_threshold %> 1079 | low_host_flap_threshold=<%= @nagios_low_host_flap_threshold %> 1080 | <% else %> 1081 | low_host_flap_threshold=5.0 1082 | <% end %> 1083 | 1084 | <% if @nagios_high_host_flap_threshold %> 1085 | high_host_flap_threshold=<%= @nagios_high_host_flap_threshold %> 1086 | <% else %> 1087 | high_host_flap_threshold=20.0 1088 | <% end %> 1089 | 1090 | # DATE FORMAT OPTION 1091 | # This option determines how short dates are displayed. Valid options 1092 | # include: 1093 | # us (MM-DD-YYYY HH:MM:SS) 1094 | # euro (DD-MM-YYYY HH:MM:SS) 1095 | # iso8601 (YYYY-MM-DD HH:MM:SS) 1096 | # strict-iso8601 (YYYY-MM-DDTHH:MM:SS) 1097 | # 1098 | <% if @nagios_date_format %> 1099 | date_format=<%= @nagios_date_format %> 1100 | <% else %> 1101 | date_format=iso8601 1102 | <% end %> 1103 | 1104 | # TIMEZONE OFFSET 1105 | # This option is used to override the default timezone that this 1106 | # instance of Nagios runs in. If not specified, Nagios will use 1107 | # the system configured timezone. 1108 | # 1109 | # NOTE: In order to display the correct timezone in the CGIs, you 1110 | # will also need to alter the Apache directives for the CGI path 1111 | # to include your timezone. Example: 1112 | # 1113 | # 1114 | # SetEnv TZ "Australia/Brisbane" 1115 | # ... 1116 | # 1117 | 1118 | #use_timezone=US/Mountain 1119 | #use_timezone=Australia/Brisbane 1120 | 1121 | # P1.PL FILE LOCATION 1122 | # This value determines where the p1.pl perl script (used by the 1123 | # embedded Perl interpreter) is located. If you didn't compile 1124 | # Nagios with embedded Perl support, this option has no effect. 1125 | p1_file=<%= @nagios_p1_file %> 1126 | 1127 | # EMBEDDED PERL INTERPRETER OPTION 1128 | # This option determines whether or not the embedded Perl interpreter 1129 | # will be enabled during runtime. This option has no effect if Nagios 1130 | # has not been compiled with support for embedded Perl. 1131 | # Values: 0 = disable interpreter, 1 = enable interpreter 1132 | <% if @nagios_enable_embedded_perl %> 1133 | enable_embedded_perl=<%= @nagios_enable_embedded_perl %> 1134 | <% else %> 1135 | enable_embedded_perl=1 1136 | <% end %> 1137 | 1138 | # EMBEDDED PERL USAGE OPTION 1139 | # This option determines whether or not Nagios will process Perl plugins 1140 | # and scripts with the embedded Perl interpreter if the plugins/scripts 1141 | # do not explicitly indicate whether or not it is okay to do so. Read 1142 | # the HTML documentation on the embedded Perl interpreter for more 1143 | # information on how this option works. 1144 | <% if @nagios_use_embedded_perl_implicitly %> 1145 | use_embedded_perl_implicitly=<%= @nagios_use_embedded_perl_implicitly %> 1146 | <% else %> 1147 | use_embedded_perl_implicitly=1 1148 | <% end %> 1149 | 1150 | # ILLEGAL OBJECT NAME CHARACTERS 1151 | # This option allows you to specify illegal characters that cannot 1152 | # be used in host names, service descriptions, or names of other 1153 | # object types. 1154 | <% if @nagios_illegal_object_name_chars %> 1155 | illegal_object_name_chars=<%= @nagios_illegal_object_name_chars %> 1156 | <% else %> 1157 | illegal_object_name_chars=`~!$%^&*|'"<>?,()= 1158 | <% end %> 1159 | 1160 | # ILLEGAL MACRO OUTPUT CHARACTERS 1161 | # This option allows you to specify illegal characters that are 1162 | # stripped from macros before being used in notifications, event 1163 | # handlers, etc. This DOES NOT affect macros used in service or 1164 | # host check commands. 1165 | # The following macros are stripped of the characters you specify: 1166 | # $HOSTOUTPUT$ 1167 | # $HOSTPERFDATA$ 1168 | # $HOSTACKAUTHOR$ 1169 | # $HOSTACKCOMMENT$ 1170 | # $SERVICEOUTPUT$ 1171 | # $SERVICEPERFDATA$ 1172 | # $SERVICEACKAUTHOR$ 1173 | # $SERVICEACKCOMMENT$ 1174 | <% if @nagios_illegal_macro_output_chars %> 1175 | illegal_macro_output_chars=<%= @nagios_illegal_macro_output_chars %> 1176 | <% else %> 1177 | illegal_macro_output_chars=`~$&|'"<> 1178 | <% end %> 1179 | 1180 | # REGULAR EXPRESSION MATCHING 1181 | # This option controls whether or not regular expression matching 1182 | # takes place in the object config files. Regular expression 1183 | # matching is used to match host, hostgroup, service, and service 1184 | # group names/descriptions in some fields of various object types. 1185 | # Values: 1 = enable regexp matching, 0 = disable regexp matching 1186 | <% if @nagios_use_regexp_matching %> 1187 | use_regexp_matching=<%= @nagios_use_regexp_matching %> 1188 | <% else %> 1189 | use_regexp_matching=0 1190 | <% end %> 1191 | 1192 | # "TRUE" REGULAR EXPRESSION MATCHING 1193 | # This option controls whether or not "true" regular expression 1194 | # matching takes place in the object config files. This option 1195 | # only has an effect if regular expression matching is enabled 1196 | # (see above). If this option is DISABLED, regular expression 1197 | # matching only occurs if a string contains wildcard characters 1198 | # (* and ?). If the option is ENABLED, regexp matching occurs 1199 | # all the time (which can be annoying). 1200 | # Values: 1 = enable true matching, 0 = disable true matching 1201 | <% if @nagios_use_true_regexp_matching %> 1202 | use_true_regexp_matching=<%= @nagios_use_true_regexp_matching %> 1203 | <% else %> 1204 | use_true_regexp_matching=0 1205 | <% end %> 1206 | 1207 | # ADMINISTRATOR EMAIL/PAGER ADDRESSES 1208 | # The email and pager address of a global administrator (likely you). 1209 | # Nagios never uses these values itself, but you can access them by 1210 | # using the $ADMINEMAIL$ and $ADMINPAGER$ macros in your notification 1211 | # commands. 1212 | <% if @nagios_admin_email %> 1213 | admin_email=<%= @nagios_admin_email %> 1214 | <% else %> 1215 | admin_email=root@<%= @fqdn%> 1216 | <% end %> 1217 | 1218 | <% if @nagios_admin_pager %> 1219 | admin_pager=<%= @nagios_admin_pager %> 1220 | <% else %> 1221 | admin_pager=pageroot@localhost 1222 | <% end %> 1223 | 1224 | # DAEMON CORE DUMP OPTION 1225 | # This option determines whether or not Nagios is allowed to create 1226 | # a core dump when it runs as a daemon. Note that it is generally 1227 | # considered bad form to allow this, but it may be useful for 1228 | # debugging purposes. Enabling this option doesn't guarantee that 1229 | # a core file will be produced, but that's just life... 1230 | # Values: 1 - Allow core dumps 1231 | # 0 - Do not allow core dumps (default) 1232 | <% if @nagios_daemon_dumps_core %> 1233 | daemon_dumps_core=<%= @nagios_daemon_dumps_core %> 1234 | <% else %> 1235 | daemon_dumps_core=0 1236 | <% end %> 1237 | 1238 | # LARGE INSTALLATION TWEAKS OPTION 1239 | # This option determines whether or not Nagios will take some shortcuts 1240 | # which can save on memory and CPU usage in large Nagios installations. 1241 | # Read the documentation for more information on the benefits/tradeoffs 1242 | # of enabling this option. 1243 | # Values: 1 - Enabled tweaks 1244 | # 0 - Disable tweaks (default) 1245 | <% if @nagios_use_large_installation_tweaks %> 1246 | use_large_installation_tweaks=<%= @nagios_use_large_installation_tweaks %> 1247 | <% else %> 1248 | use_large_installation_tweaks=0 1249 | <% end %> 1250 | 1251 | # ENABLE ENVIRONMENT MACROS 1252 | # This option determines whether or not Nagios will make all standard 1253 | # macros available as environment variables when host/service checks 1254 | # and system commands (event handlers, notifications, etc.) are 1255 | # executed. Enabling this option can cause performance issues in 1256 | # large installations, as it will consume a bit more memory and (more 1257 | # importantly) consume more CPU. 1258 | # Values: 1 - Enable environment variable macros (default) 1259 | # 0 - Disable environment variable macros 1260 | <% if @nagios_enable_environment_macros %> 1261 | enable_environment_macros=<%= @nagios_enable_environment_macros %> 1262 | <% else %> 1263 | enable_environment_macros=1 1264 | <% end %> 1265 | 1266 | # CHILD PROCESS MEMORY OPTION 1267 | # This option determines whether or not Nagios will free memory in 1268 | # child processes (processed used to execute system commands and host/ 1269 | # service checks). If you specify a value here, it will override 1270 | # program defaults. 1271 | # Value: 1 - Free memory in child processes 1272 | # 0 - Do not free memory in child processes 1273 | 1274 | #free_child_process_memory=1 1275 | 1276 | 1277 | # CHILD PROCESS FORKING BEHAVIOR 1278 | # This option determines how Nagios will fork child processes 1279 | # (used to execute system commands and host/service checks). Normally 1280 | # child processes are fork()ed twice, which provides a very high level 1281 | # of isolation from problems. Fork()ing once is probably enough and will 1282 | # save a great deal on CPU usage (in large installs), so you might 1283 | # want to consider using this. If you specify a value here, it will 1284 | # program defaults. 1285 | # Value: 1 - Child processes fork() twice 1286 | # 0 - Child processes fork() just once 1287 | 1288 | #child_processes_fork_twice=1 1289 | 1290 | # DEBUG LEVEL 1291 | # This option determines how much (if any) debugging information will 1292 | # be written to the debug file. OR values together to log multiple 1293 | # types of information. 1294 | # Values: 1295 | # -1 = Everything 1296 | # 0 = Nothing 1297 | # 1 = Functions 1298 | # 2 = Configuration 1299 | # 4 = Process information 1300 | # 8 = Scheduled events 1301 | # 16 = Host/service checks 1302 | # 32 = Notifications 1303 | # 64 = Event broker 1304 | # 128 = External commands 1305 | # 256 = Commands 1306 | # 512 = Scheduled downtime 1307 | # 1024 = Comments 1308 | # 2048 = Macros 1309 | <% if @nagios_debug_level %> 1310 | debug_level=<%= @nagios_debug_level %> 1311 | <% else %> 1312 | debug_level=0 1313 | <% end %> 1314 | 1315 | # DEBUG VERBOSITY 1316 | # This option determines how verbose the debug log out will be. 1317 | # Values: 0 = Brief output 1318 | # 1 = More detailed 1319 | # 2 = Very detailed 1320 | <% if @nagios_debug_verbosity then %> 1321 | debug_verbosity=<%= @nagios_debug_verbosity %> 1322 | <% else %> 1323 | debug_verbosity=0 1324 | <% end %> 1325 | 1326 | # DEBUG FILE 1327 | # This option determines where Nagios should write debugging information. 1328 | debug_file=/var/lib/<%= @basename %>/nagios.debug 1329 | 1330 | # MAX DEBUG FILE SIZE 1331 | # This option determines the maximum size (in bytes) of the debug file. If 1332 | # the file grows larger than this size, it will be renamed with a .old 1333 | # extension. If a file already exists with a .old extension it will 1334 | # automatically be deleted. This helps ensure your disk space usage doesn't 1335 | # get out of control when debugging Nagios. 1336 | <% if @nagios_max_debug_file_size %> 1337 | max_debug_file_size=<%= @nagios_max_debug_file_size %> 1338 | <% else %> 1339 | max_debug_file_size=1000000 1340 | <% end %> 1341 | 1342 | -------------------------------------------------------------------------------- /templates/nrpe_local.cfg.erb: -------------------------------------------------------------------------------- 1 | # file managed by puppet 2 | 3 | 4 | # nrpe default config 5 | allowed_hosts=10.27.20.39 6 | server_address=<%= ipaddress %> 7 | 8 | # command list 9 | command[check_backuppc]=/usr/lib/nagios/plugins/check_procs -w 1:5 -c 1:5 -C BackupPC 10 | command[check_postfix]=/usr/lib/nagios/plugins/check_procs -w 1:5 -c 1:5 -C master 11 | command[my_check_load]=/usr/lib/nagios/plugins/check_load -r -w 10,15,25 -c 30,35,40 12 | command[my_check_raid]=/usr/lib/nagios/plugins/contrib/check_raid/check_raid 13 | command[check_sympa]=/usr/lib/nagios/plugins/check_procs -w 4:10 -a "/usr/lib/sympa/bin" 14 | -------------------------------------------------------------------------------- /templates/nsca.cfg.erb: -------------------------------------------------------------------------------- 1 | # file managed by puppet 2 | # 3 | #################################################### 4 | # Sample NSCA Daemon Config File 5 | # Written by: Ethan Galstad (nagios@nagios.org) 6 | # 7 | # Last Modified: 04-03-2006 8 | #################################################### 9 | 10 | 11 | # PID FILE 12 | # The name of the file in which the NSCA daemon should write it's process ID 13 | # number. The file is only written if the NSCA daemon is started by the root 14 | # user as a single- or multi-process daemon. 15 | 16 | pid_file=/var/run/nsca.pid 17 | 18 | 19 | 20 | # PORT NUMBER 21 | # Port number we should wait for connections on. 22 | # This must be a non-priveledged port (i.e. > 1024). 23 | 24 | server_port=5667 25 | 26 | 27 | 28 | # SERVER ADDRESS 29 | # Address that NSCA has to bind to in case there are 30 | # more as one interface and we do not want NSCA to bind 31 | # (thus listen) on all interfaces. 32 | 33 | #server_address=192.168.1.1 34 | 35 | 36 | 37 | # NSCA USER 38 | # This determines the effective user that the NSCA daemon should run as. 39 | # You can either supply a username or a UID. 40 | # 41 | # NOTE: This option is ignored if NSCA is running under either inetd or xinetd 42 | 43 | nsca_user=nagios 44 | 45 | 46 | 47 | # NSCA GROUP 48 | # This determines the effective group that the NSCA daemon should run as. 49 | # You can either supply a group name or a GID. 50 | # 51 | # NOTE: This option is ignored if NSCA is running under either inetd or xinetd 52 | 53 | nsca_group=<%= @nsca_group %> 54 | 55 | 56 | 57 | # NSCA CHROOT 58 | # If specified, determines a directory into which the nsca daemon 59 | # will perform a chroot(2) operation before dropping its privileges. 60 | # for the security conscious this can add a layer of protection in 61 | # the event that the nagios daemon is compromised. 62 | # 63 | # NOTE: if you specify this option, the command file will be opened 64 | # relative to this directory. 65 | 66 | #nsca_chroot=/var/run/nagios/rw 67 | 68 | 69 | 70 | # DEBUGGING OPTION 71 | # This option determines whether or not debugging 72 | # messages are logged to the syslog facility. 73 | # Values: 0 = debugging off, 1 = debugging on 74 | debug=<%= @debug %> 75 | 76 | # COMMAND FILE 77 | # This is the location of the Nagios command file that the daemon 78 | # should write all service check results that it receives. 79 | command_file=<%= @command_file %> 80 | 81 | # ALTERNATE DUMP FILE 82 | # This is used to specify an alternate file the daemon should 83 | # write service check results to in the event the command file 84 | # does not exist. It is important to note that the command file 85 | # is implemented as a named pipe and only exists when Nagios is 86 | # running. You may want to modify the startup script for Nagios 87 | # to dump the contents of this file into the command file after 88 | # it starts Nagios. Or you may simply choose to ignore any 89 | # check results received while Nagios was not running... 90 | alternate_dump_file=<%= @alternate_dump_file %> 91 | 92 | # AGGREGATED WRITES OPTION 93 | # This option determines whether or not the nsca daemon will 94 | # aggregate writes to the external command file for client 95 | # connections that contain multiple check results. If you 96 | # are queueing service check results on remote hosts and 97 | # sending them to the nsca daemon in bulk, you will probably 98 | # want to enable bulk writes, as this will be a bit more 99 | # efficient. 100 | # Values: 0 = do not aggregate writes, 1 = aggregate writes 101 | 102 | aggregate_writes=0 103 | 104 | 105 | 106 | # APPEND TO FILE OPTION 107 | # This option determines whether or not the nsca daemon will 108 | # will open the external command file for writing or appending. 109 | # This option should almost *always* be set to 0! 110 | # Values: 0 = open file for writing, 1 = open file for appending 111 | 112 | append_to_file=0 113 | 114 | 115 | 116 | # MAX PACKET AGE OPTION 117 | # This option is used by the nsca daemon to determine when client 118 | # data is too old to be valid. Keeping this value as small as 119 | # possible is recommended, as it helps prevent the possibility of 120 | # "replay" attacks. This value needs to be at least as long as 121 | # the time it takes your clients to send their data to the server. 122 | # Values are in seconds. The max packet age cannot exceed 15 123 | # minutes (900 seconds). If this variable is set to zero (0), no 124 | # packets will be rejected based on their age. 125 | 126 | max_packet_age=30 127 | 128 | 129 | 130 | # DECRYPTION PASSWORD 131 | # This is the password/passphrase that should be used to descrypt the 132 | # incoming packets. Note that all clients must encrypt the packets 133 | # they send using the same password! 134 | # IMPORTANT: You don't want all the users on this system to be able 135 | # to read the password you specify here, so make sure to set 136 | # restrictive permissions on this config file! 137 | 138 | <% if has_variable?("nagios_nsca_password") %> 139 | password=<%= @nagios_nsca_password %> 140 | <% else %> 141 | #password= 142 | <% end %> 143 | 144 | # DECRYPTION METHOD 145 | # This option determines the method by which the nsca daemon will 146 | # decrypt the packets it receives from the clients. The decryption 147 | # method you choose will be a balance between security and performance, 148 | # as strong encryption methods consume more processor resources. 149 | # You should evaluate your security needs when choosing a decryption 150 | # method. 151 | # 152 | # Note: The decryption method you specify here must match the 153 | # encryption method the nsca clients use (as specified in 154 | # the send_nsca.cfg file)!! 155 | # Values: 156 | # 157 | # 0 = None (Do NOT use this option) 158 | # 1 = Simple XOR (No security, just obfuscation, but very fast) 159 | # 160 | # 2 = DES 161 | # 3 = 3DES (Triple DES) 162 | # 4 = CAST-128 163 | # 5 = CAST-256 164 | # 6 = xTEA 165 | # 7 = 3WAY 166 | # 8 = BLOWFISH 167 | # 9 = TWOFISH 168 | # 10 = LOKI97 169 | # 11 = RC2 170 | # 12 = ARCFOUR 171 | # 172 | # 14 = RIJNDAEL-128 173 | # 15 = RIJNDAEL-192 174 | # 16 = RIJNDAEL-256 175 | # 176 | # 19 = WAKE 177 | # 20 = SERPENT 178 | # 179 | # 22 = ENIGMA (Unix crypt) 180 | # 23 = GOST 181 | # 24 = SAFER64 182 | # 25 = SAFER128 183 | # 26 = SAFER+ 184 | # 185 | 186 | 187 | decryption_method=<%= @decryption_method %> 188 | 189 | -------------------------------------------------------------------------------- /templates/send_nsca.cfg.erb: -------------------------------------------------------------------------------- 1 | # file managed by puppet 2 | 3 | #################################################### 4 | # Sample NSCA Client Config File 5 | # Written by: Ethan Galstad (nagios@nagios.org) 6 | # 7 | # Last Modified: 02-21-2002 8 | #################################################### 9 | 10 | 11 | # ENCRYPTION PASSWORD 12 | # This is the password/passphrase that should be used to encrypt the 13 | # outgoing packets. Note that the nsca daemon must use the same 14 | # password when decrypting the packet! 15 | # IMPORTANT: You don't want all the users on this system to be able 16 | # to read the password you specify here, so make sure to set 17 | # restrictive permissions on this config file! 18 | <% if has_variable?("nagios_nsca_password") %> 19 | password=<%= @nagios_nsca_password %> 20 | <% else %> 21 | #password= 22 | <% end %> 23 | 24 | # ENCRYPTION METHOD 25 | # This option determines the method by which the send_nsca client will 26 | # encrypt the packets it sends to the nsca daemon. The encryption 27 | # method you choose will be a balance between security and performance, 28 | # as strong encryption methods consume more processor resources. 29 | # You should evaluate your security needs when choosing an encryption 30 | # method. 31 | # 32 | # Note: The encryption method you specify here must match the 33 | # decryption method the nsca daemon uses (as specified in 34 | # the nsca.cfg file)!! 35 | # Values: 36 | # 0 = None (Do NOT use this option) 37 | # 1 = Simple XOR (No security, just obfuscation, but very fast) 38 | # 39 | # 2 = DES 40 | # 3 = 3DES (Triple DES) 41 | # 4 = CAST-128 42 | # 5 = CAST-256 43 | # 6 = xTEA 44 | # 7 = 3WAY 45 | # 8 = BLOWFISH 46 | # 9 = TWOFISH 47 | # 10 = LOKI97 48 | # 11 = RC2 49 | # 12 = ARCFOUR 50 | # 51 | # 14 = RIJNDAEL-128 52 | # 15 = RIJNDAEL-192 53 | # 16 = RIJNDAEL-256 54 | # 55 | # 19 = WAKE 56 | # 20 = SERPENT 57 | # 58 | # 22 = ENIGMA (Unix crypt) 59 | # 23 = GOST 60 | # 24 = SAFER64 61 | # 25 = SAFER128 62 | # 26 = SAFER+ 63 | # 64 | 65 | <% if has_variable?("nagios_nsca_encryption_method") %> 66 | encryption_method=<%= @nagios_nsca_encryption_method %> 67 | <% else %> 68 | encryption_method=0 69 | <% end %> 70 | 71 | -------------------------------------------------------------------------------- /templates/submit_ochp.erb: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # file managed by puppet 3 | # Script submit_ochp 4 | 5 | # Arguments: 6 | # $1 = host_name (Short name of host that the service is 7 | # associated with) 8 | # $2 = A string indicating the current state of the host ("UP", "DOWN", or "UNREACHABLE"). 9 | # $3 = The first line of text output from the last host check (i.e. "Ping OK"). 10 | 11 | /usr/bin/printf "%b" "$1\t$2\t$3\n" | /usr/sbin/send_nsca -H <%= @nsca_server %> -c <%= @nsca_cfg %> 12 | -------------------------------------------------------------------------------- /templates/submit_ocsp.erb: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # file managed by puppet 3 | # Script submit_ocsp 4 | 5 | # Arguments: 6 | # $1 = host_name (Short name of host that the service is 7 | # associated with) 8 | # $2 = svc_description (Description of the service) 9 | # $3 = return_code (An integer that determines the state 10 | # of the service check, 0=OK, 1=WARNING, 2=CRITICAL, 3=UNKNOWN). 11 | # $4 = plugin_output (A text string that should be used 12 | # as the plugin output for the service check)s 13 | 14 | /usr/bin/printf "%b" "$1\t$2\t$3\t$4\n" | /usr/sbin/send_nsca -H <%= @nsca_server %> -c <%= @nsca_cfg %> 15 | -------------------------------------------------------------------------------- /templates/template-all.erb: -------------------------------------------------------------------------------- 1 | define <%= @conf_type %> { 2 | name <%= @name %> 3 | <%= @content %> 4 | } 5 | --------------------------------------------------------------------------------