docs: Direct DB Connection configuration
This commit is contained in:
@@ -18,6 +18,7 @@ pages:
|
|||||||
- Installation:
|
- Installation:
|
||||||
- 'Installation': 'installation/index.md'
|
- 'Installation': 'installation/index.md'
|
||||||
- 'Configuration': 'installation/configuration.md'
|
- 'Configuration': 'installation/configuration.md'
|
||||||
|
- 'SQL Data Source Configuration': 'installation/configuration-sql.md'
|
||||||
- 'Upgrade': 'installation/upgrade.md'
|
- 'Upgrade': 'installation/upgrade.md'
|
||||||
- 'Troubleshooting': 'installation/troubleshooting.md'
|
- 'Troubleshooting': 'installation/troubleshooting.md'
|
||||||
- User Guides:
|
- User Guides:
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:6b58742637f58519a5fab038db0c15b5525d1d330fe5e4a1de954b72f4f1cc3e
|
oid sha256:367b5fa51e9d05eb87afedd4ef6ed8ea1ce0e095f94bfdc58ebe6744fbaca71c
|
||||||
size 225446
|
size 131343
|
||||||
|
|||||||
3
docs/sources/img/installation-mysql_ds_config.png
Normal file
3
docs/sources/img/installation-mysql_ds_config.png
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:0bac25f3d28c74f1f309476120bc67275e15f420e3343f0ff9668ead3a1e6170
|
||||||
|
size 227988
|
||||||
22
docs/sources/installation/configuration-sql.md
Normal file
22
docs/sources/installation/configuration-sql.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# SQL Data Source Configuration
|
||||||
|
|
||||||
|
In order to use _Direct DB Connection_ feature you should configure SQL data source first.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Select _MySQL_ data source type and provide your database host address and port (3306 is default for MySQL). Fill
|
||||||
|
database name (usually, `zabbix`) and specify credentials.
|
||||||
|
|
||||||
|
## Security notes
|
||||||
|
|
||||||
|
As you can see in _User Permission_ note, Grafana doesn't restrict any queries to the database. So you should be careful
|
||||||
|
and create a special user with limited access to Zabbix database. Grafana-Zabbix plugin uses only `SELECT` queries to
|
||||||
|
`history`, `history_uint`, `trends` and `trends_uint` tables. So it's reasonable to grant only SELECT privileges to
|
||||||
|
these tables for grafana user. But if you want to use this MySQL data source for querying another data, you can
|
||||||
|
grant SELECT privileges to entire zabbix database.
|
||||||
|
|
||||||
|
Also, all queries are invoked by grafana-server, so you can restrict connection to only grafana host.
|
||||||
|
|
||||||
|
```sql
|
||||||
|
GRANT SELECT ON zabbix.* TO 'grafana'@'grafana-host' identified by 'password';
|
||||||
|
```
|
||||||
@@ -52,7 +52,23 @@ Direct access is still supported because in some cases it may be useful to acces
|
|||||||
- **Cache TTL**: plugin caches some api requests for increasing performance. Set this
|
- **Cache TTL**: plugin caches some api requests for increasing performance. Set this
|
||||||
value to desired cache lifetime (this option affect data like items list).
|
value to desired cache lifetime (this option affect data like items list).
|
||||||
|
|
||||||
|
### Direct DB Connection
|
||||||
|
|
||||||
|
Direct DB Connection allows plugin to use existing SQL data source for querying history data directly from Zabbix
|
||||||
|
database. This way usually faster than pulling data from Zabbix API, especially on the wide time ranges, and reduces
|
||||||
|
amount of data transfered.
|
||||||
|
|
||||||
|
Read [how to configure](/installation/configuration-sql) SQL data source in Grafana.
|
||||||
|
|
||||||
|
- **Enable**: enable Direct DB Connection.
|
||||||
|
- **SQL Data Source**: Select SQL Data Source for Zabbix database.
|
||||||
|
|
||||||
|
#### Supported databases
|
||||||
|
|
||||||
|
Now only **MySQL** is supported by Grafana.
|
||||||
|
|
||||||
### Alerting
|
### Alerting
|
||||||
|
|
||||||
- **Enable alerting**: enable limited alerting support.
|
- **Enable alerting**: enable limited alerting support.
|
||||||
- **Add thresholds**: get thresholds info from zabbix triggers and add it to graphs.
|
- **Add thresholds**: get thresholds info from zabbix triggers and add it to graphs.
|
||||||
For example, if you have trigger `{Zabbix server:system.cpu.util[,iowait].avg(5m)}>20`, threshold will be set to 20.
|
For example, if you have trigger `{Zabbix server:system.cpu.util[,iowait].avg(5m)}>20`, threshold will be set to 20.
|
||||||
@@ -65,10 +81,12 @@ or password, wrong api url.
|
|||||||

|

|
||||||
|
|
||||||
## Import example dashboards
|
## Import example dashboards
|
||||||
|
|
||||||
You can import dashboard examples from _Dashboards_ tab in plugin config.
|
You can import dashboard examples from _Dashboards_ tab in plugin config.
|
||||||

|

|
||||||
|
|
||||||
## Note about Zabbix 2.2 or less
|
## Note about Zabbix 2.2 or less
|
||||||
|
|
||||||
Zabbix API (api_jsonrpc.php) before zabbix 2.4 don't allow cross-domain requests (CORS). And you
|
Zabbix API (api_jsonrpc.php) before zabbix 2.4 don't allow cross-domain requests (CORS). And you
|
||||||
can get HTTP error 412 (Precondition Failed).
|
can get HTTP error 412 (Precondition Failed).
|
||||||
To fix it add this code to api_jsonrpc.php immediately after the copyright:
|
To fix it add this code to api_jsonrpc.php immediately after the copyright:
|
||||||
@@ -83,17 +101,20 @@ if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
before
|
before
|
||||||
|
|
||||||
```php
|
```php
|
||||||
require_once dirname(__FILE__).'/include/func.inc.php';
|
require_once dirname(__FILE__).'/include/func.inc.php';
|
||||||
require_once dirname(__FILE__).'/include/classes/core/CHttpRequest.php';
|
require_once dirname(__FILE__).'/include/classes/core/CHttpRequest.php';
|
||||||
```
|
```
|
||||||
|
|
||||||
[Full fix listing](https://gist.github.com/alexanderzobnin/f2348f318d7a93466a0c).
|
[Full fix listing](https://gist.github.com/alexanderzobnin/f2348f318d7a93466a0c).
|
||||||
For more details see zabbix issues [ZBXNEXT-1377](https://support.zabbix.com/browse/ZBXNEXT-1377)
|
For more details see zabbix issues [ZBXNEXT-1377](https://support.zabbix.com/browse/ZBXNEXT-1377)
|
||||||
and [ZBX-8459](https://support.zabbix.com/browse/ZBX-8459).
|
and [ZBX-8459](https://support.zabbix.com/browse/ZBX-8459).
|
||||||
|
|
||||||
## Note about Browser Cache
|
## Note about Browser Cache
|
||||||
|
|
||||||
After updating plugin, clear browser cache and reload application page. See details
|
After updating plugin, clear browser cache and reload application page. See details
|
||||||
for [Chrome](https://support.google.com/chrome/answer/95582),
|
for [Chrome](https://support.google.com/chrome/answer/95582),
|
||||||
[Firefox](https://support.mozilla.org/en-US/kb/how-clear-firefox-cache). You need to clear cache
|
[Firefox](https://support.mozilla.org/en-US/kb/how-clear-firefox-cache). You need to clear cache
|
||||||
|
|||||||
Reference in New Issue
Block a user