0

Grafana 安装部署

 3 years ago
source link: https://wsgzao.github.io/post/grafana/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Grafana 是一个开源的数据分析和监控平台,它是一个开箱即用的可视化工具,具有功能齐全的度量仪表盘和图形编辑器,有灵活丰富的图形化选项,可以混合多种风格,支持多个数据源特点。Grafana + Zabbix 的组合方式,主要是通过插件的形式,将 Zabbix 接入到 Grafana 中,使其可以借助 Grafana 的 portal 进行统一的监控和管理。

The open platform for beautiful analytics and monitoring

2019 年 01 月 25 日 - 更新 Grafana Zabbix API Error 解决办法
2018 年 10 月 24 日 - 初稿

阅读原文 - https://wsgzao.github.io/post/grafana/

扩展阅读

Grafana - https://grafana.com/


Grafana 入门

观看 10 分钟的初学者指南,以建立仪表板,以快速介绍设置仪表板和面板。
https://www.youtube.com/watch?v=sKNZMtoSHN4&index=7&list=PLDGkOdUX1Ujo3wHw9-z5Vo12YLqXRjzg2

阅读基本概念文档,以获得 Grafana 概念的速成关键课程
http://docs.grafana.org/guides/basic_concepts/

Grafana 安装

No matter where your data is, or what kind of database it lives in, you can bring it together with Grafana. Beautifully.

http://docs.grafana.org/installation/

# install grafana
cat > /etc/yum.repos.d/grafana.repo << 'EOF'
[grafana]
name=grafana
baseurl=https://packagecloud.io/grafana/stable/el/7/$basearch
gpgkey=https://packagecloud.io/gpg.key https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana
enabled=0
gpgcheck=1
EOF

# yum install grafana
yum --enablerepo=grafana -y install grafana initscripts fontconfig

# change anything if you need
vi /etc/grafana/grafana.ini

30 [server]
31 # Protocol (http, https, socket)
32 ;protocol = http
33
34 # The ip address to bind to, empty will bind to all interfaces
35 ;http_addr =
36
37 # The http port to use
38 ;http_port = 3000
39
40 # The public facing domain name used to access grafana from a browser
41 ;domain = localhost

# start and enable grafana
sudo systemctl start grafana-server
sudo systemctl enable grafana-server
sudo systemctl status grafana-server

# test
http://<ip>:3000
admin/admin

# 添加数据源
安装很简单,之后需要配置数据源比如 InfluxDB/Zabbix API 等才能发挥真正的作用

grafana-zabbix

https://grafana.com/plugins/alexanderzobnin-zabbix-app

# 安装 zabbix 插件(grafana-zabbix)
grafana-cli plugins install alexanderzobnin-zabbix-app
systemctl restart grafana-server

# 启用插件
进入 Plugins 界面,选择 “Zabbix”
开始面板(左上角图标) -> Plugins -> Apps -> Zabbix

# 添加 zabbix 数据源
进入 “添加数据源” 界面
开始面板(左上角图标) -> Data Sources -> Add data source

# 配置 Zabbix 数据源
配置完后,保存退出,配置的内容如下:
重要参数有:
Type: Zabbix
Url: http://192.168.56.103/zabbix/api_jsonrpc.php
Access: direct
(Zabbix API details)
Username: Admin(默认)
Password: zabbix(默认)

# 验证
之后,我们从 开始面板 -> Zabbix 中,便可看到 Zabbix 相关的监控数据。

Grafana Zabbix API Error

# 如果在 Grafana Dashboard 看到 Zabbix API Error 建议查看 Zabbix front 如 Apache 或者 Nginx 的错误日志定位问题
tail -f /var/log/httpd/error_log

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 72 bytes) in /usr/share/zabbix/include/func.inc.php on line 1423

# 发现超过 php 的 memory_limit=128M
vim /etc/php.ini
vim /etc/httpd/conf.d/zabbix.conf

memory_limit = 512M

# 增加 info.php 查看变量是否生效
vim /usr/share/zabbix/info.php

<?php
phpinfo();
?>

http://<your-zabbix-server/info.php

# 重启 httpd 生效
service httpd restart

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK