$linuxjunkies
>

prometheus(8)

Prometheus is a time-series database and monitoring system that collects metrics from applications and infrastructure.

UbuntuDebianFedoraArch

Synopsis

prometheus [OPTION]...

Description

Prometheus is an open-source systems monitoring and alerting toolkit. It scrapes metrics from instrumented jobs at given intervals, evaluates alert rules, and can trigger alerts when conditions are met. Metrics are stored in a local time-series database.

Prometheus works by periodically scraping HTTP endpoints that expose metrics in a standardized text format. It stores these metrics with timestamps and allows querying via its expression language (PromQL) and web UI.

Common options

FlagWhat it does
--config.file=PATHYAML configuration file path (default: prometheus.yml)
--storage.tsdb.path=PATHDirectory for time-series database storage (default: data/)
--storage.tsdb.retention.time=DURATIONData retention period, e.g. 30d or 1y (default: 15d)
--web.listen-address=ADDR:PORTHTTP server listen address (default: 127.0.0.1:9090)
--web.enable-lifecycleEnable HTTP endpoints for admin tasks (reload, quit)
--query.max-samples=NMaximum number of samples a query can process (default: 50000000)
--scrape.adjust-timestampsAdjust metric timestamps to scrape timestamp if they differ
--log.level=LEVELLog level: debug, info, warn, error (default: info)

Examples

Start Prometheus with specified config file and default storage path

prometheus --config.file=prometheus.yml

Start Prometheus listening on all interfaces, production-style configuration

prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus --web.listen-address=0.0.0.0:9090

Start Prometheus keeping 90 days of historical data

prometheus --storage.tsdb.retention.time=90d --config.file=prometheus.yml

Enable admin endpoints to reload configuration without restarting via /-/reload

prometheus --config.file=prometheus.yml --web.enable-lifecycle

Query Prometheus API for the 'up' metric (returns JSON)

curl http://localhost:9090/api/v1/query?query=up

Reload Prometheus configuration without restart (requires --web.enable-lifecycle)

curl -X POST http://localhost:9090/-/reload

Related commands