Prometheus

普罗米修斯监测系统和时间序列数据库。(The Prometheus monitoring system and time series database.)

Github stars Tracking Chart

Prometheus(普罗米修斯)

访问 prometheus.io 查看完整文档、示例和指南。

Prometheus 是云原生计算基金会的一个项目,是一个系统和服务监控系统。它以给定的时间间隔收集配置目标的指标,评估规则表达式,显示结果,如果观察到某些条件为真,可以触发警报。

与其他监测系统相比,普罗米修斯的主要特点是:

  • 多维数据模型(由度量名称和一组键/值维定义的时间序列)
  • PromQL 是一种 强大而灵活的查询语言,可以利用这种维度
  • 不依赖于分布式存储;单服务器节点是自治的
  • 时间序列收集通过 HTTP 拉模式进行
  • 推送时间序列是通过中间网关支持的
  • 通过服务发现静态配置发现目标
  • 多种图形和仪表板支持模式
  • 支持分层和横向联合

体系结构概述

安装

安装 Prometheus 有多种方式。

预编译的二进制文件

已发布版本的预编译二进制文件可以在 prometheus.io 上的 下载 部分获得。使用最新的生产版本二进制文件是安装 Prometheus 的推荐方式。请参阅文档中的安装章节了解所有细节。

预编译的二进制文件

已发布版本的预编译二进制文件可在 prometheus.io 的下载部分获得。使用最新的生产版本二进制文件是安装 Prometheus 的推荐方式。请参阅文档中的安装章节了解所有细节。

Docker 镜像

Docker镜像可在 Quay.ioDocker Hub 上获得。

你可以启动一个普罗米修斯容器来试用它,使用

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

现在可以通过 http://localhost:9090/ 访问Prometheus。

从源代码构建

要自己从源码中构建 Prometheus,你需要安装一个 1.13 或更高版本的 Go 环境。你还需要安装 Node.jsYarn 来构建前端资产。

你可以直接使用 go 工具下载并安装 prometheus 和 promtool 二进制文件到你的 GOPATH 中。

$ go get github.com/prometheus/prometheus/cmd/...
$ prometheus --config.file = your_config.yml

然而,当使用 go get 来构建 Prometheus 时,Prometheus 将期望能够从 web/ui/static 和 web/ui/templates 下的本地文件系统目录中读取其 web 资产。为了让这些资产被找到,你必须从克隆的仓库的根目录下运行 Prometheus。还需要注意的是,这些目录不包括新的实验性 React UI,除非它已经被明确地使用 make assets 或 make build 构建。

上述配置文件的例子可以在这里找到。

你也可以自己克隆版本库,然后使用 make build 进行构建,这将会编译到 web assets 中,这样 Prometheus 就可以从任何地方运行。

$ mkdir -p $GOPATH/src/github.com/prometheus
$ cd $GOPATH/src/github.com/prometheus
$ git clone https://github.com/prometheus/prometheus.git
$ cd prometheus
$ make build
$ ./prometheus --config.file=your_config.yml

Makefile 提供了几个目标:

  • build:构建 prometheus 和 promtool 二进制文件
  • test:运行测试
  • test-short:运行简短测试
  • format:格式化源代码
  • vet:检查源代码中的常见错误
  • assets:重建静态资产
  • docker:为当前的 HEAD 构建一个 docker 容器

React UI 开发

有关在新的基于 React 的 UI 上构建、运行和开发的更多信息,请参阅 React 应用程序的 README.md

更多资讯

  • 源代码定期编入索引:Prometheus Core
  • 您将在 .travis.yml 中找到 Travis CI 配置。
  • 请参阅 社区页面,了解如何联络 Prometheus 开发人员和各种沟通渠道的用户。

贡献

请参阅 CONTRIBUTING.md

许可证

Apache License 2.0,请参阅 许可证

(The first version translated by vz on 2020.10.07)

Overview

Name With Ownerprometheus/prometheus
Primary LanguageGo
Program languageMakefile (Language Count: 11)
PlatformBSD, Docker, Linux, Mac, Windows
License:Apache License 2.0
Release Count392
Last Release Namev2.51.2 (Posted on 2024-04-10 15:03:36)
First Release Nameall-tests-pass (Posted on )
Created At2012-11-24 11:14:12
Pushed At2024-04-15 15:53:42
Last Commit At
Stargazers Count52.6k
Watchers Count1.1k
Fork Count8.7k
Commits Count12.7k
Has Issues Enabled
Issues Count5506
Issue Open Count749
Pull Requests Count5966
Pull Requests Open Count177
Pull Requests Close Count1802
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

Prometheus

CircleCI
Docker Repository on Quay
Docker Pulls
Go Report Card
CII Best Practices
fuzzit

Visit prometheus.io for the full documentation,
examples and guides.

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's 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

Architecture overview

Install

There are various ways of installing Prometheus.

Precompiled binaries

Precompiled binaries for released versions are available in the
download section
on prometheus.io. Using the latest production release binary
is the recommended way of installing Prometheus.
See the Installing
chapter in the documentation for all the details.

Debian packages are available.

Docker images

Docker images are available on Quay.io or Docker Hub.

You can launch a Prometheus container for trying it out with

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

Prometheus will now be reachable at http://localhost:9090/.

Building from source

To build Prometheus from the source code yourself you need to have a working
Go environment with version 1.13 or greater installed.
You will also need to have Node.js and Yarn
installed in order to build the frontend assets.

You can directly use the go tool to download and install the prometheus
and promtool binaries into your GOPATH:

$ go get github.com/prometheus/prometheus/cmd/...
$ prometheus --config.file=your_config.yml

However, when using go get to build Prometheus, Prometheus will expect to be able to
read its web assets from local filesystem directories under web/ui/static and
web/ui/templates. In order for these assets to be found, you will have to run Prometheus
from the root of the cloned repository. Note also that these directories do not include the
new experimental React UI unless it has been built explicitly using make assets or make build.

An example of the above configuration file can be found here.

You can also clone the repository yourself and build using make build, which will compile in
the web assets so that Prometheus can be run from anywhere:

$ mkdir -p $GOPATH/src/github.com/prometheus
$ cd $GOPATH/src/github.com/prometheus
$ git clone https://github.com/prometheus/prometheus.git
$ cd prometheus
$ make build
$ ./prometheus --config.file=your_config.yml

The Makefile provides several targets:

  • build: build the prometheus and promtool binaries (includes building and compiling in web assets)
  • test: run the tests
  • test-short: run the short tests
  • format: format the source code
  • vet: check the source code for common errors
  • docker: build a docker container for the current HEAD

React UI Development

For more information on building, running, and developing on the new React-based UI, see the React app's README.md.

More information

  • The source code is periodically indexed: Prometheus Core.
  • You will find a CircleCI configuration in .circleci/config.yml.
  • See the Community page for how to reach the Prometheus developers and users on various communication channels.

Contributing

Refer to CONTRIBUTING.md

License

Apache License 2.0, see LICENSE.

To the top