diff --git a/puppet/zulip_ops/files/nagios3/commands.cfg b/puppet/zulip_ops/files/nagios4/commands.cfg similarity index 98% rename from puppet/zulip_ops/files/nagios3/commands.cfg rename to puppet/zulip_ops/files/nagios4/commands.cfg index e7d0e7af73..060a023bf9 100644 --- a/puppet/zulip_ops/files/nagios3/commands.cfg +++ b/puppet/zulip_ops/files/nagios4/commands.cfg @@ -34,14 +34,14 @@ define command{ # 'process-host-perfdata' command definition define command{ command_name process-host-perfdata - command_line /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /var/lib/nagios3/host-perfdata.out + command_line /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /var/lib/nagios4/host-perfdata.out } # 'process-service-perfdata' command definition define command{ command_name process-service-perfdata - command_line /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /var/lib/nagios3/service-perfdata.out + command_line /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /var/lib/nagios4/service-perfdata.out } define command{ diff --git a/puppet/zulip_ops/files/nagios3/conf.d/generic-host_nagios2.cfg b/puppet/zulip_ops/files/nagios4/conf.d/generic-host_nagios2.cfg similarity index 100% rename from puppet/zulip_ops/files/nagios3/conf.d/generic-host_nagios2.cfg rename to puppet/zulip_ops/files/nagios4/conf.d/generic-host_nagios2.cfg diff --git a/puppet/zulip_ops/files/nagios3/conf.d/generic-service_nagios2.cfg b/puppet/zulip_ops/files/nagios4/conf.d/generic-service_nagios2.cfg similarity index 100% rename from puppet/zulip_ops/files/nagios3/conf.d/generic-service_nagios2.cfg rename to puppet/zulip_ops/files/nagios4/conf.d/generic-service_nagios2.cfg diff --git a/puppet/zulip_ops/files/nagios3/conf.d/hostgroups.cfg b/puppet/zulip_ops/files/nagios4/conf.d/hostgroups.cfg similarity index 100% rename from puppet/zulip_ops/files/nagios3/conf.d/hostgroups.cfg rename to puppet/zulip_ops/files/nagios4/conf.d/hostgroups.cfg diff --git a/puppet/zulip_ops/files/nagios3/conf.d/services.cfg b/puppet/zulip_ops/files/nagios4/conf.d/services.cfg similarity index 100% rename from puppet/zulip_ops/files/nagios3/conf.d/services.cfg rename to puppet/zulip_ops/files/nagios4/conf.d/services.cfg diff --git a/puppet/zulip_ops/files/nagios3/conf.d/timeperiods_nagios2.cfg b/puppet/zulip_ops/files/nagios4/conf.d/timeperiods_nagios2.cfg similarity index 100% rename from puppet/zulip_ops/files/nagios3/conf.d/timeperiods_nagios2.cfg rename to puppet/zulip_ops/files/nagios4/conf.d/timeperiods_nagios2.cfg diff --git a/puppet/zulip_ops/files/nagios3/nagios.cfg b/puppet/zulip_ops/files/nagios4/nagios.cfg similarity index 88% rename from puppet/zulip_ops/files/nagios3/nagios.cfg rename to puppet/zulip_ops/files/nagios4/nagios.cfg index 2b0a5421d5..fd5d443347 100644 --- a/puppet/zulip_ops/files/nagios3/nagios.cfg +++ b/puppet/zulip_ops/files/nagios4/nagios.cfg @@ -2,6 +2,10 @@ # # NAGIOS.CFG - Sample Main Config File for Nagios # +# Read the documentation for more information on this configuration +# file. I've provided some comments here, but things may not be so +# clear without further explanation. +# # ############################################################################## @@ -11,19 +15,19 @@ # for historical purposes. This should be the first option specified # in the config file!!! -log_file=/var/log/nagios3/nagios.log +log_file=/var/log/nagios4/nagios.log # Commands definitions -cfg_file=/etc/nagios3/commands.cfg +cfg_file=/etc/nagios4/commands.cfg # Debian also defaults to using the check commands defined by the debian # nagios-plugins package cfg_dir=/etc/nagios-plugins/config -# Debian uses by default a configuration directory where nagios3-common, +# Debian uses by default a configuration directory where nagios4-common, # other packages and the local admin can dump or link configuration # files into. -cfg_dir=/etc/nagios3/conf.d +cfg_dir=/etc/nagios4/conf.d # OBJECT CONFIGURATION FILE(S) # These are the object configuration files in which you define hosts, @@ -32,29 +36,32 @@ cfg_dir=/etc/nagios3/conf.d # if you wish (as shown below), or keep them all in a single config file. # You can specify individual object config files as shown below: -#cfg_file=/etc/nagios3/objects/commands.cfg -#cfg_file=/etc/nagios3/objects/contacts.cfg -#cfg_file=/etc/nagios3/objects/timeperiods.cfg -#cfg_file=/etc/nagios3/objects/templates.cfg +#cfg_file=/etc/nagios4/objects/commands.cfg +#cfg_file=/etc/nagios4/objects/contacts.cfg +#cfg_file=/etc/nagios4/objects/timeperiods.cfg +#cfg_file=/etc/nagios4/objects/templates.cfg + +# Definitions for monitoring the local (Linux) host +#cfg_file=/etc/nagios4/objects/localhost.cfg # Definitions for monitoring a Windows machine -#cfg_file=/etc/nagios3/objects/windows.cfg +#cfg_file=/etc/nagios4/objects/windows.cfg # Definitions for monitoring a router/switch -#cfg_file=/etc/nagios3/objects/switch.cfg +#cfg_file=/etc/nagios4/objects/switch.cfg # Definitions for monitoring a network printer -#cfg_file=/etc/nagios3/objects/printer.cfg +#cfg_file=/etc/nagios4/objects/printer.cfg # You can also tell Nagios to process all config files (with a .cfg # extension) in a particular directory by using the cfg_dir # directive as shown below: -#cfg_dir=/etc/nagios3/servers -#cfg_dir=/etc/nagios3/printers -#cfg_dir=/etc/nagios3/switches -#cfg_dir=/etc/nagios3/routers +#cfg_dir=/etc/nagios4/servers +#cfg_dir=/etc/nagios4/printers +#cfg_dir=/etc/nagios4/switches +#cfg_dir=/etc/nagios4/routers @@ -66,7 +73,7 @@ cfg_dir=/etc/nagios3/conf.d # directly) in order to prevent inconsistencies that can occur # when the config files are modified after Nagios starts. -object_cache_file=/var/cache/nagios3/objects.cache +object_cache_file=/var/cache/nagios4/objects.cache @@ -82,7 +89,7 @@ object_cache_file=/var/cache/nagios3/objects.cache # Read the documentation section on optimizing Nagios to find our more # about how this feature works. -precached_object_file=/var/lib/nagios3/objects.precache +precached_object_file=/var/cache/nagios4/objects.precache @@ -95,7 +102,7 @@ precached_object_file=/var/lib/nagios3/objects.precache # defined as macros in this file and restrictive permissions (600) # can be placed on this file. -resource_file=/etc/nagios3/resource.cfg +resource_file=/etc/nagios4/resource.cfg @@ -105,7 +112,7 @@ resource_file=/etc/nagios3/resource.cfg # The contents of the status file are deleted every time Nagios # restarts. -status_file=/var/cache/nagios3/status.dat +status_file=/var/cache/nagios4/status.dat @@ -146,24 +153,6 @@ check_external_commands=1 -# EXTERNAL COMMAND CHECK INTERVAL -# This is the interval at which Nagios should check for external commands. -# This value works of the interval_length you specify later. If you leave -# that at its default value of 60 (seconds), a value of 1 here will cause -# Nagios to check for external commands every minute. If you specify a -# number followed by an "s" (i.e. 15s), this will be interpreted to mean -# actual seconds rather than a multiple of the interval_length variable. -# Note: In addition to reading the external command file at regularly -# scheduled intervals, Nagios will also check for external commands after -# event handlers are executed. -# NOTE: Setting this value to -1 causes Nagios to check the external -# command file as often as possible. - -#command_check_interval=15s -command_check_interval=-1 - - - # EXTERNAL COMMAND FILE # This is the file that Nagios checks for external command requests. # It is also where the command CGI will write commands that are submitted @@ -174,17 +163,14 @@ command_check_interval=-1 # Debian Users: In case you didn't read README.Debian yet, _NOW_ is the # time to do it. -command_file=/var/lib/nagios3/rw/nagios.cmd +command_file=/var/cache/nagios4/rw/nagios.cmd -# EXTERNAL COMMAND BUFFER SLOTS -# This settings is used to tweak the number of items or "slots" that -# the Nagios daemon should allocate to the buffer that holds incoming -# external commands before they are processed. As external commands -# are processed by the daemon, they are removed from the buffer. +# QUERY HANDLER INTERFACE +# This is the socket that is created for the Query Handler interface -external_command_buffer_slots=4096 +#query_socket=/var/cache/nagios4/rw/nagios.qh @@ -192,7 +178,7 @@ external_command_buffer_slots=4096 # This is the lockfile that Nagios will use to store its PID number # in when it is running in daemon mode. -lock_file=/var/run/nagios3/nagios3.pid +lock_file=/var/run/nagios4/nagios4.pid @@ -202,7 +188,7 @@ lock_file=/var/run/nagios3/nagios3.pid # is created, used, and deleted throughout the time that Nagios is # running. -temp_file=/var/cache/nagios3/nagios.tmp +temp_file=/var/cache/nagios4/nagios.tmp @@ -254,11 +240,11 @@ event_broker_options=-1 # LOG ROTATION METHOD # This is the log rotation method that Nagios should use to rotate # the main log file. Values are as follows.. -# n = None - don't rotate the log -# h = Hourly rotation (top of the hour) -# d = Daily rotation (midnight every day) -# w = Weekly rotation (midnight on Saturday evening) -# m = Monthly rotation (midnight last day of month) +# n = None - don't rotate the log +# h = Hourly rotation (top of the hour) +# d = Daily rotation (midnight every day) +# w = Weekly rotation (midnight on Saturday evening) +# m = Monthly rotation (midnight last day of month) log_rotation_method=d @@ -268,7 +254,7 @@ log_rotation_method=d # This is the directory where archived (rotated) log files should be # placed (assuming you've chosen to do log rotation). -log_archive_path=/var/log/nagios3/archives +log_archive_path=/var/cache/nagios4/archives @@ -325,6 +311,15 @@ log_initial_states=0 +# CURRENT STATES LOGGING OPTION +# If you don't want Nagios to log all current host and service states +# after log has been rotated to the main log file, you can disable this +# option by setting this value to 0. Default value is 1. + +log_current_states=1 + + + # EXTERNAL COMMANDS LOGGING OPTION # If you don't want Nagios to log external commands, set this value # to 0. If external commands should be logged, set this value to 1. @@ -368,9 +363,9 @@ log_passive_checks=1 # at the same time (with no delay between them)! This is not a # good thing for production, but is useful when testing the # parallelization functionality. -# n = None - don't use any delay between checks -# d = Use a "dumb" delay of 1 second between checks -# s = Use "smart" inter-check delay calculation +# n = None - don't use any delay between checks +# d = Use a "dumb" delay of 1 second between checks +# s = Use "smart" inter-check delay calculation # x.xx = Use an inter-check delay of x.xx seconds service_inter_check_delay_method=s @@ -409,9 +404,9 @@ service_interleave_factor=s # space all host checks out evenly to minimize CPU load. # Using the dumb setting will cause all checks to be scheduled # at the same time (with no delay between them)! -# n = None - don't use any delay between checks -# d = Use a "dumb" delay of 1 second between checks -# s = Use "smart" inter-check delay calculation +# n = None - don't use any delay between checks +# d = Use a "dumb" delay of 1 second between checks +# s = Use "smart" inter-check delay calculation # x.xx = Use an inter-check delay of x.xx seconds host_inter_check_delay_method=s @@ -466,7 +461,7 @@ max_check_result_reaper_time=30 # Note: Make sure that only one instance of Nagios has access # to this directory! -check_result_path=/var/lib/nagios3/spool/checkresults +check_result_path=/var/lib/nagios4/spool/checkresults @@ -594,14 +589,6 @@ auto_rescheduling_window=180 -# SLEEP TIME -# This is the number of seconds to sleep between checking for system -# events and service checks that need to be run. - -sleep_time=0.25 - - - # TIMEOUT VALUES # These options control how much time Nagios will allow various # types of commands to execute before killing them off. Options @@ -641,7 +628,7 @@ retain_state_information=1 # This file is used only if the retain_state_information # variable is set to 1. -state_retention_file=/var/lib/nagios3/retention.dat +state_retention_file=/var/cache/nagios4/retention.dat @@ -730,14 +717,14 @@ interval_length=60 # patches to Nagios. Nagios is critical to you - make sure you keep it in # good shape. Nagios will check once a day for new updates. Data collected # by Nagios Enterprises from the update check is processed in accordance -# with our privacy policy - see http://api.nagios.org for details. +# with our privacy policy - see https://api.nagios.org for details. check_for_updates=1 # BARE UPDATE CHECK -# This option deterines what data Nagios will send to api.nagios.org when +# This option determines what data Nagios will send to api.nagios.org when # it checks for updates. By default, Nagios will send information on the # current version of Nagios you have installed, as well as an indicator as # to whether this was a new installation or not. Nagios Enterprises uses @@ -854,8 +841,8 @@ process_performance_data=0 # Performance data is only written to these files if the # enable_performance_data option (above) is set to 1. -#host_perfdata_file=/tmp/host-perfdata -#service_perfdata_file=/tmp/service-perfdata +#host_perfdata_file=/var/cache/nagios4/host-perfdata +#service_perfdata_file=/var/cache/nagios4/service-perfdata @@ -906,7 +893,7 @@ process_performance_data=0 # HOST AND SERVICE PERFORMANCE DATA PROCESS EMPTY RESULTS -# THese options determine whether the core will process empty perfdata +# These options determine whether the core will process empty perfdata # results or not. This is needed for distributed monitoring, and intentionally # turned on by default. # If you don't require empty perfdata - saving some cpu cycles @@ -917,7 +904,6 @@ process_performance_data=0 #service_perfdata_process_empty_results=1 - # OBSESS OVER SERVICE CHECKS OPTION # This determines whether or not Nagios will obsess over service # checks and run the ocsp_command defined below. Unless you're @@ -1111,10 +1097,10 @@ high_host_flap_threshold=20.0 # DATE FORMAT OPTION # This option determines how short dates are displayed. Valid options # include: -# us (MM-DD-YYYY HH:MM:SS) -# euro (DD-MM-YYYY HH:MM:SS) -# iso8601 (YYYY-MM-DD HH:MM:SS) -# strict-iso8601 (YYYY-MM-DDTHH:MM:SS) +# us (MM-DD-YYYY HH:MM:SS) +# euro (DD-MM-YYYY HH:MM:SS) +# iso8601 (YYYY-MM-DD HH:MM:SS) +# strict-iso8601 (YYYY-MM-DDTHH:MM:SS) # date_format=iso8601 @@ -1141,37 +1127,6 @@ date_format=iso8601 - -# P1.PL FILE LOCATION -# This value determines where the p1.pl perl script (used by the -# embedded Perl interpreter) is located. If you didn't compile -# Nagios with embedded Perl support, this option has no effect. - -p1_file=/usr/lib/nagios3/p1.pl - - - -# EMBEDDED PERL INTERPRETER OPTION -# This option determines whether or not the embedded Perl interpreter -# will be enabled during runtime. This option has no effect if Nagios -# has not been compiled with support for embedded Perl. -# Values: 0 = disable interpreter, 1 = enable interpreter - -enable_embedded_perl=1 - - - -# EMBEDDED PERL USAGE OPTION -# This option determines whether or not Nagios will process Perl plugins -# and scripts with the embedded Perl interpreter if the plugins/scripts -# do not explicitly indicate whether or not it is okay to do so. Read -# the HTML documentation on the embedded Perl interpreter for more -# information on how this option works. - -use_embedded_perl_implicitly=1 - - - # ILLEGAL OBJECT NAME CHARACTERS # This option allows you to specify illegal characters that cannot # be used in host names, service descriptions, or names of other @@ -1187,14 +1142,16 @@ illegal_object_name_chars=`~!$%^&*|'"<>?,()= # handlers, etc. This DOES NOT affect macros used in service or # host check commands. # The following macros are stripped of the characters you specify: -# $HOSTOUTPUT$ -# $HOSTPERFDATA$ -# $HOSTACKAUTHOR$ -# $HOSTACKCOMMENT$ -# $SERVICEOUTPUT$ -# $SERVICEPERFDATA$ -# $SERVICEACKAUTHOR$ -# $SERVICEACKCOMMENT$ +# $HOSTOUTPUT$ +# $LONGHOSTOUTPUT$ +# $HOSTPERFDATA$ +# $HOSTACKAUTHOR$ +# $HOSTACKCOMMENT$ +# $SERVICEOUTPUT$ +# $LONGSERVICEOUTPUT$ +# $SERVICEPERFDATA$ +# $SERVICEACKAUTHOR$ +# $SERVICEACKCOMMENT$ illegal_macro_output_chars=`~$&|'"<> @@ -1265,13 +1222,16 @@ use_large_installation_tweaks=0 # This option determines whether or not Nagios will make all standard # macros available as environment variables when host/service checks # and system commands (event handlers, notifications, etc.) are -# executed. Enabling this option can cause performance issues in -# large installations, as it will consume a bit more memory and (more -# importantly) consume more CPU. -# Values: 1 - Enable environment variable macros (default) -# 0 - Disable environment variable macros +# executed. +# Enabling this is a very bad idea for anything but very small setups, +# as it means plugins, notification scripts and eventhandlers may run +# out of environment space. It will also cause a significant increase +# in CPU- and memory usage and drastically reduce the number of checks +# you can run. +# Values: 1 - Enable environment variable macros +# 0 - Disable environment variable macros (default) -enable_environment_macros=1 +enable_environment_macros=0 @@ -1309,10 +1269,10 @@ enable_environment_macros=1 # Values: # -1 = Everything # 0 = Nothing -# 1 = Functions +# 1 = Functions # 2 = Configuration # 4 = Process information -# 8 = Scheduled events +# 8 = Scheduled events # 16 = Host/service checks # 32 = Notifications # 64 = Event broker @@ -1339,7 +1299,7 @@ debug_verbosity=1 # DEBUG FILE # This option determines where Nagios should write debugging information. -debug_file=/var/log/nagios3/nagios.debug +debug_file=/var/cache/nagios4/nagios.debug @@ -1352,4 +1312,49 @@ debug_file=/var/log/nagios3/nagios.debug max_debug_file_size=1000000 + + +# Should we allow hostgroups to have no hosts, we default this to off since +# that was the old behavior + allow_empty_hostgroup_assignment=1 + + + +# Normally worker count is dynamically allocated based on 1.5 * number of cpu's +# with a minimum of 4 workers. This value will override the defaults + +#check_workers=3 + + + +# DISABLE SERVICE CHECKS WHEN HOST DOWN +# This option will disable all service checks if the host is not in an UP state +# +# While desirable in some environments, enabling this value can distort report +# values as the expected quantity of checks will not have been performed + +#host_down_disable_service_checks=0 + + + +# EXPERIMENTAL load controlling options +# To get current defaults based on your system issue a command to +# the query handler. Please note that this is an experimental feature +# and not meant for production use. Used incorrectly it can induce +# enormous latency. +# #core loadctl +# jobs_max - The maximum amount of jobs to run at one time +# jobs_min - The minimum amount of jobs to run at one time +# jobs_limit - The maximum amount of jobs the current load lets us run +# backoff_limit - The minimum backoff_change +# backoff_change - # of jobs to remove from jobs_limit when backing off +# rampup_limit - Minimum rampup_change +# rampup_change - # of jobs to add to jobs_limit when ramping up +# NOTE: The backoff_limit and rampup_limit are NOT used by anything currently, +# so if your system is under load nothing will actively modify the jobs +# even if you have these options enabled, they are for external +# connector information only. However, if you change the jobs_max or +# jobs_min manually here or through the query handler interface that +# WILL affect your system +#loadctl_options=jobs_max=100;backoff_limit=10;rampup_change=5 diff --git a/puppet/zulip_ops/files/nagios3/resource.cfg b/puppet/zulip_ops/files/nagios4/resource.cfg similarity index 100% rename from puppet/zulip_ops/files/nagios3/resource.cfg rename to puppet/zulip_ops/files/nagios4/resource.cfg diff --git a/puppet/zulip_ops/files/nagios3/zuliprc b/puppet/zulip_ops/files/nagios4/zuliprc similarity index 100% rename from puppet/zulip_ops/files/nagios3/zuliprc rename to puppet/zulip_ops/files/nagios4/zuliprc diff --git a/puppet/zulip_ops/manifests/profile/nagios.pp b/puppet/zulip_ops/manifests/profile/nagios.pp index 7b8c57533a..9a2420fe4d 100644 --- a/puppet/zulip_ops/manifests/profile/nagios.pp +++ b/puppet/zulip_ops/manifests/profile/nagios.pp @@ -3,7 +3,7 @@ class zulip_ops::profile::nagios { include zulip_ops::apache $nagios_packages = [# Packages needed for Nagios - 'nagios3', + 'nagios4', # For sending outgoing email 'msmtp', ] @@ -32,15 +32,15 @@ class zulip_ops::profile::nagios { $hosts_fullstack = split(zulipconf('nagios', 'hosts_fullstack', undef), ',') $hosts_smokescreen = split(zulipconf('nagios', 'hosts_smokescreen', undef), ',') - file { '/etc/nagios3/': + file { '/etc/nagios4/': recurse => true, purge => false, - require => Package[nagios3], + require => Package[nagios4], owner => 'root', group => 'root', mode => '0644', - source => 'puppet:///modules/zulip_ops/nagios3/', - notify => Service['nagios3'], + source => 'puppet:///modules/zulip_ops/nagios4/', + notify => Service['nagios4'], } file { '/etc/apache2/sites-available/nagios.conf': @@ -64,71 +64,71 @@ class zulip_ops::profile::nagios { port => '3000', } - file { '/etc/nagios3/conf.d/contacts.cfg': - require => Package[nagios3], + file { '/etc/nagios4/conf.d/contacts.cfg': + require => Package[nagios4], owner => 'root', group => 'root', mode => '0644', - content => template('zulip_ops/nagios3/contacts.cfg.template.erb'), - notify => Service['nagios3'], + content => template('zulip_ops/nagios4/contacts.cfg.template.erb'), + notify => Service['nagios4'], } - file { '/etc/nagios3/conf.d/hosts.cfg': - require => Package[nagios3], + file { '/etc/nagios4/conf.d/hosts.cfg': + require => Package[nagios4], owner => 'root', group => 'root', mode => '0644', - content => template('zulip_ops/nagios3/hosts.cfg.template.erb'), - notify => Service['nagios3'], + content => template('zulip_ops/nagios4/hosts.cfg.template.erb'), + notify => Service['nagios4'], } - file { '/etc/nagios3/conf.d/localhost.cfg': - require => Package[nagios3], + file { '/etc/nagios4/conf.d/localhost.cfg': + require => Package[nagios4], owner => 'root', group => 'root', mode => '0644', - content => template('zulip_ops/nagios3/localhost.cfg.template.erb'), - notify => Service['nagios3'], + content => template('zulip_ops/nagios4/localhost.cfg.template.erb'), + notify => Service['nagios4'], } - file { '/etc/nagios3/cgi.cfg': - require => Package[nagios3], + file { '/etc/nagios4/cgi.cfg': + require => Package[nagios4], owner => 'root', group => 'root', mode => '0644', - content => template('zulip_ops/nagios3/cgi.cfg.template.erb'), - notify => Service['nagios3'], + content => template('zulip_ops/nagios4/cgi.cfg.template.erb'), + notify => Service['nagios4'], } - service { 'nagios3': + service { 'nagios4': ensure => running, } file { [ - '/etc/nagios3/conf.d/extinfo_nagios2.cfg', - '/etc/nagios3/conf.d/services_nagios2.cfg', - '/etc/nagios3/conf.d/contacts_nagios2.cfg', - '/etc/nagios3/conf.d/hostgroups_nagios2.cfg', - '/etc/nagios3/conf.d/localhost_nagios2.cfg', + '/etc/nagios4/conf.d/extinfo_nagios2.cfg', + '/etc/nagios4/conf.d/services_nagios2.cfg', + '/etc/nagios4/conf.d/contacts_nagios2.cfg', + '/etc/nagios4/conf.d/hostgroups_nagios2.cfg', + '/etc/nagios4/conf.d/localhost_nagios2.cfg', ]: ensure => absent, } - file { '/etc/nagios3/conf.d/zulip_nagios.cfg': + file { '/etc/nagios4/conf.d/zulip_nagios.cfg': ensure => file, mode => '0644', owner => 'root', group => 'root', source => '/usr/local/share/zulip/integrations/nagios/zulip_nagios.cfg', - notify => Service['nagios3'], + notify => Service['nagios4'], } $hosts = zulipconf_nagios_hosts() - file { '/etc/nagios3/conf.d/zulip_autossh.cfg': + file { '/etc/nagios4/conf.d/zulip_autossh.cfg': ensure => file, mode => '0644', owner => 'root', group => 'root', content => template('zulip_ops/nagios_autossh.template.erb'), - notify => Service['nagios3'], + notify => Service['nagios4'], } file { '/var/lib/nagios/msmtprc': @@ -141,14 +141,14 @@ class zulip_ops::profile::nagios { } exec { 'fix_nagios_permissions': - command => 'dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw', - unless => 'bash -c "ls -ld /var/lib/nagios3/rw | grep ^drwx--s--- -q"', - notify => Service['nagios3'], + command => 'dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios4/rw', + unless => 'bash -c "ls -ld /var/lib/nagios4/rw | grep ^drwx--s--- -q"', + notify => Service['nagios4'], } exec { 'fix_nagios_permissions2': - command => 'dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3', - unless => 'bash -c "ls -ld /var/lib/nagios3 | grep ^drwxr-x--x -q"', - notify => Service['nagios3'], + command => 'dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios4', + unless => 'bash -c "ls -ld /var/lib/nagios4 | grep ^drwxr-x--x -q"', + notify => Service['nagios4'], } # TODO: Install our API diff --git a/puppet/zulip_ops/templates/nagios3/cgi.cfg.template.erb b/puppet/zulip_ops/templates/nagios4/cgi.cfg.template.erb similarity index 98% rename from puppet/zulip_ops/templates/nagios3/cgi.cfg.template.erb rename to puppet/zulip_ops/templates/nagios4/cgi.cfg.template.erb index 0dbbc0b48e..86de828a43 100644 --- a/puppet/zulip_ops/templates/nagios3/cgi.cfg.template.erb +++ b/puppet/zulip_ops/templates/nagios4/cgi.cfg.template.erb @@ -10,7 +10,7 @@ # The CGIs will read the main and host config files for any other # data they might need. -main_config_file=/etc/nagios3/nagios.cfg +main_config_file=/etc/nagios4/nagios.cfg @@ -19,7 +19,7 @@ main_config_file=/etc/nagios3/nagios.cfg # value is used to locate the logo images needed by the statusmap # and statuswrl CGIs. -physical_html_path=/usr/share/nagios3/htdocs +physical_html_path=/usr/share/nagios4/htdocs @@ -31,7 +31,7 @@ physical_html_path=/usr/share/nagios3/htdocs # http://www.myhost.com/nagios, this value should be '/nagios' # (without the quotes). -url_html_path=/nagios3 +url_html_path=/nagios4 @@ -68,7 +68,7 @@ use_pending_states=1 # have to be tweaked a bit, as different versions of the plugin # use different command line arguments/syntaxes. -nagios_check_command=/usr/lib/nagios/plugins/check_nagios /var/cache/nagios3/status.dat 5 '/usr/sbin/nagios3' +nagios_check_command=/usr/lib/nagios/plugins/check_nagios /var/cache/nagios4/status.dat 5 '/usr/sbin/nagios4' # AUTHENTICATION USAGE diff --git a/puppet/zulip_ops/templates/nagios3/contacts.cfg.template.erb b/puppet/zulip_ops/templates/nagios4/contacts.cfg.template.erb similarity index 100% rename from puppet/zulip_ops/templates/nagios3/contacts.cfg.template.erb rename to puppet/zulip_ops/templates/nagios4/contacts.cfg.template.erb diff --git a/puppet/zulip_ops/templates/nagios3/hosts.cfg.template.erb b/puppet/zulip_ops/templates/nagios4/hosts.cfg.template.erb similarity index 100% rename from puppet/zulip_ops/templates/nagios3/hosts.cfg.template.erb rename to puppet/zulip_ops/templates/nagios4/hosts.cfg.template.erb diff --git a/puppet/zulip_ops/templates/nagios3/localhost.cfg.template.erb b/puppet/zulip_ops/templates/nagios4/localhost.cfg.template.erb similarity index 100% rename from puppet/zulip_ops/templates/nagios3/localhost.cfg.template.erb rename to puppet/zulip_ops/templates/nagios4/localhost.cfg.template.erb diff --git a/puppet/zulip_ops/templates/nagios_apache_site.conf.template.erb b/puppet/zulip_ops/templates/nagios_apache_site.conf.template.erb index a1f6545c41..4db0cbe435 100644 --- a/puppet/zulip_ops/templates/nagios_apache_site.conf.template.erb +++ b/puppet/zulip_ops/templates/nagios_apache_site.conf.template.erb @@ -4,22 +4,22 @@ Header add Strict-Transport-Security "max-age=15768000" Header add X-Frame-Options DENY - ScriptAlias /cgi-bin/nagios3 /usr/lib/cgi-bin/nagios3 - ScriptAlias /nagios3/cgi-bin /usr/lib/cgi-bin/nagios3 + ScriptAlias /cgi-bin/nagios4 /usr/lib/cgi-bin/nagios4 + ScriptAlias /nagios4/cgi-bin /usr/lib/cgi-bin/nagios4 # Where the stylesheets (config files) reside - Alias /nagios3/stylesheets /etc/nagios3/stylesheets + Alias /nagios4/stylesheets /etc/nagios4/stylesheets # Where the HTML pages live - Alias /nagios3 /usr/share/nagios3/htdocs + Alias /nagios4 /usr/share/nagios4/htdocs Require all granted - RedirectMatch ^/?$ https://nagios.teleport.<%= @default_host_domain %>/cgi-bin/nagios3/status.cgi?host=all + RedirectMatch ^/?$ https://nagios.teleport.<%= @default_host_domain %>/cgi-bin/nagios4/status.cgi?host=all - + Options FollowSymLinks DirectoryIndex index.php index.html @@ -28,7 +28,7 @@ Allow From All - + Options +ExecCGI @@ -36,5 +36,5 @@ # See http://apan.sourceforge.net/download.html for more info # It allows you to see a clickable list of all hostgroups in the # left pane of the Nagios web interface - ScriptAlias /nagios3/side.html /usr/lib/cgi-bin/nagios3/grouplist.cgi + ScriptAlias /nagios4/side.html /usr/lib/cgi-bin/nagios4/grouplist.cgi diff --git a/templates/zerver/integrations/nagios.md b/templates/zerver/integrations/nagios.md index 1c184a2349..50673fa31d 100644 --- a/templates/zerver/integrations/nagios.md +++ b/templates/zerver/integrations/nagios.md @@ -7,7 +7,7 @@ 1. Next, open `integrations/nagios/zuliprc.example` in your favorite editor, and change the following lines to specify the email address - and API key for your Nagios bot, saving it to `/etc/nagios3/zuliprc` + and API key for your Nagios bot, saving it to `/etc/nagios4/zuliprc` on your Nagios server: ``` @@ -17,12 +17,12 @@ site = {{ api_url }} ``` -1. Copy `integrations/nagios/zulip_nagios.cfg` to `/etc/nagios3/conf.d` +1. Copy `integrations/nagios/zulip_nagios.cfg` to `/etc/nagios4/conf.d` on your Nagios server. 1. Finally, add `zulip` to the `members` list for one or more of the contact groups in the `CONTACT GROUPS` section of - `/etc/nagios3/conf.d/contacts.cfg`, doing something like: + `/etc/nagios4/conf.d/contacts.cfg`, doing something like: ``` define contactgroup { @@ -33,11 +33,11 @@ ``` 1. Once you’ve done that, reload your Nagios configuration using - `/etc/init.d/nagios3 reload`. + `/etc/init.d/nagios4 reload`. 1. When your Nagios system makes an alert, you’ll see a message like the following, to the stream `nagios` (to change this, edit the arguments - to `nagios-notify-zulip` in `/etc/nagios3/conf.d/zulip_nagios.cfg`) + to `nagios-notify-zulip` in `/etc/nagios4/conf.d/zulip_nagios.cfg`) with a topic indicating the service with an issue. {!congrats.md!} @@ -58,7 +58,7 @@ on your Nagios instance. You can confirm whether you’ve correctly configured Nagios to run the Zulip plugin by looking for `SERVICE NOTIFICATION` lines mentioning -zulip in `/var/log/nagios3/nagios.log`. You can confirm whether you’ve +zulip in `/var/log/nagios4/nagios.log`. You can confirm whether you’ve configured the Zulip plugin code correctly by running `/usr/local/share/zulip/integrations/nagios/nagios-notify-zulip` directly.