Grafana+OpenFalcon安装 官网地址:https://grafana.com/ 下载地址:https://grafana.com/grafana/download 1、 安装 方法一: On CentOS / Fedora / Redhat: $ wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.1.1-1.x86_64.rpm $ sudo yum install initscripts fontconfig $ sudo rpm -Uvh grafana-5.1.1-1.x86_64.rpm

sudo yum localinstall grafana-5.1.1-1.x86_64.rpm 

方法二: Add the following to a new file at /etc/yum.repos.d/grafana.repo [grafana] name=grafana baseurl=https://packagecloud.io/grafana/stable/el/7/$basearch repo_gpgcheck=1 enabled=1 gpgcheck=1 gpgkey=https://packagecloud.io/gpg.key https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt

$ sudo yum install grafana

2、下载 grafana-openfalcon-datasource 到 grafana 的 plugins 下: 方法一: 查看plugins目录:

vim /etc/grafana/grafana.ini

;plugins = /var/lib/grafana/plugins

cd /var/lib/grafana/plugins

git clone https:///open-falcon/grafana-openfalcon-datasource 方法二: 通过grafana-cli安装Open-falcon插件:

grafana-cli plugins install fastweb-openfalcon-datasource

3、启动 修改端口号并重启 grafana-server

vim /etc/grafana/grafana.ini

http_port = 9090 root_url = http://localhost:9090

启动:grafana-server

systemctl start grafana-server 启动

systemctl restart grafana-server 重启

4、添加数据源 访问http://grafanaip:9090: 默认登录的用户名和密码都为admin,登陆后记得修改密码

找到Data Sources配置项,点击添加数据源: 此处注意:http://localhost:8080/api/v1/grafana  为open-falcon-0.21版本的api接口 和0.1版本有所区别 建议安装最新版本open-falcon 。 配置数据源成功: 5、为监控主机画图: 版本:# grafana-server -v Version 5.1.2 (commit: c3c690e21)

添加新的dashboard 点击配置

看着图配置吧,不难,注意数据源

注意查询语句的写法 $name这个是variable 中配置的,在后面的是open-falcon中的监控项名字:

最终效果展示: