Rename docs folder to prevent broken build
@@ -1,33 +0,0 @@
|
||||
# Direct DB Data Source Configuration
|
||||
|
||||
## Security notes
|
||||
|
||||
Grafana-Zabbix plugin can use MySQL, Postgres or InfluxDB (if Zabbix configured to store history data in InfluxDB) data sources to query history and trend data directly from Zabbix database. In order to execute queries, plugin needs only read access to the `history`, `history_uint`, `trends` and `trends_uint` tables. To make connection more secure and prevent unnecessary data disclosure, it's highly recommended to grant read access to only that tables. But if you want to use this 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. Here's MySQL example:
|
||||
|
||||
```sql
|
||||
GRANT SELECT ON zabbix.* TO 'grafana'@'grafana-host' identified by 'password';
|
||||
```
|
||||
|
||||
## MySQL
|
||||
|
||||
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.
|
||||
|
||||
## PostgreSQL
|
||||
|
||||
Select _PostgreSQL_ data source type and provide your database host address and port (5432 is default). Fill
|
||||
database name (usually, `zabbix`) and specify credentials.
|
||||
|
||||

|
||||
|
||||
## InfluxDB
|
||||
|
||||
Select _InfluxDB_ data source type and provide your InfluxDB instance host address and port (8086 is default). Fill
|
||||
database name you configured in the [effluence](https://github.com/i-ky/effluence) module config (usually, `zabbix`) and specify credentials.
|
||||
|
||||

|
||||
@@ -1,85 +0,0 @@
|
||||
page_title: Grafana-Zabbix Configuration
|
||||
page_description: Plugin configuration instructions for Grafana-Zabbix.
|
||||
|
||||
# Configuration
|
||||
|
||||
## Enable plugin
|
||||
|
||||
Go to the plugins in Grafana side panel, select _Apps_ tab, then select _Zabbix_, open _Config_
|
||||
tab and enable plugin.
|
||||
|
||||

|
||||
|
||||
## Configure Zabbix data source
|
||||
|
||||
After enabling plugin you can add Zabbix data source.
|
||||
|
||||
To add new Zabbix data source open _Data Sources_ in side panel, click _Add data source_ and select _Zabbix_ from dropdown list.
|
||||
|
||||

|
||||
|
||||
### HTTP settings
|
||||
|
||||
- **URL**: set Zabbix API url (full path with `api_jsonrpc.php`).
|
||||
- **Access**: Set to `Server (default)`.
|
||||
- **Http Auth**: configure if you use proxy authentication.
|
||||
- **Basic Auth**:
|
||||
- **With Credentials**:
|
||||
|
||||
### Zabbix API details
|
||||
|
||||
- **Username** and **Password**: setup login for access to Zabbix API. Also check user's permissions
|
||||
in Zabbix if you cannot get any groups and hosts in Grafana.
|
||||
- **Trends**: enable if you use Zabbix 3.x or newer. This option 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
|
||||
will increase Grafana performance.
|
||||
- **After**: time after which trends will be used.
|
||||
Best practice is to set this value to your history storage period (7d, 30d, etc). Default is **7d** (7 days).
|
||||
You can set the time in Grafana format. Valid time specifiers are:
|
||||
- **h** - hours
|
||||
- **d** - days
|
||||
- **M** - months
|
||||
- **Range**: Time range width after which trends will be used instead of history.
|
||||
It's better to set this value in range of 4 to 7 days to prevent loading large amount of history data.
|
||||
Default is 4 days.
|
||||
- **Cache TTL**: plugin caches some api requests for increasing performance. Set this
|
||||
value to desired cache lifetime (this option affect data like items list).
|
||||
- **Timeout**: Zabbix connection timeout in seconds. Default is 30.
|
||||
|
||||
### 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 transferred.
|
||||
|
||||
Read [how to configure](./direct_db_datasource) SQL data source in Grafana.
|
||||
|
||||
- **Enable**: enable Direct DB Connection.
|
||||
- **Data Source**: Select Data Source for Zabbix history database.
|
||||
- **Retention Policy** (InfluxDB only): Specify retention policy name for fetching long-term stored data. Grafana will fetch data from this retention policy if query time range suitable for trends query. Leave it blank if only default retention policy used.
|
||||
|
||||
#### Supported databases
|
||||
|
||||
**MySQL**, **PostgreSQL**, **InfluxDB** are supported as sources of historical data for the plugin.
|
||||
|
||||
### Other
|
||||
|
||||
- **Disable acknowledges for read-only users**: disable ability to acknowledge problems from Grafana for non-editors.
|
||||
|
||||
- **Disable data alignment**: disable time series data alignment. This feature aligns points based on item update interval. For instance, if value collected once per minute, then timestamp of the each point will be set to the start of corresponding minute. This alignment required for proper work of the stacked graphs. If you don't need stacked graphs and want to get exactly the same timestamps as in Zabbix, then you can disable this feature. Also, data alignment can be toggled for each query individually, in the query options.
|
||||
|
||||
Then click _Add_ - data source will be added and you can check connection using _Test Connection_ button. This feature can help to find some mistakes like invalid user name or password, wrong api url.
|
||||
|
||||
## Import example dashboards
|
||||
|
||||
You can import dashboard examples from _Dashboards_ tab in the data source config.
|
||||
|
||||

|
||||
|
||||
## 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.
|
||||
@@ -1,55 +0,0 @@
|
||||
page_title: Provisioning Grafana-Zabbix plugin
|
||||
page_description: Grafana-Zabbix plugin provisioning instructions.
|
||||
|
||||
# Provisioning Grafana-Zabbix plugin
|
||||
|
||||
It’s now possible to configure datasources using config files with Grafana’s provisioning system. You can read more about how it works and all the settings you can set for datasources on the [provisioning docs page](http://docs.grafana.org/administration/provisioning/#datasources)
|
||||
|
||||
### Example Datasource Config File
|
||||
|
||||
```yaml
|
||||
apiVersion: 1
|
||||
|
||||
datasources:
|
||||
- name: Zabbix
|
||||
type: alexanderzobnin-zabbix-datasource
|
||||
access: proxy
|
||||
url: http://localhost/zabbix/api_jsonrpc.php
|
||||
isDefault: true
|
||||
jsonData:
|
||||
# Zabbix API credentials
|
||||
username: zabbix
|
||||
password: zabbix
|
||||
# Trends options
|
||||
trends: true
|
||||
trendsFrom: "7d"
|
||||
trendsRange: "4d"
|
||||
# Cache update interval
|
||||
cacheTTL: "1h"
|
||||
# Alerting options
|
||||
alerting: true
|
||||
addThresholds: false
|
||||
alertingMinSeverity: 3
|
||||
# Direct DB Connection options
|
||||
dbConnectionEnable: true
|
||||
# Name of existing datasource for Direct DB Connection
|
||||
dbConnectionDatasourceName: MySQL Zabbix
|
||||
# Retention policy name (InfluxDB only) for fetching long-term stored data.
|
||||
# Leave it blank if only default retention policy used.
|
||||
dbConnectionRetentionPolicy: one_year
|
||||
# Disable acknowledges for read-only users
|
||||
disableReadOnlyUsersAck: true
|
||||
# Disable time series data alignment
|
||||
disableDataAlignment: false
|
||||
# Use value mapping from Zabbix
|
||||
useZabbixValueMapping: true
|
||||
version: 1
|
||||
editable: false
|
||||
|
||||
- name: MySQL Zabbix
|
||||
type: mysql
|
||||
url: localhost:3306
|
||||
database: zabbix
|
||||
user: grafana
|
||||
password: password
|
||||
```
|
||||
@@ -1,5 +0,0 @@
|
||||
# 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.
|
||||
@@ -1,115 +0,0 @@
|
||||
@import url('https://fonts.googleapis.com/css?family=Roboto|Source+Code+Pro');
|
||||
|
||||
.wy-side-nav-search, .wy-nav-top {
|
||||
background-color: #8e3030;
|
||||
}
|
||||
|
||||
.wy-side-nav-search input[type=text] {
|
||||
border-radius: 2px;
|
||||
width: 100%;
|
||||
border-color: #e3e3e3;
|
||||
}
|
||||
|
||||
/* Content container */
|
||||
.wy-nav-content {
|
||||
max-width: 1200px;
|
||||
}
|
||||
|
||||
.rst-content .section {
|
||||
color: #404040;
|
||||
font-family: 'Roboto', 'Lato', 'proxima-nova', 'Helvetica Neue', Arial, sans-serif;
|
||||
}
|
||||
|
||||
.rst-content p {
|
||||
margin-bottom: 16px;
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
.rst-content li {
|
||||
margin-top: 6px;
|
||||
margin-bottom: 6px;
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
.rst-content img {
|
||||
max-width: 80%;
|
||||
max-height: 800px;
|
||||
}
|
||||
|
||||
.rst-content blockquote {
|
||||
max-width: 80%;
|
||||
margin-left: 0em;
|
||||
padding: 0 1em;
|
||||
color: #757575;
|
||||
border-left: 6px solid #e0e0e0;
|
||||
}
|
||||
|
||||
/* Source code highlighting */
|
||||
|
||||
code, .rst-content tt {
|
||||
font-family: 'Source Code Pro', monospace;
|
||||
font-size: 90%;
|
||||
color: #404040;
|
||||
background-color: #f4f4f4;
|
||||
padding: 1px 5px;
|
||||
border-radius: 2px;
|
||||
border-width: 0;
|
||||
}
|
||||
|
||||
.hljs {
|
||||
max-width: 100%;
|
||||
|
||||
/* Colors are from solarized scheme. */
|
||||
background-color: #fdf6e3;
|
||||
color: #657b83;
|
||||
|
||||
border-width: 0 0 0 4px;
|
||||
border-color: #eee8d5;
|
||||
border-left-color: #268bd2;
|
||||
|
||||
font-size: 90%;
|
||||
line-height: 1.5;
|
||||
padding: 0.5em 1em;
|
||||
}
|
||||
|
||||
.hljs-keyword {
|
||||
color: #dc322f;
|
||||
}
|
||||
|
||||
.hljs-built_in {
|
||||
color: #268bd2;
|
||||
}
|
||||
|
||||
.hljs-string {
|
||||
color: #859900;
|
||||
}
|
||||
|
||||
.hljs-variable {
|
||||
color: #6c71c4;
|
||||
}
|
||||
|
||||
.btn-neutral:hover {
|
||||
background-color: #8e3030 !important;
|
||||
color: #f4f4f4 !important;
|
||||
box-shadow:
|
||||
0px 1px 2px -1px rgba(255,255,255,0.5) inset,
|
||||
0px -2px 0px 0px rgba(0, 0, 0, 0.2) inset;
|
||||
}
|
||||
|
||||
/* Functions list tweaks */
|
||||
|
||||
h3 em {
|
||||
font-family: 'Source Code Pro', monospace;
|
||||
line-height: 2;
|
||||
padding-top: 20px;
|
||||
font-style: normal;
|
||||
padding-bottom: 2px;
|
||||
border-bottom: 2px;
|
||||
border-bottom-style: solid;
|
||||
border-bottom-color: #2aa198;
|
||||
color: #01579b;
|
||||
}
|
||||
|
||||
hr {
|
||||
margin: 24px 0 48px 0;
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
page_title: Feature Highlights
|
||||
page_description: Grafana-Zabbix Feature Highlights.
|
||||
|
||||
# Feature Highlights
|
||||
|
||||
Grafana in couple with Grafana-Zabbix plugin allows to create great dashboards. There is some
|
||||
features:
|
||||
|
||||
- Rich graphing features
|
||||
- Select multiple metrics [by using Regex](../guides/gettingstarted/#multiple-items-on-one-graph)
|
||||
- Create interactive and reusable dashboards with [template variables](../guides/templating/)
|
||||
- Show events on graphs with [Annotations](http://docs.grafana.org/reference/annotations/)
|
||||
- Transform and shape your data with [metric processing functions](../reference/functions/) (Avg, Median, Min, Max, Multiply, Summarize, Time shift, Alias)
|
||||
- Mix metrics from multiple data sources in the same dashboard or panel
|
||||
- Create [alerts](../reference/alerting/) in Grafana
|
||||
- Display triggers with Problems panel
|
||||
- Discover and share [dashboards](https://grafana.com/dashboards) in the official library
|
||||
@@ -1,55 +0,0 @@
|
||||
# Getting Started with Grafana-Zabbix
|
||||
After you [installed and configured](../installation/index.md) Grafana-Zabbix data source let's
|
||||
create a simple dashboard.
|
||||
|
||||
## Simple Graph
|
||||
Add new Graph panel to dashboard.
|
||||
Select metrics from dropdown or start to type to filter results
|
||||
|
||||

|
||||
|
||||
Let's create _15 min avg processor load_ graph. Select Host Group, Host, Application (optional - you can leave it blank) and Item.
|
||||
|
||||

|
||||
|
||||
## Multiple Items On One Graph
|
||||
You can build graphs with lots of items using Regular Expressions inside metric field. Grafana uses JavaScript regex implementation. For example, if you need to show CPU time (user, system, iowait, etc) you may create graph using this regex in Item field:
|
||||
```js
|
||||
/CPU (?!idle).* time/
|
||||
```
|
||||
|
||||

|
||||
|
||||
Another case to use regex is comparing the same metrics for different hosts. Use `/.*/` regex for showing all metrics or write your own filter. For example, I want to show _CPU system time_ for all hosts which name started with _backend_ from all host groups. I use `/.*/` for Group, `/^backend/` for Host and `CPU system time` for Item.
|
||||
|
||||

|
||||
|
||||
## Bar Chart
|
||||
Let's create a graph which show queries stats for MySQL database. Select Group, Host, Application (_MySQL_ in my case) and Items. I use `/MySQL .* operations/` regex for filtering different types of operations.
|
||||
|
||||

|
||||
|
||||
To show graph as Bar Chart, go to the **Display** tab, uncheck **Lines** and set **Bars**. Also, enable **Stack** checkbox for showing stacked bars.
|
||||
|
||||

|
||||
|
||||
But this graph doesn't look good because it contains too many bars. We can fix it by using **Max data points** parameter. Go to the **Metrics** tab and set **Max data points** to 50 for example.
|
||||
|
||||

|
||||
|
||||
Ok, looks pretty!
|
||||
|
||||
## Singlestat and Gauges
|
||||
Sometimes you may need to show just a big single value for particular metric. Use Grafana's **Singlestat** panel in this case. Let's create panel which shows _CPU user time_ metric.
|
||||
|
||||

|
||||
|
||||
Suppose that you want to set units as percents and show **Gauge** for this value. Go to the **Options** tab and set units to _percent (0-100)_. Then enable _Show_ option for _Gauge_ and set Min and Max values for your metric (0-100 in our case). Set thresholds if you want to see it on Gauge (`50,80` for example).
|
||||
|
||||

|
||||
|
||||
Great, looks cool. Read more about Singlestat panel in [Grafana docs](http://docs.grafana.org/reference/singlestat/).
|
||||
|
||||
And all together:
|
||||
|
||||

|
||||
@@ -1,83 +0,0 @@
|
||||
# Templating Guide
|
||||
You can use template variables for creating highly reusable and interactive dashboards. General idea of templating is allow Grafana to get different metrics from data source and provide a way to change it on the fly without modifying dashboard. In case of Zabbix it means that you can get list of Host Groups, Hosts, Applications or Items and add it as a variables.
|
||||
|
||||
## Creating Variable
|
||||
To create template variable click the cog icon on the top navigation bar and choose _Templating_.
|
||||
|
||||

|
||||
|
||||
When you click _New_ button, you'll see template variable editor. It contains these sections:
|
||||
|
||||

|
||||
|
||||
### Variable
|
||||
|
||||
**Name**
|
||||
Name of the variable. You should use this name in queries.
|
||||
|
||||
**Label**
|
||||
Visible label for variable. Use when you want to display different name on dashboard. For instance, _Host Group_ instead *host_group*.
|
||||
|
||||
**Type**
|
||||
By default _Query_ type is selected. It means that Grafana asks data source for values of variable. But there are some other types: _Interval_ (just a time interval), _Data source_ (You can switch data source, for example, if you have more than one Zabbix instance and each added into Grafana as data source), _Custom_ (you can set any predefined values for variable) and _Constant_.
|
||||
|
||||
### Query Options
|
||||
|
||||
**Data source**
|
||||
Data source used for querying variable values.
|
||||
|
||||
**Refresh**
|
||||
When to update the values of this variable.
|
||||
|
||||
**Query**
|
||||
Query string.
|
||||
|
||||
**Regex**
|
||||
Use regex if you need to filter values or extract a part of value.
|
||||
|
||||
### Selection Options
|
||||
|
||||
**Multi-value**
|
||||
Enable, if you want to select multiple values at the same time.
|
||||
|
||||
### Value groups/tags (Experimental feature)
|
||||
|
||||
## Query Format
|
||||
Template variable query in Zabbix data source is a string which contains 4 parts wrapped in braces (`{}`). You still can
|
||||
use a period (`.`), but it's deprecated and will be removed in future.
|
||||
|
||||
```
|
||||
{host group}{host}{application}{item name}
|
||||
```
|
||||
|
||||
For example,
|
||||
```
|
||||
{Zabbix servers}{Zabbix server}{CPU}{*}
|
||||
{Frontend}{web01.mydomain.com}{*}{*}
|
||||
```
|
||||
|
||||
Each part can be a name of corresponding metric or `*`, which means _all metrics_.
|
||||
|
||||
Examples:
|
||||
|
||||
- `{*}` returns list of all available Host Groups
|
||||
- `{*}{*}` all hosts in Zabbix
|
||||
- `{Network}{*}` returns all hosts in group Network
|
||||
- `{Linux servers}{*}{*}` returns all applications from hosts in Linux servers group
|
||||
- `{Linux servers}{backend01}{CPU}{*}` returns all items from backend01 belonging to CPU application.
|
||||
|
||||
You can use another variable as a part of query. For instance, you have variable _group_, which returns list of
|
||||
host groups and want to use it for querying hosts in selected group only. Here's a query for this case:
|
||||
```
|
||||
{$group}{*}
|
||||
```
|
||||
|
||||
## Variables Usage
|
||||
|
||||
When you create a variable, you can use it as a part of data source query. Grafana also supports variables in different places like panel's and row's titles, Text panel's content, etc.
|
||||
|
||||

|
||||
|
||||
> Note, that you should add `$` sign before variable's name (**$host** for _host_ variable).
|
||||
|
||||
See more about templating in [Grafana docs](http://docs.grafana.org/reference/templating)
|
||||
0
docs/sources/img/.gitattributes
vendored
|
Before Width: | Height: | Size: 109 KiB |
|
Before Width: | Height: | Size: 596 KiB |
|
Before Width: | Height: | Size: 405 KiB |
|
Before Width: | Height: | Size: 480 KiB |
|
Before Width: | Height: | Size: 535 KiB |
|
Before Width: | Height: | Size: 443 KiB |
|
Before Width: | Height: | Size: 440 KiB |
|
Before Width: | Height: | Size: 705 KiB |
|
Before Width: | Height: | Size: 459 KiB |
|
Before Width: | Height: | Size: 377 KiB |
|
Before Width: | Height: | Size: 530 KiB |
|
Before Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 107 KiB |
|
Before Width: | Height: | Size: 82 KiB |
|
Before Width: | Height: | Size: 82 KiB |
|
Before Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 128 KiB |
|
Before Width: | Height: | Size: 95 KiB |
|
Before Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 195 KiB |
|
Before Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 501 KiB |
|
Before Width: | Height: | Size: 626 KiB |
@@ -1,38 +0,0 @@
|
||||
page_title: About Grafana-Zabbix
|
||||
page_description: Introduction to Grafana-Zabbix plugin.
|
||||
|
||||
# About Grafana-Zabbix plugin
|
||||
|
||||
Grafana-Zabbix is a plugin for Grafana allowing to visualize monitoring data from Zabbix
|
||||
and create dashboards for analyzing metrics and realtime monitoring. Main goals of this project
|
||||
are extend Zabbix capabilities for monitoring data visualization and provide quick and powerful way
|
||||
to create dashboards. It is possible due both Grafana and Grafana-Zabbix plugin features.
|
||||
|
||||
## Community Resources, Feedback, and Support
|
||||
|
||||
This project is being started as a simple plugin for Grafana. But many powerful features and
|
||||
improvements come from community. So don't hesitate to give any feedback and together we will make
|
||||
this tool better.
|
||||
|
||||
If you have any troubles with Grafana or you just want clarification on a feature, there are
|
||||
a number of ways to get help:
|
||||
|
||||
- [Troubleshooting guide](./configuration/troubleshooting/)
|
||||
- Search closed and open [issues on GitHub](https://github.com/grafana/grafana/issues)
|
||||
- [Grafana Community](https://community.grafana.com)
|
||||
- [Twitter](https://twitter.com/AlexanderZobnin)
|
||||
|
||||
Or you can send me [email](mailto:alexanderzobnin@gmail.com).
|
||||
|
||||
## Support Project
|
||||
I develop this project in my free time, but if you really find it helpful and promising, you can
|
||||
support me. There are some ways to do this. You can [donate](https://www.paypal.me/alexanderzobnin)
|
||||
any reasonable amount, or you can request a feature development, interesting for you (for example,
|
||||
Triggers panel was sponsored by [Core IT Project](http://coreit.fr/)).
|
||||
|
||||
## License
|
||||
|
||||
By utilizing this software, you agree to the terms of the included license. Grafana-Zabbix plugin is
|
||||
licensed under the Apache 2.0 agreement. See
|
||||
[LICENSE](https://github.com/alexanderzobnin/grafana-zabbix/blob/master/LICENSE) for the full
|
||||
license terms.
|
||||
@@ -1,41 +0,0 @@
|
||||
page_title: Grafana-Zabbix Installation
|
||||
page_description: Installation instructions for Grafana-Zabbix.
|
||||
|
||||
# Installation
|
||||
|
||||
## Choosing plugin version
|
||||
|
||||
Currently (in version `4.x.x`) Grafana-Zabbix plugin supports Zabbix versions `4.x` and `5.x`. Zabbix `3.x` is not supported anymore. Generally, latest plugin should work with latest Grafana version, but if you have any compatibility issue, try to downgrade to previous minor release of Grafana. It's also helpful to report (but use search first to avoid duplicating issues) compatibility issues to the [GitHub](https://github.com/grafana/grafana-zabbix/issues).
|
||||
|
||||
## Using grafana-cli tool
|
||||
|
||||
Get list of available plugins
|
||||
|
||||
```sh
|
||||
grafana-cli plugins list-remote
|
||||
```
|
||||
|
||||
Install zabbix plugin
|
||||
|
||||
```sh
|
||||
grafana-cli plugins install alexanderzobnin-zabbix-app
|
||||
```
|
||||
|
||||
Restart grafana after installing plugins
|
||||
```sh
|
||||
systemctl restart grafana-server
|
||||
```
|
||||
|
||||
Read more about installing plugins in [Grafana docs](https://grafana.com/docs/plugins/installation/)
|
||||
|
||||
**WARNING!** The only reliable installation method is `grafana-cli`. Any other way should be treated as a workaround and doesn't provide any backward-compatibility guaranties.
|
||||
|
||||
## From github releases
|
||||
|
||||
Starting from version 4.0, each plugin release on GitHub contains packaged plugin. To install it, go to [releases](https://github.com/grafana/grafana-zabbix/releases) page, pick release you want to get and click on `Assets`. Built plugin packaged into `zip` archive having name `alexanderzobnin-zabbix-app-x.x.x.zip`. Download it, unpack into your Grafana plugins directory and restart grafana server. Each plugin package contains [digital signature](https://grafana.com/docs/grafana/latest/plugins/plugin-signatures/) which allows Grafana to verify that plugin was published by it's owner and files are not modified.
|
||||
|
||||
**Note**: `since` plugin version 4.0, `grafana-cli` downloads plugin from GitHub release. So downloading plugin package manually, you get the same package as via `grafana-cli`.
|
||||
|
||||
## Building from sources
|
||||
|
||||
If you want to build a package yourself, or contribute - read [building instructions](./run_from_master).
|
||||
@@ -1,43 +0,0 @@
|
||||
page_title: Run Grafana-Zabbix from master
|
||||
page_description: Building instructions for Grafana-Zabbix.
|
||||
|
||||
# Run from master
|
||||
|
||||
If you want to build a package yourself, or contribute - here is a guide for how to do that.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- [NodeJS](https://nodejs.org/) LTS
|
||||
- [Go](https://golang.org/) version 1.14 or above
|
||||
|
||||
## Building
|
||||
|
||||
### Install dependencies
|
||||
|
||||
```bash
|
||||
make install
|
||||
```
|
||||
|
||||
### Build plugin (for all platforms)
|
||||
|
||||
```bash
|
||||
make dist
|
||||
```
|
||||
|
||||
### To run frontend and rebuild on file change
|
||||
|
||||
```bash
|
||||
make run-frontend
|
||||
```
|
||||
|
||||
### To run backend and rebuild on file change
|
||||
|
||||
```bash
|
||||
make run-backend
|
||||
```
|
||||
|
||||
### Run tests
|
||||
|
||||
```bash
|
||||
make test
|
||||
```
|
||||
@@ -1,10 +0,0 @@
|
||||
page_title: Grafana-Zabbix Upgrade
|
||||
page_description: Upgrade instructions for Grafana-Zabbix.
|
||||
|
||||
# Upgrade
|
||||
|
||||
## Upgrade from 2.x
|
||||
|
||||
After [enabling](../../configuration/#enable-plugin) Zabbix App go to _Data Sources_, open your configured Zabbix
|
||||
data source end select _Zabbix_ from _Type_ list again. This is needed because plugin id was changed
|
||||
in Grafana 3.0.
|
||||
@@ -1,12 +0,0 @@
|
||||
# Alerting
|
||||
|
||||
## Alerting overview
|
||||
|
||||
Grafana-Zabbix plugin introduces [alerting](https://grafana.com/docs/grafana/latest/alerting/) feature support in 4.0 release. Work still in progress, so current alerting support has some limitations:
|
||||
|
||||
- Only `Metrics` query mode supported.
|
||||
- Queries with data processing functions are not supported.
|
||||
|
||||
## Creating alerts
|
||||
|
||||
In order to create alert, open panel query editor and switch to the `Alert` tab. Click `Create Alert` button, configure alert and save dashboard. Refer to [Grafana](https://grafana.com/docs/grafana/latest/alerting/create-alerts/) documentation for more details about alerts configuration.
|
||||
@@ -1,103 +0,0 @@
|
||||
# Direct DB Connection
|
||||
|
||||
Since version 4.3 Grafana can use MySQL as a native data source. The idea of Direct DB Connection is that Grafana-Zabbix plugin can use this data source for querying data directly from a Zabbix database.
|
||||
|
||||
One of the most resource intensive queries for Zabbix API is the history query. For long time intervals `history.get`
|
||||
returns a huge amount of data. In order to display it, the plugin should adjust time series resolution
|
||||
by using [consolidateBy](../functions/#consolidateby). Ultimately, Grafana displays this reduced
|
||||
time series, but that data should be loaded and processed on the client side first. Direct DB Connection solves these two problems by moving consolidation to the server side. Thus, the client gets a 'ready-to-use' dataset which is much smaller. This allows the data to load faster and the client doesn't spend time processing the data.
|
||||
|
||||
Also, many users see better performance from direct database queries versus API calls. This could be the result of several reasons,
|
||||
such as the additional PHP layer and additional SQL queries (user permissions checks).
|
||||
|
||||
Direct DB Connection feature allows using database transparently for querying historical data. Now Grafana-Zabbix plugin supports few databases for history queries: MySQL, PostgreSQL and InfluxDB. Regardless of the database type, idea and data flow remain the same.
|
||||
|
||||
## Data Flow
|
||||
|
||||
This chart illustrates how the plugin uses both Zabbix API and the MySQL data source for querying different types
|
||||
of data from Zabbix. MySQL data source is used only for pulling history and trend data instead of `history.get`
|
||||
and `trend.get` API calls.
|
||||
|
||||
[](../img/reference-direct-db-connection.svg)
|
||||
|
||||
## Query structure
|
||||
|
||||
Below is an example query for getting history in the Grafana-Zabbix Plugin:
|
||||
|
||||
**MySQL**:
|
||||
```sql
|
||||
SELECT itemid AS metric, clock AS time_sec, {aggFunc}(value) as value
|
||||
FROM {historyTable}
|
||||
WHERE itemid IN ({itemids})
|
||||
AND clock > {timeFrom} AND clock < {timeTill}
|
||||
GROUP BY time_sec DIV {intervalSec}, metric
|
||||
ORDER BY time_sec ASC
|
||||
```
|
||||
|
||||
**PostgreSQL**:
|
||||
```sql
|
||||
SELECT to_char(itemid, 'FM99999999999999999999') AS metric,
|
||||
clock / {intervalSec} * {intervalSec} AS time,
|
||||
{aggFunc}(value) AS value
|
||||
FROM {historyTable}
|
||||
WHERE itemid IN ({itemids})
|
||||
AND clock > {timeFrom} AND clock < {timeTill}
|
||||
GROUP BY 1, 2
|
||||
ORDER BY time ASC
|
||||
```
|
||||
|
||||
where `{aggFunc}` is one of `[AVG, MIN, MAX, SUM, COUNT]` aggregation functions, `{historyTable}` is a history table,
|
||||
`{intervalSec}` - consolidation interval in seconds.
|
||||
|
||||
When getting trends, the plugin additionally queries a particular value column (`value_avg`, `value_min` or `value_max`) which
|
||||
depends on `consolidateBy` function value:
|
||||
|
||||
**MySQL**:
|
||||
```sql
|
||||
SELECT itemid AS metric, clock AS time_sec, {aggFunc}({valueColumn}) as value
|
||||
FROM {trendsTable}
|
||||
WHERE itemid IN ({itemids})
|
||||
AND clock > {timeFrom} AND clock < {timeTill}
|
||||
GROUP BY time_sec DIV {intervalSec}, metric
|
||||
ORDER BY time_sec ASC
|
||||
```
|
||||
|
||||
**PostgreSQL**:
|
||||
```sql
|
||||
SELECT to_char(itemid, 'FM99999999999999999999') AS metric,
|
||||
clock / {intervalSec} * {intervalSec} AS time,
|
||||
{aggFunc}({valueColumn}) AS value
|
||||
FROM {trendsTable}
|
||||
WHERE itemid IN ({itemids})
|
||||
AND clock > {timeFrom} AND clock < {timeTill}
|
||||
GROUP BY 1, 2
|
||||
ORDER BY time ASC
|
||||
```
|
||||
|
||||
**Note**: these queries may be changed in future, so look into sources for actual query structure.
|
||||
|
||||
As you can see, the Grafana-Zabbix plugin uses aggregation by a given time interval. This interval is provided by Grafana and depends on the panel width in pixels. Thus, Grafana displays the data in the proper resolution.
|
||||
|
||||
## InfluxDB
|
||||
Zabbix supports loadable modules which makes possible to write history data into an external database. There's a [module](https://github.com/i-ky/effluence) for InfluxDB written by [Gleb Ivanovsky](https://github.com/i-ky) which can export history into InfluxDB in real-time.
|
||||
|
||||
#### InfluxDB retention policy
|
||||
In order to keep database size under control, you should use InfluxDB retention policy mechanism. It's possible to create retention policy for long-term data and write aggregated data in the same manner as Zabbix does (trends). Then this retention policy can be used in plugin for getting data after a certain period ([Retention Policy](../../configuration/#direct-db-connection) option in data source config). Read more about how to configure retention policy for using with plugin in effluence module [docs](https://github.com/i-ky/effluence#database-sizing).
|
||||
|
||||
#### InfluxDB Query
|
||||
|
||||
Eventually, plugin generates InfluxDB query similar to this:
|
||||
|
||||
```sql
|
||||
SELECT MEAN("value")
|
||||
FROM "history"
|
||||
WHERE ("itemid" = '10073' OR "itemid" = '10074')
|
||||
AND "time" >= 1540000000000s AND "time" <= 1540000000060s
|
||||
GROUP BY time(10s), "itemid" fill(none)
|
||||
```
|
||||
|
||||
## Functions usage with Direct DB Connection
|
||||
|
||||
There's only one function that directly affects the backend data. This function is `consolidateBy`. Other functions work on the client side and transform data that comes from the backend. So you should clearly understand that this is pre-aggregated data (by AVG, MAX, MIN, etc).
|
||||
|
||||
For example, say you want to group values by 1 hour interval and `max` function. If you just apply `groupBy(10m, max)` function, your result will be wrong, because you would transform data aggregated by default `AVG` function. You should use `consolidateBy(max)` coupled with `groupBy(10m, max)` in order to get a precise result.
|
||||
@@ -1,356 +0,0 @@
|
||||
Functions reference
|
||||
===================
|
||||
|
||||
## Functions Variables
|
||||
|
||||
There are some built-in template variables available for using in functions:
|
||||
|
||||
- `$__range_ms` - panel time range in ms
|
||||
- `$__range_s` - panel time range in seconds
|
||||
- `$__range` - panel time range, string representation (`30s`, `1m`, `1h`)
|
||||
- `$__range_series` - invoke function over all series values
|
||||
|
||||
Examples:
|
||||
```
|
||||
groupBy($__range, avg)
|
||||
percentile($__range_series, 95) - 95th percentile over all values
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Transform
|
||||
|
||||
|
||||
### _groupBy_
|
||||
|
||||
```
|
||||
groupBy(interval, function)
|
||||
```
|
||||
|
||||
Takes each timeseries and consolidate its points fallen in the given _interval_ into one point using _function_, which can be one of: _avg_, _min_, _max_, _median_.
|
||||
|
||||
Examples:
|
||||
```
|
||||
groupBy(10m, avg)
|
||||
groupBy(1h, median)
|
||||
```
|
||||
---
|
||||
|
||||
### _scale_
|
||||
```
|
||||
scale(factor)
|
||||
```
|
||||
Takes timeseries and multiplies each point by the given _factor_.
|
||||
|
||||
Examples:
|
||||
```
|
||||
scale(100)
|
||||
scale(0.01)
|
||||
```
|
||||
---
|
||||
|
||||
### _delta_
|
||||
```
|
||||
delta()
|
||||
```
|
||||
Converts absolute values to delta. This function just calculate difference between values. For the per-second
|
||||
calculation use `rate()`.
|
||||
|
||||
---
|
||||
|
||||
### _rate_
|
||||
```
|
||||
rate()
|
||||
```
|
||||
Calculates the per-second rate of increase of the time series. Resistant to counter reset. Suitable for converting of
|
||||
growing counters into the per-second rate.
|
||||
|
||||
---
|
||||
|
||||
### _movingAverage_
|
||||
```
|
||||
movingAverage(windowSize)
|
||||
```
|
||||
Graphs the moving average of a metric over a fixed number of past points, specified by `windowSize` param.
|
||||
|
||||
Examples:
|
||||
```
|
||||
movingAverage(60)
|
||||
calculates moving average over 60 points (if metric has 1 second resolution it matches 1 minute window)
|
||||
```
|
||||
---
|
||||
|
||||
### _exponentialMovingAverage_
|
||||
```
|
||||
exponentialMovingAverage(windowSize)
|
||||
```
|
||||
Takes a series of values and a window size and produces an exponential moving average utilizing the following formula:
|
||||
`ema(current) = constant * (Current Value) + (1 - constant) * ema(previous)`
|
||||
|
||||
The Constant is calculated as:
|
||||
`constant = 2 / (windowSize + 1)`
|
||||
|
||||
If windowSize < 1 (0.1, for instance), Constant wouldn't be calculated and will be taken directly from windowSize
|
||||
(Constant = windowSize).
|
||||
|
||||
It's a bit tricky to graph EMA from the first point of series (not from Nth = windowSize). In order to do it,
|
||||
plugin should fetch previous N points first and calculate simple moving average for it. To avoid it, plugin uses this
|
||||
hack: assume, previous N points have the same average values as first N (windowSize). So you should keep this fact
|
||||
in mind and don't rely on first N points interval.
|
||||
|
||||
Examples:
|
||||
```
|
||||
movingAverage(60)
|
||||
calculates moving average over 60 points (if metric has 1 second resolution it matches 1 minute window)
|
||||
```
|
||||
---
|
||||
|
||||
### _percentile_
|
||||
```
|
||||
percentile(interval, N)
|
||||
```
|
||||
Takes a series of values and a window size and consolidate all its points fallen in the given _interval_ into one point by Nth percentile.
|
||||
|
||||
Examples:
|
||||
```
|
||||
percentile(1h, 99)
|
||||
percentile($__range_series, 95) - 95th percentile over all series values
|
||||
```
|
||||
---
|
||||
|
||||
### _removeAboveValue_
|
||||
```
|
||||
removeAboveValue(N)
|
||||
```
|
||||
Replaces series values with `null` if value > N
|
||||
|
||||
Examples:
|
||||
```
|
||||
removeAboveValue(1)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### _removeBelowValue_
|
||||
```
|
||||
removeBelowValue(N)
|
||||
```
|
||||
Replaces series values with `null` if value < N
|
||||
|
||||
---
|
||||
|
||||
### _transformNull_
|
||||
```
|
||||
transformNull(N)
|
||||
```
|
||||
Replaces `null` values with N
|
||||
|
||||
---
|
||||
|
||||
## Aggregate
|
||||
|
||||
### _aggregateBy_
|
||||
```
|
||||
aggregateBy(interval, function)
|
||||
```
|
||||
|
||||
Takes all timeseries and consolidate all its points fallen in the given _interval_ into one point using _function_, which can be one of: _avg_, _min_, _max_, _median_.
|
||||
|
||||
Examples:
|
||||
```
|
||||
aggregateBy(10m, avg)
|
||||
aggregateBy(1h, median)
|
||||
```
|
||||
---
|
||||
|
||||
### _sumSeries_
|
||||
```
|
||||
sumSeries()
|
||||
```
|
||||
|
||||
This will add metrics together and return the sum at each datapoint. This method required interpolation of each timeseries so it may cause high CPU load. Try to combine it with _groupBy()_ function to reduce load.
|
||||
|
||||
---
|
||||
|
||||
### _percentileAgg_
|
||||
```
|
||||
percentileAgg(interval, N)
|
||||
```
|
||||
Takes all timeseries and consolidate all its points fallen in the given _interval_ into one point by Nth percentile.
|
||||
|
||||
Examples:
|
||||
```
|
||||
percentileAgg(1h, 99)
|
||||
percentileAgg($__range_series, 95) - 95th percentile over all values
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### _average_
|
||||
```
|
||||
average(interval)
|
||||
```
|
||||
**Deprecated**, use `aggregateBy(interval, avg)` instead.
|
||||
|
||||
---
|
||||
|
||||
### _min_
|
||||
```
|
||||
min(interval)
|
||||
```
|
||||
**Deprecated**, use `aggregateBy(interval, min)` instead.
|
||||
|
||||
---
|
||||
|
||||
### _max_
|
||||
```
|
||||
max(interval)
|
||||
```
|
||||
**Deprecated**, use `aggregateBy(interval, max)` instead.
|
||||
|
||||
---
|
||||
|
||||
## Filter
|
||||
|
||||
### _top_
|
||||
|
||||
```
|
||||
top(N, value)
|
||||
```
|
||||
|
||||
Returns top N series, sorted by _value_, which can be one of: _avg_, _min_, _max_, _median_.
|
||||
|
||||
Examples:
|
||||
```
|
||||
top(10, avg)
|
||||
top(5, max)
|
||||
```
|
||||
---
|
||||
|
||||
### _bottom_
|
||||
|
||||
```
|
||||
bottom(N, value)
|
||||
```
|
||||
|
||||
Returns bottom N series, sorted by _value_, which can be one of: _avg_, _min_, _max_, _median_.
|
||||
|
||||
Examples:
|
||||
```
|
||||
bottom(5, avg)
|
||||
```
|
||||
---
|
||||
|
||||
## Trends
|
||||
|
||||
### _trendValue_
|
||||
```
|
||||
trendValue(valueType)
|
||||
```
|
||||
|
||||
Specifying type of trend value returned by Zabbix when trends are used (avg, min or max).
|
||||
|
||||
---
|
||||
|
||||
## Time
|
||||
|
||||
### _timeShift_
|
||||
```
|
||||
timeShift(interval)
|
||||
```
|
||||
Draws the selected metrics shifted in time. If no sign is given, a minus sign ( - ) is implied which will shift the metric back in time. If a plus sign ( + ) is given, the metric will be shifted forward in time.
|
||||
Examples:
|
||||
```
|
||||
timeShift(24h) - shift metric back in 24h hours
|
||||
timeShift(-24h) - the same result as for timeShift(24h)
|
||||
timeShift(+1d) - shift metric forward in 1 day
|
||||
```
|
||||
---
|
||||
|
||||
## Alias
|
||||
|
||||
Following template variables available for using in `setAlias()` and `replaceAlias()` functions:
|
||||
|
||||
- `$__zbx_item`, `$__zbx_item_name` - item name
|
||||
- `$__zbx_item_key` - item key
|
||||
- `$__zbx_host_name` - visible name of the host
|
||||
- `$__zbx_host` - technical name of the host
|
||||
|
||||
Examples:
|
||||
```
|
||||
setAlias($__zbx_host_name: $__zbx_item) -> backend01: CPU user time
|
||||
setAlias(Item key: $__zbx_item_key) -> Item key: system.cpu.load[percpu,avg1]
|
||||
setAlias($__zbx_host_name) -> backend01
|
||||
```
|
||||
|
||||
### _setAlias_
|
||||
```
|
||||
setAlias(alias)
|
||||
```
|
||||
|
||||
Returns given alias instead of the metric name.
|
||||
|
||||
Examples:
|
||||
```
|
||||
setAlias(load)
|
||||
```
|
||||
---
|
||||
|
||||
### _setAliasByRegex_
|
||||
```
|
||||
setAliasByRegex(regex)
|
||||
```
|
||||
|
||||
Returns part of the metric name matched by regex.
|
||||
|
||||
Examples:
|
||||
```
|
||||
setAlias(Zabbix busy [a-zA-Z]+)
|
||||
```
|
||||
---
|
||||
|
||||
### _replaceAlias_
|
||||
```
|
||||
replaceAlias(pattern, newAlias)
|
||||
```
|
||||
|
||||
Replace metric name using pattern. Pattern is regex or regular string. If regex is used, following special replacement patterns are supported:
|
||||
|
||||
|Pattern | Inserts|
|
||||
----------|---------
|
||||
|$$ | Inserts a "$". |
|
||||
|$& | Inserts the matched substring. |
|
||||
|$` | Inserts the portion of the string that precedes the matched substring. |
|
||||
|$' | Inserts the portion of the string that follows the matched substring. |
|
||||
|$n | Where n is a non-negative integer less than 100, inserts the nth parenthesized submatch string, provided the first argument was a RegExp object. |
|
||||
|
||||
For more details see [String.prototype.replace()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) function.
|
||||
|
||||
Examples:
|
||||
```
|
||||
CPU system time
|
||||
replaceAlias(/CPU (.*) time/, $1) -> system
|
||||
|
||||
backend01: CPU system time
|
||||
replaceAlias(/CPU (.*) time/, $1) -> backend01: system
|
||||
|
||||
backend01: CPU system time
|
||||
replaceAlias(/.*CPU (.*) time/, $1) -> system
|
||||
|
||||
backend01: CPU system time
|
||||
replaceAlias(/(.*): CPU (.*) time/, $1 - $2) -> backend01 - system
|
||||
```
|
||||
---
|
||||
|
||||
## Special
|
||||
|
||||
### _consolidateBy_
|
||||
```
|
||||
consolidateBy(consolidationFunc)
|
||||
```
|
||||
|
||||
When a graph is drawn where width of the graph size in pixels is smaller than the number of datapoints to be graphed, plugin consolidates the values to to prevent line overlap. The consolidateBy() function changes the consolidation function from the default of average to one of `sum`, `min`, `max` or `count`.
|
||||
|
||||
Valid function names are `sum`, `avg`, `min`, `max` and `count`.
|
||||
|
||||
---
|
||||