2014-02-05 15:53:22 +01:00
## <a id="running-icinga2"></a> Running Icinga 2
2013-09-27 10:44:24 +02:00
2014-02-05 15:53:22 +01:00
### <a id="init-script"></a> Init Script
2013-09-27 11:48:20 +02:00
2013-10-07 09:35:44 +02:00
Icinga 2's init script is installed in `/etc/init.d/icinga2` by default:
2013-09-27 13:56:11 +02:00
# /etc/init.d/icinga2
Usage: /etc/init.d/icinga2 {start|stop|restart|reload|checkconfig|status}
2013-10-02 09:50:26 +02:00
Command | Description
--------------------|------------------------
2013-10-07 09:35:44 +02:00
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` .
2013-10-10 16:55:59 +02:00
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.
2013-10-07 09:35:44 +02:00
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.
2013-09-27 13:56:11 +02:00
2013-10-20 14:39:20 +02:00
> **Note**
>
2013-10-21 21:03:35 +02:00
> By default the Icinga 2 daemon is running as `icinga` user and group
2013-10-20 14:39:20 +02:00
> using the init script. Using Debian packages the user and group are set to `nagios`
> for historical reasons.
2013-09-27 13:56:11 +02:00
### <a id="cmdline"></a> 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
2014-02-12 11:49:38 +01:00
-D [ --define] args define a constant
2013-09-27 13:56:11 +02:00
-c [ --config ] arg parse a configuration file
-C [ --validate ] exit after 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
2013-10-07 09:35:44 +02:00
Instead of loading libraries using the [`library` config directive ](#library )
you can also use the `--library` command-line option.
2013-09-27 13:56:11 +02:00
2014-02-12 11:49:38 +01:00
#### Constants
2013-11-03 13:45:26 +01:00
2014-02-12 11:49:38 +01:00
[Global constants ](#global-constants ) can be set using the `--define` command-line option.
2013-11-03 13:45:26 +01:00
2013-09-27 13:56:11 +02:00
#### Config Include Path
When including files you can specify that the include search path should be
2013-10-10 16:55:59 +02:00
checked. You can do this by putting your configuration file name in angle
brackets like this:
2013-09-27 13:56:11 +02:00
include < test.conf >
This would cause Icinga 2 to search its include path for the configuration file
2013-10-07 09:35:44 +02:00
`test.conf` . By default the installation path for the Icinga Template Library
2013-09-27 13:56:11 +02:00
is the only search directory.
2013-10-07 09:35:44 +02:00
Using the `--include` command-line option additional search directories can be
2013-09-27 13:56:11 +02:00
added.
#### Config Files
2013-10-10 16:55:59 +02:00
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.
2013-09-27 13:56:11 +02:00
#### Config Validation
2013-10-07 09:35:44 +02:00
The `--validate` option can be used to check if your configuration files
2013-09-27 13:56:11 +02:00
contain errors. If any errors are found the exit status is 1, otherwise 0
is returned.
### <a id="features"></a> Enabling/Disabling Features
Icinga 2 provides configuration files for some commonly used features. These
2013-10-07 09:35:44 +02:00
are installed in the `/etc/icinga2/features-available` directory and can be
2013-10-18 22:11:40 +02:00
enabled and disabled using the `icinga2-enable-feature` and `icinga2-disable-feature` tools,
2013-09-27 13:56:11 +02:00
respectively.
2013-10-18 22:11:40 +02:00
The `icinga2-enable-feature` tool creates symlinks in the `/etc/icinga2/features-enabled`
2013-09-27 13:56:11 +02:00
directory which is included by default in the example configuration file.
You can view a list of available feature configuration files:
2013-10-18 22:11:40 +02:00
# icinga2-enable-feature
Syntax: icinga2-enable-feature < feature >
2013-09-27 13:56:11 +02:00
Enables the specified feature.
2013-10-17 13:57:53 +02:00
Available features: statusdata
2013-09-27 13:56:11 +02:00
2013-10-18 22:11:40 +02:00
Using the `icinga2-enable-feature` command you can enable features:
2013-09-27 13:56:11 +02:00
2013-10-18 22:11:40 +02:00
# icinga2-enable-feature statusdata
2013-10-17 13:57:53 +02:00
Module 'statusdata' was enabled.
2013-09-27 13:56:11 +02:00
Make sure to restart Icinga 2 for these changes to take effect.
2013-10-18 22:11:40 +02:00
You can disable features using the `icinga2-disable-feature` command:
2013-09-27 13:56:11 +02:00
2013-10-18 22:11:40 +02:00
# icinga2-disable-feature statusdata
2013-10-17 13:57:53 +02:00
Module 'statusdata' was disabled.
2013-09-27 13:56:11 +02:00
Make sure to restart Icinga 2 for these changes to take effect.
> **Note**
>
2013-10-18 22:11:40 +02:00
> The `icinga2-enable-feature` and `icinga2-disable-feature` commands do not restart Icinga 2.