icinga2/doc/2.7-running-icinga-2.md

4.5 KiB

Running Icinga 2

Init Script

Icinga 2's init script is installed in /etc/init.d/icinga2 by default:

# /etc/init.d/icinga2
Usage: /etc/init.d/icinga2 {start|stop|restart|reload|checkconfig|status}
Command Description
start The start action starts the Icinga 2 daemon.
stop The stop action stops the Icinga 2 daemon.
restart The restart action is a shortcut for running the stop action followed by start.
reload The reload action sends the HUP signal to Icinga 2 which causes it to restart. Unlike the restart action reload does not wait until Icinga 2 has restarted.
checkconfig The checkconfig action checks if the /etc/icinga2/icinga2.conf configuration file contains any errors.
status The status action checks if Icinga 2 is running.

Note

By default the Icinga 2 daemon is running as icinga user and group using the init script. Using Debian packages the user and group are set to nagios for historical reasons.

Command-line Options

$ icinga2 --help
icinga2 - The Icinga 2 network monitoring daemon.

Supported options:
  --help                show this help message
  -V [ --version ]      show version information
  -l [ --library ] arg  load a library
  -I [ --include ] arg  add include search directory
  -D [ --define] args   define a constant
  -c [ --config ] arg   parse a configuration file
  -C [ --validate ]     exit after validating the configuration
  -Z [ --no-validate ]  skip validating the configuration
  -x [ --debug ]        enable debugging
  -d [ --daemonize ]    detach from the controlling terminal
  -e [ --errorlog ] arg log fatal errors to the specified log file (only works
                        in combination with --daemonize)
  -u [ --user ] arg     user to run Icinga as
  -g [ --group ] arg    group to run Icinga as

Report bugs at <https://dev.icinga.org/>
Icinga home page: <http://www.icinga.org/>

Libraries

Instead of loading libraries using the library config directive you can also use the --library command-line option.

Constants

Global constants can be set using the --define command-line option.

Config Include Path

When including files you can specify that the include search path should be checked. You can do this by putting your configuration file name in angle brackets like this:

include <test.conf>

This would cause Icinga 2 to search its include path for the configuration file test.conf. By default the installation path for the Icinga Template Library is the only search directory.

Using the --include command-line option additional search directories can be added.

Config Files

Using the --config option you can specify one or more configuration files. Config files are processed in the order they're specified on the command-line.

Config Validation

The --validate option can be used to check if your configuration files contain errors. If any errors are found the exit status is 1, otherwise 0 is returned.

Enabling/Disabling Features

Icinga 2 provides configuration files for some commonly used features. These are installed in the /etc/icinga2/features-available directory and can be enabled and disabled using the icinga2-enable-feature and icinga2-disable-feature tools, respectively.

The icinga2-enable-feature tool creates symlinks in the /etc/icinga2/features-enabled directory which is included by default in the example configuration file.

You can view a list of available feature configuration files:

# icinga2-enable-feature
Syntax: icinga2-enable-feature <feature>
Enables the specified feature.

Available features: statusdata

Using the icinga2-enable-feature command you can enable features:

# icinga2-enable-feature statusdata
Module 'statusdata' was enabled.
Make sure to restart Icinga 2 for these changes to take effect.

You can disable features using the icinga2-disable-feature command:

# icinga2-disable-feature statusdata
Module 'statusdata' was disabled.
Make sure to restart Icinga 2 for these changes to take effect.

Note

The icinga2-enable-feature and icinga2-disable-feature commands do not restart Icinga 2.