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
  • 外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传
为了部署安装Prometheus,你可以按照以下步骤进行操作: 1. 首先,将Prometheus的软件包下载到你的机器上。你可以从官方网站上找到最新的版本下载链接,例如中提供的链接。 2. 下载完毕后,使用命令行工具解压该软件包。你可以使用tar命令,例如在Linux系统中,可以使用以下命令进行解压缩操作: ``` tar xf prometheus-2.31.1.linux-amd64.tar.gz -C /usr/local/ ``` 这将会把解压后的文件放置在`/usr/local/`目录下。 3. 接下来,进入解压后的目录,并将其重命名为`prometheus`,可以使用以下命令进行操作: ``` mv prometheus-2.31.1.linux-amd64/ prometheus ``` 4. 运行Prometheus服务器。进入`prometheus/`目录,并执行以下命令: ``` ./prometheus --config.file=prometheus.yml ``` 这将会启动Prometheus服务器,并使用`prometheus.yml`作为配置文件。 5. 最后,根据需要进行Prometheus的配置。你可以根据官方文档提供的指导进行配置。 请注意,上述步骤仅供参考,请根据你的具体环境和需求进行相应调整。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [Prometheus部署、操作及Grafana展示、告警](https://blog.youkuaiyun.com/m0_71521555/article/details/127497906)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* [Promethus(普罗米修斯)安装与配置](https://blog.youkuaiyun.com/m0_56305656/article/details/121546981)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值