天天看點

prometheus安裝和部署

—prometheus簡介

  1. prometheus是基于go語言開發的一套開源的監控、報警、和時間序列資料庫的組合
  2. prometheus于2016年加入CNCF,2018年8月9日稱為CNCF繼k8s之後畢業的第二個項目

—Prometheus的架構

  1. prometheus server:主服務 接受外部http請求、收集名額資料、存儲名額資料、查詢名額資料等
  2. prometheus targets:靜态發現目标後執行名額資料抓取
  3. service discovery:動态發現目标後執行名額資料抓取
  4. prometheus alerting:調用alertmanager元件實作報警通知
  5. push gateway:資料收集代理伺服器
  6. data visualization and export:資料可視化與資料導出

—下載下傳安裝包部署并啟動Prometheus

[email protected]:~$ mkdir prometheus
[email protected]:~$ cd prometheus/
[email protected]:~/prometheus$ wget https://github.com/prometheus/prometheus/releases/download/v2.40.5/prometheus-2.40.5.linux-amd64.tar.gz
[email protected]:~/prometheus$ tar xvf prometheus-2.40.5.linux-amd64.tar.gz 
[email protected]:~/prometheus$ cd prometheus-2.40.5.linux-amd64/
[email protected]:~/prometheus/prometheus-2.40.5.linux-amd64$ ./prometheus &
           

—web界面通路

prometheus安裝和部署

—安裝node-export 并在運作

[email protected]:~/prometheus/prometheus-2.40.5.linux-amd64$ cd ~
[email protected]:~$ mkdir node-export
[email protected]:~$ cd node-export/
[email protected]:~/node-export$ wget https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-amd64.tar.gz
[email protected]:~/node-export$ tar xvf node_exporter-1.5.0.linux-amd64.tar.gz
[email protected]:~/node-export/node_exporter-1.5.0.linux-amd64$ ./node_exporter &
           

—web界面通路node-export

prometheus安裝和部署

—修改Prometheus配置檔案

[email protected]:~/node-export/node_exporter-1.5.0.linux-amd64$ cd ~
[email protected]:~$ cd prometheus/
[email protected]:~/prometheus$ cd prometheus-2.40.5.linux-amd64/
[email protected]:~/prometheus/prometheus-2.40.5.linux-amd64$ vim prometheus.yml
           
prometheus安裝和部署

—重新開機Prometheus服務 登入web界面

[email protected]:~/prometheus/prometheus-2.40.5.linux-amd64$ pidof prometheus
10340
[email protected]:~/prometheus/prometheus-2.40.5.linux-amd64$ vim prometheus.yml 
[email protected]:~/prometheus/prometheus-2.40.5.linux-amd64$ kill -9 10340
[email protected]:~/prometheus/prometheus-2.40.5.linux-amd64$ ./prometheus &
           
prometheus安裝和部署

繼續閱讀