Merge branch 'hotfix-25' into develop

This commit is contained in:
alexanderzobnin
2015-06-18 16:33:07 +03:00
3 changed files with 50 additions and 34 deletions

View File

@@ -1,46 +1,24 @@
# grafana-zabbix # Grafana-Zabbix
Zabbix API datasource for Grafana dashboard ## Zabbix API datasource for Grafana dashboard
![alt tag](https://cloud.githubusercontent.com/assets/4932851/7454206/34bf9f8c-f27a-11e4-8e96-a73829f188c4.png) Read more in Grafana-Zabbix [wiki](https://github.com/alexanderzobnin/grafana-zabbix/wiki).
Display your Zabbix data directly in [Grafana](http://grafana.org) dashboards!
Query editor allows to add metric by step-by-step selection from host group, host, application dropdown menus. ![2015-05-31 17-51-00 grafana - zabbix datasource - google chrome](https://cloud.githubusercontent.com/assets/4932851/7902354/fdf66368-07bf-11e5-991d-1e9892b2d0b0.png)
![alt tag](https://cloud.githubusercontent.com/assets/4932851/7441162/4f6af788-f0e4-11e4-887b-34d987d00c40.png) Useful metric editor with host group and application filtering:
![alt tag](https://cloud.githubusercontent.com/assets/4932851/7441163/56f28f16-f0e4-11e4-9d46-54181c2a2e7e.png)
![alt tag](https://cloud.githubusercontent.com/assets/4932851/7441167/5f29cc94-f0e4-11e4-8d39-7580f33201f6.png) ![2015-05-31 17-53-23](https://cloud.githubusercontent.com/assets/4932851/7902360/156a9366-07c0-11e5-905b-4c21b52f1f44.png)
## Installation ## Installation
### Grafana 1.9.x ### Grafana 1.9.x
See [grafana-1.9](../../tree/grafana-1.9) branch or Grafana-Zabbix [wiki](https://github.com/alexanderzobnin/grafana-zabbix/wiki).
Download latest release and unpack into `<your grafana installation>/plugins/datasource/`. Then edit Grafana config.js:
* Add dependencies
```
plugins: {
panels: [],
dependencies: ['datasource/zabbix/datasource', 'datasource/zabbix/queryCtrl'],
}
```
* Add datasource and setup your Zabbix API url, username and password
```
datasources: {
...
},
zabbix: {
type: 'ZabbixAPIDatasource',
url: 'http://www.zabbix.org/zabbix/api_jsonrpc.php',
username: 'guest',
password: ''
}
},
```
### Grafana 2.0.x ### Grafana 2.0.x
Download source code and put `zabbix` directory into `<your grafana-2 installation>/public/app/plugins/datasource/`. 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` * Edit plugin.json (located in `zabbix` directory) and set your `username` and `password`
``` ```
@@ -70,3 +48,31 @@ Download source code and put `zabbix` directory into `<your grafana-2 installati
* Restart grafana server. * 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. * 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`! * **Important!** Change `Access` to `direct`!
![2015-05-18 12-46-03 grafana - zabbix org - mozilla firefox](https://cloud.githubusercontent.com/assets/4932851/7678429/b42a9cda-fd5c-11e4-84a3-07aa765769d3.png)
#### 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).
#### Note about browser cache
After updating plugin, clear browser cache and reload application page. See details 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 only, not cookies, history and other data.
## 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.

9
Roadmap.md Normal file
View File

@@ -0,0 +1,9 @@
Development roadmap
===
Features
---
- [ ] Annotations
- [ ] Zabbix trends support
- [ ] Templated dashboards support
- [ ] IT services support

View File

@@ -287,7 +287,8 @@ function (angular, _, kbn) {
// Handle auth errors // Handle auth errors
if (response.data.error.data == "Session terminated, re-login, please." || if (response.data.error.data == "Session terminated, re-login, please." ||
response.data.error.data == 'Not authorised.') { response.data.error.data == "Not authorised." ||
response.data.error.data == "Not authorized") {
return self.performZabbixAPILogin().then(function (response) { return self.performZabbixAPILogin().then(function (response) {
self.auth = response; self.auth = response;
return self.performZabbixAPIRequest(method, params); return self.performZabbixAPIRequest(method, params);