1. 程式人生 > >Grafana+OpenFalcon安裝

Grafana+OpenFalcon安裝

Grafana Open- Falcon

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://github.com/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中的監控項名字:

最終效果展示:

Grafana+OpenFalcon安裝