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

Prometheus_51cto

Prometheus_Prometheus_02

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

Prometheus_Prometheus_03


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

Prometheus_Prometheus_04

Prometheus_Prometheus_05

234234

Prometheus_51cto_06

Prometheus_51cto_07

Prometheus_Prometheus_08

Prometheus_51cto_09

Prometheus_51cto_10

Prometheus_Prometheus_11


本文一部分参考:

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