Prometheus安装配置

一、什么是Prometheus?

  官方介绍:Prometheus受启发于Google的Brogmon监控系统(相似的Kubernetes是从Google的Brog系统演变而来),从2012年开始由前Google工程师在Soundcloud以开源软件的形式进行研发,并且于2015年早期对外发布早期版本。2016年5月继Kubernetes之后成为第二个正式加入CNCF基金会的项目,同年6月正式发布1.0版本。2017年底发布了基于全新存储层的2.0版本,能更好地与容器平台、云平台配合。

二、怎么安装Prometheus?

1.下载prometheus安装包(linux版)到 /opt/minitor/prometheus 。
        
 
2.运行 tar -zxvf prometheus-2.0.0.linux-amd64.tar.gz ,解压文件到当前目录。
 
3.执行 vim /opt/minitor/prometheus/prometheus.yml。
# my global config
global:
  scrape_interval:     5s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 5s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).
 
# Alertmanager configuration
alerting:
  alertmanagers:
    - static_configs:
#     - targets: ['localhost:9093']
 
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "/opt/prometheus/prome/prometheus-2.0.0.linux-amd64/rules/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: ['ip:9090']
        labels:
          instance: prometheus
4.启动prometheus。
nohup ./prometheus --config.file=prometheus.yml --web.listen-address=:9090 &
5.去prometheus自带的web页面上查看
6.prometheus状态为up,说明配置成功。
原文地址:https://www.cnblogs.com/wgx519/p/13951282.html