77 lines
3.1 KiB
Markdown
77 lines
3.1 KiB
Markdown
# Grafana-Zabbix
|
|
## Zabbix API datasource for Grafana dashboard
|
|
|
|
Read more in Grafana-Zabbix [wiki](https://github.com/alexanderzobnin/grafana-zabbix/wiki).
|
|
|
|
Display your Zabbix data directly in [Grafana](http://grafana.org) dashboards!
|
|
|
|

|
|
|
|
Useful metric editor with host group and application filtering:
|
|
|
|

|
|
|
|
|
|
## Installation
|
|
|
|
### Grafana 1.9.x
|
|
See [grafana-1.9](../../tree/grafana-1.9) branch or Grafana-Zabbix [wiki](https://github.com/alexanderzobnin/grafana-zabbix/wiki).
|
|
|
|
### Grafana 2.0.x
|
|
Download source code from master branch and put `zabbix` directory into `<your grafana-2 installation>/public/app/plugins/datasource/`.
|
|
* Edit plugin.json (located in `zabbix` directory) and set your `username` and `password`
|
|
|
|
```
|
|
{
|
|
"pluginType": "datasource",
|
|
"name": "Zabbix",
|
|
|
|
"type": "zabbix",
|
|
"serviceName": "ZabbixAPIDatasource",
|
|
|
|
"module": "plugins/datasource/zabbix/datasource",
|
|
|
|
"partials": {
|
|
"config": "app/plugins/datasource/zabbix/partials/config.html",
|
|
"query": "app/plugins/datasource/zabbix/partials/query.editor.html",
|
|
"annotations": "app/plugins/datasource/zabbix/partials/annotations.editor.html"
|
|
},
|
|
|
|
"username": "guest",
|
|
"password": "",
|
|
|
|
"metrics": true,
|
|
"annotations": true
|
|
}
|
|
|
|
```
|
|
* Restart grafana server.
|
|
* Add zabbix datasource in Grafana's "Data Sources" menu (see [Data Sources docs](http://docs.grafana.org/datasources/graphite/) for more info) and setup your Zabbix API url.
|
|
* **Important!** Change `Access` to `direct`!
|
|
|
|

|
|
|
|
#### Note for Zabbix 2.2 or less
|
|
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).
|
|
To fix it add this code to api_jsonrpc.php immediately after the copyright
|
|
```
|
|
header('Access-Control-Allow-Origin: *');
|
|
header('Access-Control-Allow-Headers: Content-Type');
|
|
header('Access-Control-Allow-Methods: POST');
|
|
header('Access-Control-Max-Age: 1000');
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
|
|
return;
|
|
}
|
|
```
|
|
before
|
|
```
|
|
require_once dirname(__FILE__).'/include/func.inc.php';
|
|
require_once dirname(__FILE__).'/include/classes/core/CHttpRequest.php';
|
|
```
|
|
[Full fix listing](https://gist.github.com/alexanderzobnin/f2348f318d7a93466a0c).
|
|
For more info see zabbix issues [ZBXNEXT-1377](https://support.zabbix.com/browse/ZBXNEXT-1377) and [ZBX-8459](https://support.zabbix.com/browse/ZBX-8459).
|
|
|
|
## Troubleshooting
|
|
See [Grafana troubleshooting](http://docs.grafana.org/installation/troubleshooting/) for general connection issues. If you have a problem with Zabbix datasource, you should open a [support issue](https://github.com/alexanderzobnin/grafana-zabbix/issues). Before you do that please search the existing closed or open issues.
|