]> granicus.if.org Git - icinga2/blob - doc/2.7-running-icinga-2.md
Remove the 'Icinga' prefix for global constants.
[icinga2] / doc / 2.7-running-icinga-2.md
1 ## <a id="running-icinga2"></a> Running Icinga 2
2
3 ### <a id="init-script"></a> Init Script
4
5 Icinga 2's init script is installed in `/etc/init.d/icinga2` by default:
6
7     # /etc/init.d/icinga2
8     Usage: /etc/init.d/icinga2 {start|stop|restart|reload|checkconfig|status}
9
10   Command             | Description
11   --------------------|------------------------
12   start               | The `start` action starts the Icinga 2 daemon.
13   stop                | The `stop` action stops the Icinga 2 daemon.
14   restart             | The `restart` action is a shortcut for running the `stop` action followed by `start`.
15   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.
16   checkconfig         | The `checkconfig` action checks if the `/etc/icinga2/icinga2.conf` configuration file contains any errors.
17   status              | The `status` action checks if Icinga 2 is running.
18
19 By default the Icinga 2 daemon is running as `icinga` user and group
20 using the init script. Using Debian packages the user and group are set to `nagios`
21 for historical reasons.
22
23 ### <a id="cmdline"></a> Command-line Options
24
25     $ icinga2 --help
26     icinga2 - The Icinga 2 network monitoring daemon.
27
28     Supported options:
29       --help                show this help message
30       -V [ --version ]      show version information
31       -l [ --library ] arg  load a library
32       -I [ --include ] arg  add include search directory
33       -D [ --define] args   define a constant
34       -c [ --config ] arg   parse a configuration file
35       -C [ --validate ]     exit after validating the configuration
36       -Z [ --no-validate ]  skip validating the configuration
37       -x [ --debug ]        enable debugging
38       -d [ --daemonize ]    detach from the controlling terminal
39       -e [ --errorlog ] arg log fatal errors to the specified log file (only works
40                             in combination with --daemonize)
41       -u [ --user ] arg     user to run Icinga as
42       -g [ --group ] arg    group to run Icinga as
43
44     Report bugs at <https://dev.icinga.org/>
45     Icinga home page: <http://www.icinga.org/>
46
47 #### Libraries
48
49 Instead of loading libraries using the [`library` config directive](#library)
50 you can also use the `--library` command-line option.
51
52 #### Constants
53
54 [Global constants](#global-constants) can be set using the `--define` command-line option.
55
56 #### Config Include Path
57
58 When including files you can specify that the include search path should be
59 checked. You can do this by putting your configuration file name in angle
60 brackets like this:
61
62     include <test.conf>
63
64 This would cause Icinga 2 to search its include path for the configuration file
65 `test.conf`. By default the installation path for the Icinga Template Library
66 is the only search directory.
67
68 Using the `--include` command-line option additional search directories can be
69 added.
70
71 #### Config Files
72
73 Using the `--config` option you can specify one or more configuration files.
74 Config files are processed in the order they're specified on the command-line.
75
76 #### Config Validation
77
78 The `--validate` option can be used to check if your configuration files
79 contain errors. If any errors are found the exit status is 1, otherwise 0
80 is returned.
81
82 ### <a id="features"></a> Enabling/Disabling Features
83
84 Icinga 2 provides configuration files for some commonly used features. These
85 are installed in the `/etc/icinga2/features-available` directory and can be
86 enabled and disabled using the `icinga2-enable-feature` and `icinga2-disable-feature` tools,
87 respectively.
88
89 The `icinga2-enable-feature` tool creates symlinks in the `/etc/icinga2/features-enabled`
90 directory which is included by default in the example configuration file.
91
92 You can view a list of available feature configuration files:
93
94     # icinga2-enable-feature
95     Syntax: icinga2-enable-feature <feature>
96     Enables the specified feature.
97
98     Available features: statusdata
99
100 Using the `icinga2-enable-feature` command you can enable features:
101
102     # icinga2-enable-feature statusdata
103     Module 'statusdata' was enabled.
104     Make sure to restart Icinga 2 for these changes to take effect.
105
106 You can disable features using the `icinga2-disable-feature` command:
107
108     # icinga2-disable-feature statusdata
109     Module 'statusdata' was disabled.
110     Make sure to restart Icinga 2 for these changes to take effect.
111
112 The `icinga2-enable-feature` and `icinga2-disable-feature` commands do not
113 restart Icinga 2. You will need to restart Icinga 2 using the init script
114 after enabling or disabling features.
115