Prometheus: The Monitoring System and Time Series Database
Summary
Prometheus is an open-source systems and service monitoring system, part of the Cloud Native Computing Foundation. It excels at collecting metrics as time series data, evaluating rule expressions, and triggering alerts. Its multi-dimensional data model and powerful PromQL query language make it a robust choice for modern observability needs.
Repository Info
Tags
Click on any tag to explore related repositories
Introduction
Prometheus is a leading open-source systems and service monitoring system, proudly a project of the Cloud Native Computing Foundation (CNCF). It is designed to collect metrics from configured targets at specified intervals, evaluate rule expressions, display the results, and trigger alerts when predefined conditions are met. Written in Go, Prometheus offers a robust solution for modern observability challenges.
Key features that set Prometheus apart include its multi-dimensional data model, where time series are defined by a metric name and a set of key/value dimensions. It also boasts PromQL, a powerful and flexible query language tailored to leverage this dimensionality, and operates autonomously without dependency on distributed storage.
Installation
Prometheus offers several straightforward installation methods to get you started:
Precompiled Binaries
The recommended way to install Prometheus is by using the latest production release precompiled binaries. These are available for download on the official Prometheus website.
- Download Section: https://prometheus.io/download/
- Installation Guide: https://prometheus.io/docs/introduction/install/
Docker Images
Docker images provide a quick way to run Prometheus, ideal for testing or containerized environments. Images are available on Quay.io and Docker Hub.
To launch a Prometheus container for a quick try-out:
docker run --name prometheus -d -p 127.0.0.1:9090:9090 prom/prometheus
Prometheus will then be accessible in your browser at http://localhost:9090/.
- Quay.io Repository: https://quay.io/repository/prometheus/prometheus
- Docker Hub Repository: https://hub.docker.com/r/prom/prometheus/
Building from Source
For those who prefer to build from source, Prometheus requires Go (version specified in go.mod or greater), NodeJS (version specified in .nvmrc or greater), and npm (version 8 or greater).
- Clone the repository:
git clone https://github.com/prometheus/prometheus.git cd prometheus - Build using
make build: This command compiles theprometheusandpromtoolbinaries, including web assets, allowing Prometheus to be run from anywhere.
An example configuration file can be found here.make build ./prometheus --config.file=your_config.yml
Examples
A simple way to see Prometheus in action is by running its Docker image and accessing its web UI.
docker run --name prometheus -d -p 127.0.0.1:9090:9090 prom/prometheus
Once running, navigate to http://localhost:9090/ in your browser. You can then configure Prometheus using a prometheus.yml file to scrape metrics from targets. An example configuration is available in the repository's documentation: Example prometheus.yml.
Why Use Prometheus
Prometheus stands out due to its unique architectural design and powerful feature set, making it an excellent choice for monitoring modern, dynamic infrastructures:
- Multi-dimensional Data Model: Time series are identified by metric name and key/value pairs, enabling rich and flexible data representation.
- PromQL: A highly powerful and flexible query language specifically designed to leverage the multi-dimensional nature of Prometheus data.
- Autonomous Single Server Nodes: No dependency on distributed storage, allowing single server nodes to operate independently and simplify deployment.
- HTTP Pull Model: Metrics are collected via an HTTP pull model, making it easy to integrate with existing services.
- Push Gateway Support: For ephemeral or batch jobs, time series can be pushed via an intermediary gateway.
- Service Discovery: Targets can be discovered automatically through various service discovery mechanisms or static configuration.
- Graphing and Dashboarding: Multiple modes of graphing and dashboarding support are available, including integration with Grafana.
- Federation Support: Supports both hierarchical and horizontal federation for scaling and organizational needs.
Links
- GitHub Repository: https://github.com/prometheus/prometheus
- Official Website: https://prometheus.io
- Official Documentation: https://prometheus.io/docs/
- GoDoc Documentation: https://pkg.go.dev/github.com/prometheus/prometheus