2015-08-26 13:35:11 +02:00
|
|
|
# <a id="commandtransports"></a> The commandtransports.ini configuration file
|
2013-08-01 17:59:13 +02:00
|
|
|
|
|
|
|
## Abstract
|
|
|
|
|
2015-08-26 13:35:11 +02:00
|
|
|
The commandtransports.ini defines how Icinga Web 2 accesses the command pipe of
|
|
|
|
your Icinga instance in order to submit external commands. Depending on the
|
|
|
|
config path (default: /etc/icingaweb2) of your Icinga Web 2 installation you can
|
|
|
|
find it under ./modules/monitoring/commandtransports.ini.
|
2013-08-01 17:59:13 +02:00
|
|
|
|
|
|
|
## Syntax
|
|
|
|
|
2015-08-26 13:35:11 +02:00
|
|
|
You can define multiple command transports in the commandtransports.ini. Icinga
|
|
|
|
Web 2 will utilize the first transport as the default for a specific Icinga
|
|
|
|
instance.
|
2013-08-01 17:59:13 +02:00
|
|
|
|
2015-08-26 13:35:11 +02:00
|
|
|
Every transport starts with a section header containing its name, followed by
|
|
|
|
the config directives for this transport in the standard INI-format.
|
2013-08-01 17:59:13 +02:00
|
|
|
|
2015-08-26 13:35:11 +02:00
|
|
|
## Using a local command pipe
|
2013-08-01 17:59:13 +02:00
|
|
|
|
2015-08-26 13:35:11 +02:00
|
|
|
A local Icinga instance requires the following directives:
|
2013-08-01 17:59:13 +02:00
|
|
|
|
2015-08-26 13:35:11 +02:00
|
|
|
````
|
|
|
|
[icinga2]
|
|
|
|
transport = local
|
|
|
|
path = /var/run/icinga2/cmd/icinga2.cmd
|
|
|
|
````
|
2013-08-01 17:59:13 +02:00
|
|
|
|
2015-08-26 13:35:11 +02:00
|
|
|
When sending commands to the Icinga instance, Icinga Web 2 opens the file found
|
|
|
|
on the local filesystem underneath 'path' and writes the external command to it.
|
2013-08-01 17:59:13 +02:00
|
|
|
|
2015-08-26 13:35:11 +02:00
|
|
|
## Using SSH for accessing a remote command pipe
|
2013-08-01 17:59:13 +02:00
|
|
|
|
2015-08-26 13:35:11 +02:00
|
|
|
A command pipe on a remote host's filesystem can be accessed by configuring a
|
|
|
|
SSH based command transport and requires the following directives:
|
2013-08-01 17:59:13 +02:00
|
|
|
|
2015-08-26 13:35:11 +02:00
|
|
|
````
|
|
|
|
[icinga2]
|
|
|
|
transport = remote
|
|
|
|
path = /var/run/icinga2/cmd/icinga2.cmd
|
|
|
|
host = example.tld
|
|
|
|
;port = 22 ; Optional. The default is 22
|
|
|
|
user = icinga
|
|
|
|
````
|
2013-08-01 17:59:13 +02:00
|
|
|
|
2015-08-26 13:35:11 +02:00
|
|
|
To make this example work, you'll need to permit your web-server's user
|
|
|
|
public-key based access to the defined remote host so that Icinga Web 2 can
|
|
|
|
connect to it and login as the defined user.
|
2015-05-28 10:43:30 +02:00
|
|
|
|
2015-08-26 13:35:11 +02:00
|
|
|
You can also make use of a dedicated SSH resource to permit access for a
|
|
|
|
different user than the web-server's one. This way, you can provide a private
|
|
|
|
key file on the local filesystem that is used to access the remote host.
|
2015-05-28 10:43:30 +02:00
|
|
|
|
2015-08-26 13:35:11 +02:00
|
|
|
To accomplish this, a new resource is required that is defined in your
|
|
|
|
transport's configuration instead of a user:
|
2015-05-28 10:43:30 +02:00
|
|
|
|
2015-08-26 13:35:11 +02:00
|
|
|
````
|
|
|
|
[icinga2]
|
|
|
|
transport = remote
|
|
|
|
path = /var/run/icinga2/cmd/icinga2.cmd
|
|
|
|
host = example.tld
|
|
|
|
;port = 22 ; Optional. The default is 22
|
|
|
|
resource = example.tld-icinga2
|
|
|
|
````
|
2013-08-01 17:59:13 +02:00
|
|
|
|
2015-08-26 13:35:11 +02:00
|
|
|
The resource's configuration needs to be put into the resources.ini file:
|
2013-08-01 17:59:13 +02:00
|
|
|
|
2015-08-26 13:35:11 +02:00
|
|
|
````
|
|
|
|
[example.tld-icinga2]
|
|
|
|
type = ssh
|
|
|
|
user = icinga
|
|
|
|
private_key = /etc/icingaweb2/ssh/icinga
|
|
|
|
````
|