Updated installation docs for version 3.0

This commit is contained in:
Alexander Zobnin
2016-03-31 22:36:03 +03:00
parent 2de0756d45
commit 3a015c8d4d
3 changed files with 114 additions and 91 deletions

View File

@@ -13,7 +13,8 @@ pages:
- 'About Grafana-Zabbix': 'index.md' - 'About Grafana-Zabbix': 'index.md'
- 'Feature Highlights': 'features.md' - 'Feature Highlights': 'features.md'
- Installation: - Installation:
- 'Installation and Configuration': 'installation/index.md' - 'Installation': 'installation/index.md'
- 'Configuration': 'installation/configuration.md'
- 'Troubleshooting': 'installation/troubleshooting.md' - 'Troubleshooting': 'installation/troubleshooting.md'
- User Guides: - User Guides:
- 'Getting Started': 'guides/gettingstarted.md' - 'Getting Started': 'guides/gettingstarted.md'

View File

@@ -0,0 +1,75 @@
# Configuration
To add new Zabbix data source open _Data Sources_ in side panel, click _Add new_ and select Zabbix
from dropdown list.
![Add zabbix data source](../img/installation-add_datasource.png)
Then configure a data source
![Configure zabbix data source](../img/installation-datasource_config.png)
### Http settings
- **Url**: set Zabbix API url (full path with `api_jsonrpc.php`).
- **Access**: can be either _proxy_ or _direct_.
- **Http Auth**: configure if you use proxy authentication.
- **Basic Auth**:
- **With Credentials**:
### Zabbiz API details
- **User** and **Password**: setup login for access to Zabbix API. Also check user's permissions
in Zabbix if you can't get any groups and hosts in Grafana.
- **Trends**: enable if you use patch for trends
support in Zabbix 2.x ([ZBXNEXT-1193](https://support.zabbix.com/browse/ZBXNEXT-1193)). This is
strictly recommended for displaying long time periods (more than few days, depending of your item's
updating interval in Zabbix) because few days of item history contains tons of points. Using trends
can increase Grafana performance.
- **Use trends from**: time after which trends will be used. Default is **7d** (7 days).
You can set the time in Grafana format. Valid time specificators are:
- **h** - hours
- **d** - days
- **M** - months
- **Metrics limit**: maximum items number which can be returned by one request. Helps to prevent
Grafana slowdown due wrong request.
Then click _Add_ - datasource will be added and you can check connection using _Test Connection_ button.
![Test Connection](../img/installation-test_connection.png)
This feature can help to find some mistakes like invalid user name or password, wrong api url.
![Test Connection - Error](../img/installation-test_connection_error.png)
## 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
can get HTTP error 412 (Precondition Failed).
To fix it add this code to api_jsonrpc.php immediately after the copyright:
```php
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
```php
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 details 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.

View File

@@ -2,117 +2,64 @@ page_title: Grafana-Zabbix Installation
page_description: Installation instructions for Grafana-Zabbix. page_description: Installation instructions for Grafana-Zabbix.
# Installation # Installation
## From release package
Download [latest release](https://github.com/alexanderzobnin/grafana-zabbix/releases/latest) Download [latest release](https://github.com/alexanderzobnin/grafana-zabbix/releases/latest)
for relative Grafana version or just clone a repo: for relative Grafana version or just clone a repo:
``` ```
git clone https://github.com/alexanderzobnin/grafana-zabbix.git git clone https://github.com/alexanderzobnin/grafana-zabbix.git
``` ```
## Copy into plugins directory
Copy content of `plugins` into your grafana plugins directory (default `/var/lib/grafana/plugins` Copy content of `plugins` into your grafana plugins directory (default `/var/lib/grafana/plugins`
if your installing grafana with package). if your installing grafana with package).
Restart grafana-server and the plugin should be automatically detected and used. Restart grafana-server and the plugin should be automatically detected and used.
## Building from sources
You need NodeJS, npm and Grunt for building plugin from sources. Read more about required versions
in [Grafana docs](http://docs.grafana.org/project/building_from_source/).
```sh ```sh
git clone https://github.com/alexanderzobnin/grafana-zabbix.git git clone https://github.com/alexanderzobnin/grafana-zabbix.git
cp -r ./grafana-zabbix/plugins/* /your/grafana/plugins/directory/ cd grafana-zabbix
sudo service grafana-server restart npm install
npm install -g grunt-cli
grunt
``` ```
Plugin will built into *dist/* directory. Then you can copy it into your grafana plugins directory
## Use directory of your choice or set path to compiled plugin in grafana config:
By this way you can update plugin by simple `git pull` command.
Edit your grafana.ini config file (Default location is at `/etc/grafana/grafana.ini`)
and add paths to plugins:
```ini ```ini
[plugin.zabbix] [plugin.zabbix]
path = /home/your/clone/dir/plugins/datasource-zabbix path = /home/your/clone/dir/grafana-zabbix/dist
[plugin.triggers]
path = /home/your/clone/dir/plugins/panel-triggers
``` ```
Note that if you copy it into the grafana plugins directory you do not need to add the above If you need to upgrade plugin use
config option. That is only
if you want to place the plugin in a directory outside the standard plugins directory.
Be aware that grafana-server
needs read access to the directory.
# Configuration ```sh
git pull
To add new Zabbix data source open _Data Sources_ in side panel, click _Add new_ and select Zabbix grunt
from dropdown list.
![Add zabbix data source](../img/installation-add_datasource.png)
Then configure a data source
![Configure zabbix data source](../img/installation-datasource_config.png)
### Http settings
- **Url**: set Zabbix API url (full path with `api_jsonrpc.php`).
- **Access**: can be either _proxy_ or _direct_.
- **Http Auth**: configure if you use proxy authentication.
- **Basic Auth**:
- **With Credentials**:
### Zabbiz API details
- **User** and **Password**: setup login for access to Zabbix API. Also check user's permissions
in Zabbix if you can't get any groups and hosts in Grafana.
- **Trends**: enable if you use patch for trends
support in Zabbix 2.x ([ZBXNEXT-1193](https://support.zabbix.com/browse/ZBXNEXT-1193)). This is
strictly recommended for displaying long time periods (more than few days, depending of your item's
updating interval in Zabbix) because few days of item history contains tons of points. Using trends
can increase Grafana performance.
- **Use trends from**: time after which trends will be used. Default is **7d** (7 days).
You can set the time in Grafana format. Valid time specificators are:
- **h** - hours
- **d** - days
- **M** - months
- **Metrics limit**: maximum items number which can be returned by one request. Helps to prevent
Grafana slowdown due wrong request.
Then click _Add_ - datasource will be added and you can check connection using _Test Connection_ button.
![Test Connection](../img/installation-test_connection.png)
This feature can help to find some mistakes like invalid user name or password, wrong api url.
![Test Connection - Error](../img/installation-test_connection_error.png)
## 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
can get HTTP error 412 (Precondition Failed).
To fix it add this code to api_jsonrpc.php immediately after the copyright:
```php
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
```php Restart Grafana server
require_once dirname(__FILE__).'/include/func.inc.php';
require_once dirname(__FILE__).'/include/classes/core/CHttpRequest.php'; ```sh
sudo service grafana-server restart
systemctl restart grafana-server
``` ```
[Full fix listing](https://gist.github.com/alexanderzobnin/f2348f318d7a93466a0c).
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).
## Note about Browser Cache ## Using grafana-cli tool
After updating plugin, clear browser cache and reload application page. See details
for [Chrome](https://support.google.com/chrome/answer/95582), Get list of available plugins
[Firefox](https://support.mozilla.org/en-US/kb/how-clear-firefox-cache). You need to clear cache
only, not cookies, history and other data. ```sh
grafana-cli plugins list-remote
```
Install zabbix plugin
```sh
grafana-cli plugins install zabbix-app
```
Read more in [Grafana docs](http://docs.grafana.org/plugins/installation/)