Prometheus部署安装

Prometheus部署安装

1. 准备安装包

  1. prometheus-2.8.1.linux-amd64.tar.gz
  2. node_exporter-1.3.0.linux-amd64.tar.gz
  3. mysqld_exporter-0.13.0.linux-amd64.tar.gz

2. 解压安装

(1) node_exporter
  •    tar -zxvf node_exporter-1.3.0.linux-amd64.tar.gz -C /usr/local/ 
    
  •    cd /usr/local 
    
  •    mv node_exporter-1.3.0.linux-amd64/ node_exporter
    
(2) mysqld_exporter
  • tar -zxvf mysqld_exporter-0.13.0.linux-amd64.tar.gz -C /usr/local/
  • cd /usr/local
  • mv mysqld_exporter-0.13.0.linux-amd64/ mysqld_exporter
(3) prometheus
  • tar -zxvf prometheus-2.8.1.linux-amd64.tar.gz -C /usr/local/
  • cd /usr/local
  • mv prometheus-2.8.1.linux-amd64/ prometheus
(4) 修改prometheus.yml文件
alerting:
  alertmanagers:
  - static_configs:
    - targets:
      # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "prometheus"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
    - targets: ['localhost:9090']
  - job_name: "node1"
    static_configs:
      - targets: ["172.16.20.210:9100"]
        labels:
          name: "霍山服务器1"
          ip: "172.16.20.210"
  - job_name: "node2"
    static_configs:
      - targets: ["172.16.20.244:9100"]
        labels:
          name: "霍山服务器2"
          ip: "172.16.20.244"

  - job_name: "db1"
    static_configs:
      - targets: ["172.16.20.210:9104"]
        labels:
          type: "mysql"
          servername: "hsdb1"
          name: "霍山db1"
          port: 3306
          host: "172.16.20.210:9100"

  - job_name: "db1"
    static_configs:
      - targets: ["172.16.20.244:9104"]
        labels:
          type: "mysql"
          servername: "hsdb2"
          name: "霍山db2"
          port: 3306
          host: "172.16.20.244:9100"
(5) 启动prometheus
  • cd /usr/local/prometheus/
  • ./prometheus
(6) 启动node_exporter
  • cd /usr/local/node_exporter/
  • ./node_exporter
(7) 启动mysqld_exporter
  • cd /usr/local/mysqld_exporter/
  • ./mysqld_exporter
(8) 访问主页验证
  • 访问对应ip:9090,例如 http://10.18.100.126:9090
    ysqld_exporter/
  • ./mysqld_exporter
(8) 访问主页验证
  • 访问对应ip:9090,例如 http://10.18.100.126:9090
  • 外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传
  • 5
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值