grafana+influxdb+telegraf搭建服務器監控平臺
前言
- [收集數據] Telegraf 是一個用 Go 編寫的代理程序,可收集系統和服務的統計數據,並寫入到 InfluxDB 數據庫。Telegraf 具有內存佔用小的特點,通過插件系統開發人員可輕鬆添加支持其他服務的擴展。
- [存儲數據] InfluxDB 是 Go 語言開發的一個開源分佈式時序數據庫,針對時間序列數據的快速,高可用性存儲和檢索進行了優化,非常適合運營監控,應用指標和實時分析。
- [展示數據] Grafana 是純 Javascript 開發的web應用,用於提供界面監控,訪問各類數據源,自定義報表、顯示圖表等等。
官方文檔地址
- telegraf: https://docs.influxdata.com/telegraf/v1.8/
- influxdb: https://docs.influxdata.com/influxdb/v1.6/
- grafana: http://docs.grafana.org/
系統版本centos7
telegraf安裝
下載安裝
- sudo wget https://dl.influxdata.com/telegraf/releases/telegraf-1.8.2-1.x86_64.rpm
- sudo yum localinstall telegraf-1.8.2-1.x86_64.rpm
啟動服務、查看狀態、添加開機啟動
- systemctl start telegraf.service
- service telegraf status
- systemctl enable telegraf.service
查看版本號
- telegraf --version
配置
默認路徑:/etc/telegraf/telegraf.conf
influxdb安裝
下載安裝
- sudo wget https://dl.influxdata.com/influxdb/releases/influxdb-1.6.4.x86_64.rpm
- sudo yum localinstall influxdb-1.6.4.x86_64.rpm
啟動服務、查看狀態、添加開機啟動
- service influxdb start
- service influxdb status
- systemctl enable influxdb
查看版本號
- influx --version
配置
默認路徑:/etc/influxdb/influxdb.conf
啟用端口
- Networking By default, InfluxDB uses the following network ports:
- TCP port ==8083== is used for InfluxDB’s Admin panel
- TCP port ==8086== is used for client-server communication over InfluxDB’s HTTP API
- TCP ports ==8088== and 8091 are required for clustered InfluxDB instances
進入Influx查看數據庫
查看服務端口
grafana安裝
下載安裝
- sudo wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.3.1-1.x86_64.rpm
- sudo yum localinstall grafana-5.3.1-1.x86_64.rpm
啟動服務、查看狀態、添加開機啟動
- systemctl start grafana-server-server
- systemctl status grafana-server
- systemctl enable grafana-server
查看版本號
- grafana -v
配置
默認路徑:/etc/grafana/grafana.ini
啟用端口
- 默認端口為3000 ,如http://127.0.0.1:3000訪問, 默認登陸信息賬號和密碼分別admin和admin
Grafana使用及配置
- 登錄http://127.0.0.1:3000,默認用戶名admin,密碼admin
- 進入後,首先選擇Add Data Sources,添加需要的數據源
- 然後進入dashboard頁面,創建儀表盤。我們可以通過訪問https://grafana.com/dashboards來查看已經由其他用戶共享的儀表盤,選取合適的使用,縮短上手時間,也可以自己自定義創建錶盤。在這裡選取的是兩個儀表盤
- https://grafana.com/dashboards/1443
- https://grafana.com/dashboards/928
- 這兩個儀表盤內已經基本涵蓋一個系統需要監控的相關參數
- 通過導入該儀表盤進入grafana後,選擇我們需要的數據源,最終的監控儀表盤的效果如下
閱讀更多 程序猿阿布 的文章