prometheus definition ¶
Contents
English wikipedia definition ¶
Prometheus is an open-source software project written in Go that is used to record real-time metrics in a time series database (allowing for high dimensionality) built using a HTTP pull model, with flexible queries and real-time alerting.
The project is licensed under the Apache 2 License, with source code available on GitHub, and is a graduated project of the Cloud Native Computing Foundation, along with Kubernetes and Envoy.
Architecture ¶
A typical monitoring platform with Prometheus is composed of multiple tools:
-
Multiple exporters that typically run on the monitored host to export local metrics.
-
Prometheus to centralize and store the metrics.
-
Alertmanager to trigger alerts based on those metrics.
-
PromQL is the query language used to create dashboard and alerts.
Data storage format ¶
Prometheus data is stored in the form of metrics, with each metric having a name that is used for referencing and querying it.
Each metric can be drilled down by an arbitrary number of labels.
Labels can include information on the data source (which server the data is coming from) and other application-specific breakdown information such as the HTTP status code (for metrics related to HTTP responses), query method (GET versus POST), endpoint, etc.
The ability to specify an arbitrary list of labels and to query based on these in real time is why Prometheus’ data model is called multi-dimensional.
Prometheus stores data locally on disk, which helps for fast data storage and fast querying.
Data collection ¶
Prometheus collects data in the form of time series .
The time series are built through a pull model: the Prometheus server queries a list of data sources (sometimes called exporters) at a specific polling frequency. Each of the data sources serves the current values of the metrics for that data source at the endpoint queried by Prometheus.
The Prometheus server then aggregates data across the data sources.
Prometheus has a number of mechanisms to automatically discover resources that it should be using as data sources.
Alerts and monitoring ¶
Configuration for alerts can be specified in Prometheus that specifies a condition that needs to be maintained for a specific duration in order for an alert to trigger.
When alerts trigger, they are forwarded to Alertmanager, another Prometheus service.
Alertmanager can include logic to silence alerts and also to forward them to email, Slack, or notification services such as PagerDuty.
Dashboards ¶
See also
Prometheus is not intended as a dashboarding solution.
Although it can be used to graph specific queries, it is not a full-fledged dashboarding solution and needs to be hooked up with Grafana to generate dashboards; this has been cited as a disadvantage due to the additional setup complexity.
Interoperability ¶
Prometheus favors white-box monitoring.
Applications are encouraged to publish (export) internal metrics to be collected periodically by Prometheus.
Some exporters and agents for various applications are available to provide metrics.
Prometheus supports some monitoring and administration protocols to allow interoperability for transitioning: Graphite, StatsD, SNMP, JMX, and CollectD.
Prometheus focuses on the availability of the platform and basic operations.
The metrics are typically stored for few weeks. For long term storage, the metrics can be migrated to a third-party databases like Cortex, CrateDB, InfluxDB, PostgreSQL/TimescaleDB , etc.
Prometheus ¶
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’ 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.11 or greater installed .
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
You can also clone the repository yourself and build using
make
:
$ 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
andpromtool
binaries -
test : run the tests
-
test-short : run the short tests
-
format : format the source code
-
vet : check the source code for common errors
-
assets : rebuild the static assets
-
docker : build a docker container for the current
HEAD
More information ¶
-
The source code is periodically indexed: Prometheus Core .
-
You will find a Travis CI configuration in
.travis.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 .