File indexing completed on 2025-02-02 03:54:46
0001 <!DOCTYPE html> 0002 <html><head> 0003 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 0004 <title>nagios.cfg</title> 0005 <meta name="generator" content="KF5::SyntaxHighlighting - Definition (Nagios) - Theme (Breeze Light)"/> 0006 </head><body style="background-color:#ffffff;color:#1f1c1b"><pre> 0007 <span style="color:#898887">##############################################################################</span> 0008 <span style="color:#898887">#</span> 0009 <span style="color:#898887"># NAGIOS.CFG - Sample Main Config File for Nagios @VERSION@</span> 0010 <span style="color:#898887">#</span> 0011 <span style="color:#898887"># Read the documentation for more information on this configuration</span> 0012 <span style="color:#898887"># file. I've provided some comments here, but things may not be so</span> 0013 <span style="color:#898887"># clear without further explanation.</span> 0014 <span style="color:#898887">#</span> 0015 <span style="color:#898887">#</span> 0016 <span style="color:#898887">##############################################################################</span> 0017 0018 0019 <span style="color:#898887"># LOG FILE</span> 0020 <span style="color:#898887"># This is the main log file where service and host events are logged</span> 0021 <span style="color:#898887"># for historical purposes. This should be the first option specified</span> 0022 <span style="color:#898887"># in the config file!!!</span> 0023 0024 log_file<span style="color:#006e28">=</span><span style="color:#bf0303">@localstatedir@/nagios.log</span> 0025 0026 0027 0028 <span style="color:#898887"># OBJECT CONFIGURATION FILE(S)</span> 0029 <span style="color:#898887"># These are the object configuration files in which you define hosts,</span> 0030 <span style="color:#898887"># host groups, contacts, contact groups, services, etc.</span> 0031 <span style="color:#898887"># You can split your object definitions across several config files</span> 0032 <span style="color:#898887"># if you wish (as shown below), or keep them all in a single config file.</span> 0033 0034 <span style="color:#898887"># You can specify individual object config files as shown below:</span> 0035 cfg_file<span style="color:#006e28">=</span><span style="color:#bf0303">@sysconfdir@/objects/commands.cfg</span> 0036 cfg_file<span style="color:#006e28">=</span><span style="color:#bf0303">@sysconfdir@/objects/contacts.cfg</span> 0037 cfg_file<span style="color:#006e28">=</span><span style="color:#bf0303">@sysconfdir@/objects/timeperiods.cfg</span> 0038 cfg_file<span style="color:#006e28">=</span><span style="color:#bf0303">@sysconfdir@/objects/templates.cfg</span> 0039 0040 <span style="color:#898887"># Definitions for monitoring the local (Linux) host</span> 0041 cfg_file<span style="color:#006e28">=</span><span style="color:#bf0303">@sysconfdir@/objects/localhost.cfg</span> 0042 0043 <span style="color:#898887"># Definitions for monitoring a Windows machine</span> 0044 <span style="color:#898887">#cfg_file=@sysconfdir@/objects/windows.cfg</span> 0045 0046 <span style="color:#898887"># Definitions for monitoring a router/switch</span> 0047 <span style="color:#898887">#cfg_file=@sysconfdir@/objects/switch.cfg</span> 0048 0049 <span style="color:#898887"># Definitions for monitoring a network printer</span> 0050 <span style="color:#898887">#cfg_file=@sysconfdir@/objects/printer.cfg</span> 0051 0052 0053 <span style="color:#898887"># You can also tell Nagios to process all config files (with a .cfg</span> 0054 <span style="color:#898887"># extension) in a particular directory by using the cfg_dir</span> 0055 <span style="color:#898887"># directive as shown below:</span> 0056 0057 <span style="color:#898887">#cfg_dir=@sysconfdir@/servers</span> 0058 <span style="color:#898887">#cfg_dir=@sysconfdir@/printers</span> 0059 <span style="color:#898887">#cfg_dir=@sysconfdir@/switches</span> 0060 <span style="color:#898887">#cfg_dir=@sysconfdir@/routers</span> 0061 0062 0063 0064 0065 <span style="color:#898887"># OBJECT CACHE FILE</span> 0066 <span style="color:#898887"># This option determines where object definitions are cached when</span> 0067 <span style="color:#898887"># Nagios starts/restarts. The CGIs read object definitions from</span> 0068 <span style="color:#898887"># this cache file (rather than looking at the object config files</span> 0069 <span style="color:#898887"># directly) in order to prevent inconsistencies that can occur</span> 0070 <span style="color:#898887"># when the config files are modified after Nagios starts.</span> 0071 0072 object_cache_file<span style="color:#006e28">=</span><span style="color:#bf0303">@localstatedir@/objects.cache</span> 0073 0074 0075 0076 <span style="color:#898887"># PRE-CACHED OBJECT FILE</span> 0077 <span style="color:#898887"># This options determines the location of the precached object file.</span> 0078 <span style="color:#898887"># If you run Nagios with the -p command line option, it will preprocess</span> 0079 <span style="color:#898887"># your object configuration file(s) and write the cached config to this</span> 0080 <span style="color:#898887"># file. You can then start Nagios with the -u option to have it read</span> 0081 <span style="color:#898887"># object definitions from this precached file, rather than the standard</span> 0082 <span style="color:#898887"># object configuration files (see the cfg_file and cfg_dir options above).</span> 0083 <span style="color:#898887"># Using a precached object file can speed up the time needed to (re)start</span> 0084 <span style="color:#898887"># the Nagios process if you've got a large and/or complex configuration.</span> 0085 <span style="color:#898887"># Read the documentation section on optimizing Nagios to find our more</span> 0086 <span style="color:#898887"># about how this feature works.</span> 0087 0088 precached_object_file<span style="color:#006e28">=</span><span style="color:#bf0303">@localstatedir@/objects.precache</span> 0089 0090 0091 0092 <span style="color:#898887"># RESOURCE FILE</span> 0093 <span style="color:#898887"># This is an optional resource file that contains $USERx$ macro</span> 0094 <span style="color:#898887"># definitions. Multiple resource files can be specified by using</span> 0095 <span style="color:#898887"># multiple resource_file definitions. The CGIs will not attempt to</span> 0096 <span style="color:#898887"># read the contents of resource files, so information that is</span> 0097 <span style="color:#898887"># considered to be sensitive (usernames, passwords, etc) can be</span> 0098 <span style="color:#898887"># defined as macros in this file and restrictive permissions (600)</span> 0099 <span style="color:#898887"># can be placed on this file.</span> 0100 0101 resource_file<span style="color:#006e28">=</span><span style="color:#bf0303">@sysconfdir@/resource.cfg</span> 0102 0103 0104 0105 <span style="color:#898887"># STATUS FILE</span> 0106 <span style="color:#898887"># This is where the current status of all monitored services and</span> 0107 <span style="color:#898887"># hosts is stored. Its contents are read and processed by the CGIs.</span> 0108 <span style="color:#898887"># The contents of the status file are deleted every time Nagios</span> 0109 <span style="color:#898887"># restarts.</span> 0110 0111 status_file<span style="color:#006e28">=</span><span style="color:#bf0303">@localstatedir@/status.dat</span> 0112 0113 0114 0115 <span style="color:#898887"># STATUS FILE UPDATE INTERVAL</span> 0116 <span style="color:#898887"># This option determines the frequency (in seconds) that</span> 0117 <span style="color:#898887"># Nagios will periodically dump program, host, and</span> 0118 <span style="color:#898887"># service status data.</span> 0119 0120 status_update_interval<span style="color:#006e28">=</span><span style="color:#b08000">10</span> 0121 0122 0123 0124 <span style="color:#898887"># NAGIOS USER</span> 0125 <span style="color:#898887"># This determines the effective user that Nagios should run as.</span> 0126 <span style="color:#898887"># You can either supply a username or a UID.</span> 0127 0128 nagios_user<span style="color:#006e28">=</span><span style="color:#bf0303">@nagios_user@</span> 0129 0130 0131 0132 <span style="color:#898887"># NAGIOS GROUP</span> 0133 <span style="color:#898887"># This determines the effective group that Nagios should run as.</span> 0134 <span style="color:#898887"># You can either supply a group name or a GID.</span> 0135 0136 nagios_group<span style="color:#006e28">=</span><span style="color:#bf0303">@nagios_grp@</span> 0137 0138 0139 0140 <span style="color:#898887"># EXTERNAL COMMAND OPTION</span> 0141 <span style="color:#898887"># This option allows you to specify whether or not Nagios should check</span> 0142 <span style="color:#898887"># for external commands (in the command file defined below).</span> 0143 <span style="color:#898887"># By default Nagios will check for external commands.</span> 0144 <span style="color:#898887"># If you want to be able to use the CGI command interface</span> 0145 <span style="color:#898887"># you will have to enable this.</span> 0146 <span style="color:#898887"># Values: 0 = disable commands, 1 = enable commands</span> 0147 0148 check_external_commands<span style="color:#006e28">=</span><span style="color:#b08000">1</span> 0149 0150 0151 0152 <span style="color:#898887"># EXTERNAL COMMAND FILE</span> 0153 <span style="color:#898887"># This is the file that Nagios checks for external command requests.</span> 0154 <span style="color:#898887"># It is also where the command CGI will write commands that are submitted</span> 0155 <span style="color:#898887"># by users, so it must be writeable by the user that the web server</span> 0156 <span style="color:#898887"># is running as (usually 'nobody'). Permissions should be set at the</span> 0157 <span style="color:#898887"># directory level instead of on the file, as the file is deleted every</span> 0158 <span style="color:#898887"># time its contents are processed.</span> 0159 0160 command_file<span style="color:#006e28">=</span><span style="color:#bf0303">@localstatedir@/rw/nagios.cmd</span> 0161 0162 0163 0164 <span style="color:#898887"># QUERY HANDLER INTERFACE</span> 0165 <span style="color:#898887"># This is the socket that is created for the Query Handler interface</span> 0166 0167 <span style="color:#898887">#query_socket=@localstatedir@/rw/nagios.qh</span> 0168 0169 0170 0171 <span style="color:#898887"># LOCK FILE</span> 0172 <span style="color:#898887"># This is the lockfile that Nagios will use to store its PID number</span> 0173 <span style="color:#898887"># in when it is running in daemon mode.</span> 0174 0175 lock_file<span style="color:#006e28">=</span><span style="color:#bf0303">@subsyslockfile@</span> 0176 0177 0178 0179 <span style="color:#898887"># TEMP FILE</span> 0180 <span style="color:#898887"># This is a temporary file that is used as scratch space when Nagios</span> 0181 <span style="color:#898887"># updates the status log, cleans the comment file, etc. This file</span> 0182 <span style="color:#898887"># is created, used, and deleted throughout the time that Nagios is</span> 0183 <span style="color:#898887"># running.</span> 0184 0185 temp_file<span style="color:#006e28">=</span><span style="color:#bf0303">@localstatedir@/nagios.tmp</span> 0186 0187 0188 0189 <span style="color:#898887"># TEMP PATH</span> 0190 <span style="color:#898887"># This is path where Nagios can create temp files for service and</span> 0191 <span style="color:#898887"># host check results, etc.</span> 0192 0193 temp_path<span style="color:#006e28">=</span><span style="color:#bf0303">@TMPDIR@</span> 0194 0195 0196 0197 <span style="color:#898887"># EVENT BROKER OPTIONS</span> 0198 <span style="color:#898887"># Controls what (if any) data gets sent to the event broker.</span> 0199 <span style="color:#898887"># Values: 0 = Broker nothing</span> 0200 <span style="color:#898887"># -1 = Broker everything</span> 0201 <span style="color:#898887"># <other> = See documentation</span> 0202 0203 event_broker_options<span style="color:#006e28">=</span><span style="color:#bf0303">-</span><span style="color:#b08000">1</span> 0204 0205 0206 0207 <span style="color:#898887"># EVENT BROKER MODULE(S)</span> 0208 <span style="color:#898887"># This directive is used to specify an event broker module that should</span> 0209 <span style="color:#898887"># by loaded by Nagios at startup. Use multiple directives if you want</span> 0210 <span style="color:#898887"># to load more than one module. Arguments that should be passed to</span> 0211 <span style="color:#898887"># the module at startup are separated from the module path by a space.</span> 0212 <span style="color:#898887">#</span> 0213 <span style="color:#898887">#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</span> 0214 <span style="color:#898887"># </span><span style="color:#ca9219;background-color:#451e1a;font-weight:bold">WARNING</span><span style="color:#898887"> !!! </span><span style="color:#ca9219;background-color:#451e1a;font-weight:bold">WARNING</span><span style="color:#898887"> !!! </span><span style="color:#ca9219;background-color:#451e1a;font-weight:bold">WARNING</span><span style="color:#898887"> !!! </span><span style="color:#ca9219;background-color:#451e1a;font-weight:bold">WARNING</span><span style="color:#898887"> !!! </span><span style="color:#ca9219;background-color:#451e1a;font-weight:bold">WARNING</span><span style="color:#898887"> !!! </span><span style="color:#ca9219;background-color:#451e1a;font-weight:bold">WARNING</span> 0215 <span style="color:#898887">#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</span> 0216 <span style="color:#898887">#</span> 0217 <span style="color:#898887"># Do NOT overwrite modules while they are being used by Nagios or Nagios</span> 0218 <span style="color:#898887"># will crash in a fiery display of SEGFAULT glory. This is a bug/limitation</span> 0219 <span style="color:#898887"># either in dlopen(), the kernel, and/or the filesystem. And maybe Nagios...</span> 0220 <span style="color:#898887">#</span> 0221 <span style="color:#898887"># The correct/safe way of updating a module is by using one of these methods:</span> 0222 <span style="color:#898887"># 1. Shutdown Nagios, replace the module file, restart Nagios</span> 0223 <span style="color:#898887"># 2. Delete the original module file, move the new module file into place,</span> 0224 <span style="color:#898887"># restart Nagios</span> 0225 <span style="color:#898887">#</span> 0226 <span style="color:#898887"># Example:</span> 0227 <span style="color:#898887">#</span> 0228 <span style="color:#898887"># broker_module=<modulepath> [moduleargs]</span> 0229 0230 <span style="color:#898887">#broker_module=/somewhere/module1.o</span> 0231 <span style="color:#898887">#broker_module=/somewhere/module2.o arg1 arg2=3 debug=0</span> 0232 0233 0234 0235 <span style="color:#898887"># LOG ROTATION METHOD</span> 0236 <span style="color:#898887"># This is the log rotation method that Nagios should use to rotate</span> 0237 <span style="color:#898887"># the main log file. Values are as follows..</span> 0238 <span style="color:#898887"># n = None - don't rotate the log</span> 0239 <span style="color:#898887"># h = Hourly rotation (top of the hour)</span> 0240 <span style="color:#898887"># d = Daily rotation (midnight every day)</span> 0241 <span style="color:#898887"># w = Weekly rotation (midnight on Saturday evening)</span> 0242 <span style="color:#898887"># m = Monthly rotation (midnight last day of month)</span> 0243 0244 log_rotation_method<span style="color:#006e28">=</span><span style="color:#bf0303">d</span> 0245 0246 0247 0248 <span style="color:#898887"># LOG ARCHIVE PATH</span> 0249 <span style="color:#898887"># This is the directory where archived (rotated) log files should be</span> 0250 <span style="color:#898887"># placed (assuming you've chosen to do log rotation).</span> 0251 0252 log_archive_path<span style="color:#006e28">=</span><span style="color:#bf0303">@localstatedir@/archives</span> 0253 0254 0255 0256 <span style="color:#898887"># LOGGING OPTIONS</span> 0257 <span style="color:#898887"># If you want messages logged to the syslog facility, as well as the</span> 0258 <span style="color:#898887"># Nagios log file set this option to 1. If not, set it to 0.</span> 0259 0260 use_syslog<span style="color:#006e28">=</span><span style="color:#b08000">1</span> 0261 0262 0263 0264 <span style="color:#898887"># NOTIFICATION LOGGING OPTION</span> 0265 <span style="color:#898887"># If you don't want notifications to be logged, set this value to 0.</span> 0266 <span style="color:#898887"># If notifications should be logged, set the value to 1.</span> 0267 0268 log_notifications<span style="color:#006e28">=</span><span style="color:#b08000">1</span> 0269 0270 0271 0272 <span style="color:#898887"># SERVICE RETRY LOGGING OPTION</span> 0273 <span style="color:#898887"># If you don't want service check retries to be logged, set this value</span> 0274 <span style="color:#898887"># to 0. If retries should be logged, set the value to 1.</span> 0275 0276 log_service_retries<span style="color:#006e28">=</span><span style="color:#b08000">1</span> 0277 0278 0279 0280 <span style="color:#898887"># HOST RETRY LOGGING OPTION</span> 0281 <span style="color:#898887"># If you don't want host check retries to be logged, set this value to</span> 0282 <span style="color:#898887"># 0. If retries should be logged, set the value to 1.</span> 0283 0284 log_host_retries<span style="color:#006e28">=</span><span style="color:#b08000">1</span> 0285 0286 0287 0288 <span style="color:#898887"># EVENT HANDLER LOGGING OPTION</span> 0289 <span style="color:#898887"># If you don't want host and service event handlers to be logged, set</span> 0290 <span style="color:#898887"># this value to 0. If event handlers should be logged, set the value</span> 0291 <span style="color:#898887"># to 1.</span> 0292 0293 log_event_handlers<span style="color:#006e28">=</span><span style="color:#b08000">1</span> 0294 0295 0296 0297 <span style="color:#898887"># INITIAL STATES LOGGING OPTION</span> 0298 <span style="color:#898887"># If you want Nagios to log all initial host and service states to</span> 0299 <span style="color:#898887"># the main log file (the first time the service or host is checked)</span> 0300 <span style="color:#898887"># you can enable this option by setting this value to 1. If you</span> 0301 <span style="color:#898887"># are not using an external application that does long term state</span> 0302 <span style="color:#898887"># statistics reporting, you do not need to enable this option. In</span> 0303 <span style="color:#898887"># this case, set the value to 0.</span> 0304 0305 log_initial_states<span style="color:#006e28">=</span><span style="color:#b08000">0</span> 0306 0307 0308 0309 <span style="color:#898887"># CURRENT STATES LOGGING OPTION</span> 0310 <span style="color:#898887"># If you don't want Nagios to log all current host and service states</span> 0311 <span style="color:#898887"># after log has been rotated to the main log file, you can disable this</span> 0312 <span style="color:#898887"># option by setting this value to 0. Default value is 1.</span> 0313 0314 log_current_states<span style="color:#006e28">=</span><span style="color:#b08000">1</span> 0315 0316 0317 0318 <span style="color:#898887"># EXTERNAL COMMANDS LOGGING OPTION</span> 0319 <span style="color:#898887"># If you don't want Nagios to log external commands, set this value</span> 0320 <span style="color:#898887"># to 0. If external commands should be logged, set this value to 1.</span> 0321 <span style="color:#898887"># Note: This option does not include logging of passive service</span> 0322 <span style="color:#898887"># checks - see the option below for controlling whether or not</span> 0323 <span style="color:#898887"># passive checks are logged.</span> 0324 0325 log_external_commands<span style="color:#006e28">=</span><span style="color:#b08000">1</span> 0326 0327 0328 0329 <span style="color:#898887"># PASSIVE CHECKS LOGGING OPTION</span> 0330 <span style="color:#898887"># If you don't want Nagios to log passive host and service checks, set</span> 0331 <span style="color:#898887"># this value to 0. If passive checks should be logged, set</span> 0332 <span style="color:#898887"># this value to 1.</span> 0333 0334 log_passive_checks<span style="color:#006e28">=</span><span style="color:#b08000">1</span> 0335 0336 0337 0338 <span style="color:#898887"># GLOBAL HOST AND SERVICE EVENT HANDLERS</span> 0339 <span style="color:#898887"># These options allow you to specify a host and service event handler</span> 0340 <span style="color:#898887"># command that is to be run for every host or service state change.</span> 0341 <span style="color:#898887"># The global event handler is executed immediately prior to the event</span> 0342 <span style="color:#898887"># handler that you have optionally specified in each host or</span> 0343 <span style="color:#898887"># service definition. The command argument is the short name of a</span> 0344 <span style="color:#898887"># command definition that you define in your host configuration file.</span> 0345 <span style="color:#898887"># Read the HTML docs for more information.</span> 0346 0347 <span style="color:#898887">#global_host_event_handler=somecommand</span> 0348 <span style="color:#898887">#global_service_event_handler=somecommand</span> 0349 </pre></body></html>