2014-11-18 16:21:48 +01:00
# <a id="resources"></a> Resources
2016-07-08 16:39:24 +02:00
The configuration file `config/resources.ini` contains information about data sources that can be referenced in other
2014-11-18 16:21:48 +01:00
configuration files. This allows you to manage all data sources at one central place, avoiding the need to edit several
different files, when the information about a data source changes.
## <a id="resources-configuration"></a> Configuration
2016-07-08 16:39:24 +02:00
Each section in `config/resources.ini` represents a data source with the section name being the identifier used to
2014-11-18 16:21:48 +01:00
reference this specific data source. Depending on the data source type, the sections define different directives.
2015-05-28 10:42:18 +02:00
The available data source types are *db* , *ldap* , *ssh* and *livestatus* which will described in detail in the following
2014-11-18 16:21:48 +01:00
paragraphs.
### <a id="resources-configuration-database"></a> Database
A Database resource defines a connection to a SQL databases which can contain users and groups
to handle authentication and authorization, monitoring data or user preferences.
Directive | Description
2016-07-08 16:39:24 +02:00
:---------------|:------------
2014-11-18 16:21:48 +01:00
**type** | `db`
2015-09-28 16:29:01 +02:00
**db** | Database management system. In most cases `mysql` or `pgsql` .
**host** | Connect to the database server on the given host. For using unix domain sockets, specify `localhost` for MySQL and the path to the unix domain socket directory for PostgreSQL.
**port** | Port number to use. Mandatory for connections to a PostgreSQL database.
2014-11-18 16:21:48 +01:00
**username** | The username to use when connecting to the server.
**password** | The password to use when connecting to the server.
**dbname** | The database to use.
2016-07-08 16:39:24 +02:00
#### <a id="resources-configuration-database-example"></a> Example
2014-11-18 16:21:48 +01:00
2015-09-28 16:29:01 +02:00
````
[icingaweb-mysql-tcp]
2014-11-18 16:21:48 +01:00
type = db
db = mysql
2015-09-28 16:29:01 +02:00
host = 127.0.0.1
2014-11-18 16:21:48 +01:00
port = 3306
username = icingaweb
password = icingaweb
dbname = icingaweb
2015-09-28 16:29:01 +02:00
[icingaweb-mysql-socket]
type = db
db = mysql
host = localhost
username = icingaweb
password = icingaweb
dbname = icingaweb
[icingaweb-pgsql-socket]
type = db
db = pgsql
host = /var/run/postgresql
port = 5432
username = icingaweb
password = icingaweb
dbname = icingaweb
2016-07-08 16:39:24 +02:00
````
2014-11-18 16:21:48 +01:00
### <a id="resources-configuration-ldap"></a> LDAP
A LDAP resource represents a tree in a LDAP directory. LDAP is usually used for authentication and authorization.
Directive | Description
2016-07-08 16:39:24 +02:00
:---------------|:------------
2014-11-18 16:21:48 +01:00
**type** | `ldap`
**hostname** | Connect to the LDAP server on the given host.
**port** | Port number to use for the connection.
2016-07-08 16:39:24 +02:00
**root_dn** | Root object of the tree, e.g. `ou=people,dc=icinga,dc=org`
2014-11-18 16:21:48 +01:00
**bind_dn** | The user to use when connecting to the server.
**bind_pw** | The password to use when connecting to the server.
2016-06-29 15:29:35 +02:00
**encryption** | Type of encryption to use: `none` (default), `starttls` , `ldaps` .
2014-11-18 16:21:48 +01:00
2016-07-08 16:39:24 +02:00
#### <a id="resources-configuration-ldap-example"></a> Example
2014-11-18 16:21:48 +01:00
````
[ad]
2016-07-08 16:39:24 +02:00
type = ldap
hostname = localhost
port = 389
root_dn = "ou=people,dc=icinga,dc=org"
bind_dn = "cn=admin,ou=people,dc=icinga,dc=org"
bind_pw = admin
2014-11-18 16:21:48 +01:00
````
2015-05-28 10:42:18 +02:00
### <a id="resources-configuration-ssh"></a> SSH
A SSH resource contains the information about the user and the private key location, which can be used for the key-based
ssh authentication.
Directive | Description
2016-07-08 16:39:24 +02:00
:--------------------|:------------
2015-05-28 10:42:18 +02:00
**type** | `ssh`
**user** | The username to use when connecting to the server.
2015-06-15 17:23:52 +02:00
**private_key** | The path to the private key of the user.
2015-05-28 10:42:18 +02:00
2016-07-08 16:39:24 +02:00
#### <a id="resources-configuration-ssh-example"></a> Example
2015-05-28 10:42:18 +02:00
````
2016-07-08 16:39:24 +02:00
2015-05-28 10:42:18 +02:00
[ssh]
2016-07-08 16:39:24 +02:00
type = "ssh"
user = "ssh-user"
private_key = "/etc/icingaweb2/ssh/ssh-user"
2015-05-28 10:42:18 +02:00
````
2014-11-18 16:21:48 +01:00
### <a id="resources-configuration-livestatus"></a> Livestatus
A Livestatus resource represents the location of a Livestatus socket which is used for fetching monitoring data.
Directive | Description
2016-07-08 16:39:24 +02:00
:---------------|:------------
2014-11-18 16:21:48 +01:00
**type** | `livestatus`
2016-07-08 16:39:24 +02:00
**socket** | location of the livestatus socket (either a path to a local livestatus socket or a path to a remote livestatus socket in the format `tcp://<host>:<port>` )
2014-11-18 16:21:48 +01:00
2016-07-08 16:39:24 +02:00
#### <a id="resources-configuration-livestatus-example"></a>Example
2014-11-18 16:21:48 +01:00
````
2016-07-08 16:39:24 +02:00
2014-11-18 16:21:48 +01:00
[livestatus]
type = livestatus
socket = /var/run/icinga2/cmd/livestatus
2016-07-08 16:39:24 +02:00
2014-11-18 16:21:48 +01:00
````