溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Grafana的安裝與配置教程

發布時間:2021-08-20 18:51:37 來源:億速云 閱讀:440 作者:chen 欄目:編程語言

這篇文章主要講解了“Grafana的安裝與配置教程”,文中的講解內容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“Grafana的安裝與配置教程”吧!

一: 簡介

Grafana 是一個開源儀表盤工具,它可用于Graphite、InfluxDB與 OpenTSDB 一起使用。最新的版本還可以用于其他的數據源,比如Elasticsearch。

從本質上說,它是一個功能豐富的Graphite-web 替代品,能幫助用戶更簡單地創建和編輯儀表盤。它包含一個獨一無二的Graphite目標解析器,從而可以簡化度量和函數的編輯

二: 安裝與配置

1.安裝
yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.5.2-1.x86_64.rpm

2.開機啟動配置
 systemctl daemon-reload
 systemctl start grafana-server
 systemctl status grafana-server

3.相關文件目錄
Installs binary to /usr/sbin/grafana-server
Copies init.d script to /etc/init.d/grafana-server
Installs default file (environment vars) to /etc/sysconfig/grafana-server
Copies configuration file to /etc/grafana/grafana.ini
Installs systemd service (if systemd is available) name grafana-server.service
The default configuration uses a log file at /var/log/grafana/grafana.log
The default configuration specifies an sqlite3 database at /var/lib/grafana/grafana.db

4.應用頁面  http://ip:3000  用戶名/密碼:admin/admin
Grafana的安裝與配置教程

三:配置

1.通過rpm安裝,配置信息在/etc/grafana/grafana.ini文件中,通過安裝包安裝配置文件在/usr/share/grafana/conf/目錄下。

Grafana的安裝與配置教程

通過啟動日志可以看到,會讀取defaults.ini和grafana.ini的配置信息, 因此如果要修改訪問端口(如3000改成3001)需要修改defaults.ini

配置文件中的信息,感覺有點奇怪。

2.dashboards配置

編輯配置文件/etc/grafana/grafana.ini,修改dashboards.json段落下兩個參數的值:
[dashboards.json]
enabled = true
path = /var/lib/grafana/dashboards
一定要去掉開頭的分號(“;”)否則配置不起作用

安裝儀表盤(Percona提供),重新啟動應用
$ git clone https://github.com/percona/grafana-dashboards.git
$ cp -r grafana-dashboards/dashboards /var/lib/grafana/
systemctl restart grafana-server

Grafana的安裝與配置教程

四:同prometheus一起監控Mysql

1.Prometheus安裝   請參考上一篇博文

2.配置文件


點擊(此處)折疊或打開

  1. global:

  2.   scrape_interval: 15s

  3.   evaluation_interval: 15s


  4. scrape_configs:

  5.   - job_name: prometheus

  6.     static_configs:

  7.       - targets: ['localhost:9090']

  8.         labels:

  9.           instance: prometheus


  10.   - job_name: linux

  11.     static_configs:

  12.       - targets: ['10.10.0.186:9100']

  13.         labels:

  14.           instance: db1


  15.   - job_name: mysql

  16.     static_configs:

  17.       - targets: ['10.10.0.186:9104']

  18.         labels:

  19.           instance: db1

3.部署node_exporters和mysqld_exporters


點擊(此處)折疊或打開

  1. $ wget https://github.com/prometheus/node_exporter/releases/download/v0.14.0/node_exporter-0.14.0.linux-amd64.tar.gz -O node_exporter-0.14.0.linux-amd64.tar.gz

  2. $ wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.10.0/mysqld_exporter-0.10.0.linux-amd64.tar.gz -O mysqld_exporter-0.10.0.linux-amd64.tar.gz

  3. $ mkdir /usr/local/services/prometheus_exporters

  4. $ tar zxf node_exporter-0.14.0.linux-amd64.tar.gz -C /usr/local/services/prometheus_exporters --strip-components=1

  5. $ tar zxf mysqld_exporter-0.10.0.linux-amd64.tar.gz -C /usr/local/services/prometheus_exporters --strip-components=1


  6. $ cd /usr/local/services/prometheus_exporters

  7. $ ./node_exporter


  8. $ cd /usr/local/services/prometheus_exporters

  9. $ cat << EOF > .my.cnf

  10. [client]

  11. user=prom

  12. password=abc123

  13. EOF

  14. $ ./mysqld_exporter -config.my-cnf=".my.cnf"

查看Prometheus  http://ip:9090

Grafana的安裝與配置教程

4.Grafana中創建Prometheus數據源

Grafana的安裝與配置教程

5.服務器監控結果畫面
Grafana的安裝與配置教程
6.Mysql數據庫監控結果畫面
Grafana的安裝與配置教程

感謝各位的閱讀,以上就是“Grafana的安裝與配置教程”的內容了,經過本文的學習后,相信大家對Grafana的安裝與配置教程這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關知識點的文章,歡迎關注!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女