简介

Prometheus, a Cloud Native Computing Foundation project, is a systems and service monitoring system. It collects metrics from configured targets at given intervals, evaluates rule expressions, displays the results, and can trigger alerts if some condition is observed to be true.

Prometheus' main distinguishing features as compared to other monitoring systems are:

  • a multi-dimensional data model (timeseries defined by metric name and set of key/value dimensions)
  • a flexible query language to leverage this dimensionality
  • no dependency on distributed storage; single server nodes are autonomous
  • timeseries collection happens via a pull model over HTTP
  • pushing timeseries is supported via an intermediary gateway
  • targets are discovered via service discovery or static configuration
  • multiple modes of graphing and dashboarding support
  • support for hierarchical and horizontal federation

架构图

使用 docker 安装和配置

使用 docker 运行 prometheus

docker run --name prometheus -d -p 127.0.0.1:9090:9090 prom/prometheus

查看容器,可以看到正在运行

# docker container list
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                      NAMES
440be3a7a726        prom/prometheus     "/bin/prometheus --c…"   45 seconds ago      Up 42 seconds       127.0.0.1:9090->9090/tcp   prometheus

此时打开 http://localhost:9090 即可访问。

当然,你也可以配置一个 nginx 代理,在公网用域名通过默认端口访问。

server {
    listen 80;
    server_name prometheus.yourdomain.com;
    client_max_body_size 5m;
    location / {
        proxy_pass http://localhost:9090;
    }
}

加载 nginx 配置,打开网页,可以看到: 33665-gg3e4ndus27.png

标签: none

添加新评论