Prometheus

1.prometheus 部署

cd /home/nflow/server
wget https://github.com/prometheus/prometheus/releases/download/v2.0.0/prometheus-2.0.0.linux-amd64.tar.gz
tar xf  prometheus-2.0.0.linux-amd64.tar.gz
mv prometheus-2.0.0.linux-amd64 prometheus
vim  /usr/lib/systemd/system/prometheus.service
[Unit]
Description=Prometheus
Documentation=https://prometheus.io/
After=network.target
[Service]
Type=simple
User=nflow
ExecStart=/home/nflow/servers/prometheus/prometheus --config.file=/home/nflow/servers/prometheus/prometheus.yml --storage.tsdb.path=/home/nflow/servers/prometheus/data
Restart=on-failure
[Install]
WantedBy=multi-user.target
sed  -i  '#localhost#0.0.0.0#'  /home/nflow/server/prometheus/prometheus.yml
chmod +x  /usr/lib/systemd/system/prometheus.service
systemctl  enable  prometheus.service
systemctl   start   prometheus.service

1.png

2.png

2.node_exporter部署

wget  https://github.com/prometheus/node_exporter/releases/download/v0.17.0-rc.0/node_exporter-0.17.0-rc.0.linux-amd64.tar.gz 
tar xf  node_exporter-0.17.0-rc.0.linux-amd64.tar.gz  -C  /home/nflow/servers 
cd  /home/nflow/servers
mv   node_exporter-0.17.0-rc.0.linux-amd64   node_exporter
vim /usr/lib/systemd/system/node_exporter.service
[Unit]
Description=node_exporter
Documentation=https://prometheus.io/
After=network.target
[Service]
Type=simple
User=nflow
ExecStart=/home/nflow/servers/node_exporter/node_exporter
Restart=on-failure
[Install]
WantedBy=multi-user.target
systemctl start  node_exporter
systemctl  enable  node_exporter


[root@ch11 software]# cat /home/nflow/servers/prometheus/prometheus.yml
global:
  scrape_interval:     15s 
  evaluation_interval: 15s 
alerting:
  alertmanagers:
  - static_configs:
    - targets:
rule_files:
scrape_configs:
  - job_name: 'prometheus'
    static_configs:
    - targets: ['0.0.0.0:9090']
  - job_name: '172.16.10.11'           #下面幾行新添加的
    static_configs:   
    - targets: ['172.16.10.11:9100']

 systemctl restart  prometheus

1.png


3. grafana部署

wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.3.2-1.x86_64.rpm 
yum localinstall  -y grafana-5.3.2-1.x86_64.rpm
systemctl enable grafana-server
systemctl start grafana-server

1.png

2.png

234234

1.png

2.png

5.png

6.png

1.png

2.png


本文一部分參考:

https://www.cnblogs.com/netonline/p/8289411.html


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章