安装grafana
- 官网下载grafana
$ wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.1-1.x86_64.rpm
- 安装
$ yum -y install grafana-5.0.1-1.x86_64.rpm
- 安装完成以后启动grafna,命令
$ /etc/init.d/grafana-server start
- 要安装一下grafana-zabbix插件,否则无法添加zabbix,命令:
获取插件列表,命令:
$ grafana-cli plugins list-remote
- 列表:
id: abhisant-druid-datasource version: 0.0.5
id: akumuli-datasource version: 1.2.8
id: alexanderzobnin-zabbix-app version: 3.9.1
id: andig-darksky-datasource version: 1.0.0
id: ayoungprogrammer-finance-datasource version: 1.0.0
id: belugacdn-app version: 1.2.0
id: bessler-pictureit-panel version: 1.0.0
id: blackmirror1-singlestat-math-panel version: 1.1.5
id: blackmirror1-statusbygroup-panel version: 1.1.1
id: bosun-app version: 0.0.28
id: briangann-datatable-panel version: 0.0.6
id: briangann-gauge-panel version: 0.0.6
id: btplc-alarm-box-panel version: 1.0.7
id: btplc-peak-report-panel version: 0.2.3
id: btplc-status-dot-panel version: 0.2.3
id: btplc-trend-box-panel version: 0.1.9
id: camptocamp-prometheus-alertmanager-datasource version: 0.0.6
id: citilogics-geoloop-panel version: 1.1.1
id: cloudflare-app version: 0.1.3
id: crate-datasource version: 0.5.1
id: dalmatinerdb-datasource version: 1.0.5
id: ddurieux-glpi-app version: 1.3.0
id: devicehive-devicehive-datasource version: 2.0.1
id: digiapulssi-breadcrumb-panel version: 1.1.4
id: digiapulssi-organisations-panel version: 1.1.0
id: digrich-bubblechart-panel version: 1.1.0
id: fastweb-openfalcon-datasource version: 1.0.0
id: fatcloud-windrose-panel version: 0.7.0
id: fetzerch-sunandmoon-datasource version: 0.1.2
id: flant-statusmap-panel version: 0.0.2
id: foursquare-clouderamanager-datasource version: 0.9.2
id: fzakaria-simple-annotations-datasource version: 1.0.0
id: gnocchixyz-gnocchi-datasource version: 1.7.0
id: goshposh-metaqueries-datasource version: 0.0.1
id: grafana-azure-data-explorer-datasource version: 1.0.0
id: grafana-azure-monitor-datasource version: 0.2.2
id: grafana-clock-panel version: 0.1.0
id: grafana-example-app version: 1.0.1
id: grafana-influxdb-08-datasource version: 1.0.2
id: grafana-influxdb-flux-datasource version: 5.1.0
id: grafana-kairosdb-datasource version: 3.0.1
id: grafana-kubernetes-app version: 1.0.1
id: grafana-piechart-panel version: 1.3.3
id: grafana-polystat-panel version: 1.0.14
id: grafana-simple-json-datasource version: 1.4.0
id: grafana-worldmap-panel version: 0.1.2
id: gridprotectionalliance-openhistorian-datasource version: 1.0.2
id: gridprotectionalliance-osisoftpi-datasource version: 1.0.3
id: hawkular-datasource version: 1.1.1
id: ibm-apm-datasource version: 0.8.0
id: instana-datasource version: 1.3.0
id: jasonlashua-prtg-datasource version: 4.0.3
id: jdbranham-diagram-panel version: 1.4.4
id: kentik-app version: 1.3.1
id: larona-epict-panel version: 1.0.0
id: linksmart-hds-datasource version: 0.3.0
id: linksmart-sensorthings-datasource version: 1.1.0
id: marcuscalidus-svg-panel version: 0.2.0
id: michaeldmoore-annunciator-panel version: 1.0.0
id: monasca-datasource version: 1.0.0
id: monitoringartist-monitoringart-datasource version: 1.0.0
id: moogsoft-aiops-app version: 7.0.1
id: mtanda-google-calendar-datasource version: 1.0.4
id: mtanda-heatmap-epoch-panel version: 0.1.7
id: mtanda-histogram-panel version: 0.1.6
id: natel-discrete-panel version: 0.0.8-pre
id: natel-influx-admin-panel version: 0.0.5
id: natel-plotly-panel version: 0.0.5
id: natel-usgs-datasource version: 0.0.2
id: neocat-cal-heatmap-panel version: 0.0.3
id: novalabs-annotations-panel version: 0.0.1
id: ns1-app version: 0.0.7
id: ntop-ntopng-datasource version: 1.0.0
id: opennms-helm-app version: 2.0.0
id: ovh-warp10-datasource version: 2.1.1
id: percona-percona-app version: 1.0.0
id: petrslavotinek-carpetplot-panel version: 0.1.1
id: praj-ams-datasource version: 1.0.1
id: rackerlabs-blueflood-datasource version: 0.0.2
id: radensolutions-netxms-datasource version: 1.1.0
id: raintank-snap-app version: 0.0.5
id: raintank-worldping-app version: 1.2.4
id: ryantxu-ajax-panel version: 0.0.5
id: ryantxu-annolist-panel version: 0.0.1
id: satellogic-3d-globe-panel version: 0.1.0
id: savantly-heatmap-panel version: 0.2.0
id: sbueringer-consul-datasource version: 0.1.5
id: sidewinder-datasource version: 0.2.0
id: skydive-datasource version: 1.0.1
id: smartmakers-trafficlight-panel version: 1.0.0
id: sni-pnp-datasource version: 1.0.5
id: sni-thruk-datasource version: 1.0.0
id: snuids-radar-panel version: 1.4.1
id: snuids-trafficlights-panel version: 1.4.2
id: stagemonitor-elasticsearch-app version: 0.83.2
id: udoprog-heroic-datasource version: 0.1.0
id: vertamedia-clickhouse-datasource version: 1.8.0
id: vonage-status-panel version: 1.0.8
id: voxter-app version: 0.0.1
id: yesoreyeram-boomtable-panel version: 0.4.6
id: zuburqan-parity-report-panel version: 1.0.1
我们看到第三个插件alexanderzobnin-zabbix-app version: 3.9.1是我们要安装的zabbix插件,命令:
$ grafana-cli plugins install alexanderzobnin-zabbix-app
installing alexanderzobnin-zabbix-app @ 3.9.1
from url: https://grafana.com/api/plugins/alexanderzobnin-zabbix-app/versions/3.9.1/download
into: /var/lib/grafana/plugins
✔ Installed alexanderzobnin-zabbix-app successfully
Restart grafana after installing plugins . <service grafana-server restart>
显示安装成功,重启grafana服务
配置grafana并添加mysql和zabbix插件
-
重启grafana-server,用浏览器打开服务器的3000端口,http://ip:3000进行登录。登录名密码默认都是admin如图:
-
登录完成之后的界面,并点击红色箭头这里启用zabbix插件:
-
我们现在来创建zabbix-mysql数据库的连接,这步可选可不选,选择的好处是更快更省资源,不选的话,用zabbix-api来通信。
-
接下来我们创建zabbix数据源,这里要注意一下,类型选择这类如果没有zabbix说明上面的步骤没有成功,请重新按以上步骤启用zabbix插件即可。url要填写zabbix目录下的api_jsonrpc.php,格式为http://192.168.1.1/zabbix/api_jsonrpc.php,下面的选项按实际情况填写,我的zabbix没有proxy,所以选直接连接direct
用户名密码填写zabbix的用户名和密码。Direct DB Connection这里可选可不选,选择的好处是
Select SQL Data Source for Zabbix database. In order to use this feature you should create and configure it first. Zabbix plugin uses this data source for querying history data directly from database. This way usually faster than pulling data from Zabbix API, especially on the wide time ranges, and reduces amount of data transfered.
大概是说直接连接数据库获取数据比zabbix-api的方式要更快,更加节省资源。因为刚才我已经创建了zabbix-mysql所以我选择了直连mysql,如果没创建mysql的话SQL Data Source这里是没有数据库选项的。
网友评论