1. Project Overview & Quickstart (prometheus/node_exporter)
File: README.md
Node exporter
Prometheus exporter for hardware and OS metrics exposed by *NIX kernels, written
in Go with pluggable metric collectors.
The Windows exporter is recommended for Windows users.
To expose NVIDIA GPU metrics, prometheus-dcgm
can be used.
Installation and Usage
If you are new to Prometheus and node_exporter there is a simple step-by-step guide.
The node_exporter listens on HTTP port 9100 by default. See the --help output for more options.
Linux distribution packages
On Enterprise Linux (RHEL, CentOS Stream, Rocky Linux, AlmaLinux) and Fedora, node_exporter is packaged in EPEL as golang-github-prometheus-node-exporter (available for EPEL 7, 8 and 9):
Ansible
For automated installs with Ansible, there is the Prometheus Community role.
Docker
The node_exporter is designed to monitor the host system. Deploying in containers requires
extra care in order to avoid monitoring the container itself.
For situations where containerized deployment is needed, some extra flags must be used to allow
the node_exporter access to the host namespaces.
Be aware that any non-root mount points you want to monitor will need to be bind-mounted
into the container.
If you start container for host monitoring, specify path.rootfs argument.
This argument must match path in bind-mount of host root. The node_exporter will usepath.rootfs as prefix to access host filesystem.
docker run -d \
--net="host" \
--pid="host" \
-v "/:/host:ro,rslave" \
quay.io/prometheus/node-exporter:latest \
--path.rootfs=/hostFor Docker compose, similar flag changes are needed.
---
version: '3.8'
services:
node_exporter:
image: quay.io/prometheus/node-exporter:latest
container_name: node_exporter
command:
- '--path.rootfs=/host'
network_mode: host
pid: host
restart: unless-stopped
volumes:
- '/:/host:ro,rslave'On some systems, the timex collector requires an additional Docker flag,--cap-add=SYS_TIME, in order to access the required syscalls.
Collectors
There is varying support for collectors on each operating system. The tables
below list all existing collectors and the supported systems.
Collectors are enabled by providing a --collector.<name> flag.
Collectors that are enabled by default can be disabled by providing a --no-collector.<name> flag.
To enable only some specific collector(s), use --collector.disable-defaults --collector.<name> ....
Include & Exclude flags
A few collectors can be configured to include or exclude certain patterns using dedicated flags. The exclude flags are used to indicate "all except", while the include flags are used to say "none except". Note that these flags are mutually exclusive on collectors that support both.
Example:
--collector.filesystem.mount-points-exclude=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/.+)($|/)List:
| Collector | Scope | Include Flag | Exclude Flag |
|---|---|---|---|
| arp | device | --collector.arp.device-include | --collector.arp.device-exclude |
| cpu | bugs | --collector.cpu.info.bugs-include | N/A |
| cpu | flags | --collector.cpu.info.flags-include | N/A |
| diskstats | device | --collector.diskstats.device-include | --collector.diskstats.device-exclude |
| ethtool | device | --collector.ethtool.device-include | --collector.ethtool.device-exclude |
| ethtool | metrics | --collector.ethtool.metrics-include | N/A |
| filesystem | fs-types | --collector.filesystem.fs-types-include | --collector.filesystem.fs-types-exclude |
| filesystem | mount-points | --collector.filesystem.mount-points-include | --collector.filesystem.mount-points-exclude |
| hwmon | chip | --collector.hwmon.chip-include | --collector.hwmon.chip-exclude |
| hwmon | sensor | --collector.hwmon.sensor-include | --collector.hwmon.sensor-exclude |
| infiniband | device | --collector.infiniband.device-include | --collector.infiniband.device-exclude |
| interrupts | name | --collector.interrupts.name-include | --collector.interrupts.name-exclude |
| netdev | device | --collector.netdev.device-include | --collector.netdev.device-exclude |
| qdisc | device | --collector.qdisc.device-include | --collector.qdisc.device-exclude |
| slabinfo | slab-names | --collector.slabinfo.slabs-include | --collector.slabinfo.slabs-exclude |
| sysctl | all | --collector.sysctl.include | N/A |
| systemd | unit | --collector.systemd.unit-include | --collector.systemd.unit-exclude |
Enabled by default
| Name | Description | OS |
|---|---|---|
| arp | Exposes ARP statistics from /proc/net/arp. |
Linux |
| bcache | Exposes bcache statistics from /sys/fs/bcache/. |
Linux |
| bonding | Exposes the number of configured and active slaves of Linux bonding interfaces. | Linux |
| btrfs | Exposes btrfs statistics | Linux |
| boottime | Exposes system boot time derived from the kern.boottime sysctl. |
Darwin, Dragonfly, FreeBSD, NetBSD, OpenBSD, Solaris |
| conntrack | Shows conntrack statistics (does nothing if no /proc/sys/net/netfilter/ present). |
Linux |
| cpu | Exposes CPU statistics | Darwin, Dragonfly, FreeBSD, Linux, Solaris, OpenBSD |
| cpufreq | Exposes CPU frequency statistics | Linux, Solaris |
| diskstats | Exposes disk I/O statistics. | Darwin, Linux, OpenBSD |
| dmi | Expose Desktop Management Interface (DMI) info from /sys/class/dmi/id/ |
Linux |
| dmmultipath | Exposes DM-multipath device and path metrics from /sys/block/dm-*. |
Linux |
| edac | Exposes error detection and correction statistics. | Linux |
| entropy | Exposes available entropy. | Linux |
| exec | Exposes execution statistics. | Dragonfly, FreeBSD |
| fibrechannel | Exposes fibre channel information and statistics from /sys/class/fc_host/. |
Linux |
| filefd | Exposes file descriptor statistics from /proc/sys/fs/file-nr. |
Linux |
| filesystem | Exposes filesystem statistics, such as disk space used. | Darwin, Dragonfly, FreeBSD, Linux, OpenBSD |
| hwmon | Expose hardware monitoring and sensor data from /sys/class/hwmon/. |
Linux |
| infiniband | Exposes network statistics specific to InfiniBand and Intel OmniPath configurations. | Linux |
| ipvs | Exposes IPVS status from /proc/net/ip_vs and stats from /proc/net/ip_vs_stats. |
Linux |
| kernel_hung | Exposes number of tasks that have been detected as hung from /proc/sys/kernel/hung_task_detect_count. |
Linux |
| loadavg | Exposes load average. | Darwin, Dragonfly, FreeBSD, Linux, NetBSD, OpenBSD, Solaris |
| mdadm | Exposes statistics about devices in /proc/mdstat (does nothing if no /proc/mdstat present). |
Linux |
| meminfo | Exposes memory statistics. | Darwin, Dragonfly, FreeBSD, Linux, OpenBSD |
| netclass | Exposes network interface info from /sys/class/net/ |
Linux |
| netdev | Exposes network interface statistics such as bytes transferred. | Darwin, Dragonfly, FreeBSD, Linux, OpenBSD |
| netisr | Exposes netisr statistics | FreeBSD |
| netstat | Exposes network statistics from /proc/net/netstat. This is the same information as netstat -s. |
Linux |
| nfs | Exposes NFS client statistics from /proc/net/rpc/nfs. This is the same information as nfsstat -c. |
Linux |
| nfsd | Exposes NFS kernel server statistics from /proc/net/rpc/nfsd. This is the same information as nfsstat -s. |
Linux |
| nvme | Exposes NVMe info from /sys/class/nvme/ |
Linux |
| os | Expose OS release info from /etc/os-release or /usr/lib/os-release |
any |
| powersupplyclass | Exposes Power Supply statistics from /sys/class/power_supply |
Linux |
| pressure | Exposes pressure stall statistics from /proc/pressure/. |
Linux (kernel 4.20+ and/or CONFIG_PSI) |
| rapl | Exposes various statistics from /sys/class/powercap. |
Linux |
| schedstat | Exposes task scheduler statistics from /proc/schedstat. |
Linux |
| selinux | Exposes SELinux statistics. | Linux |
| sockstat | Exposes various statistics from /proc/net/sockstat. |
Linux |
| softnet | Exposes statistics from /proc/net/softnet_stat. |
Linux |
| stat | Exposes various statistics from /proc/stat. This includes boot time, forks and interrupts. |
Linux |
| tapestats | Exposes statistics from /sys/class/scsi_tape. |
Linux |
| textfile | Exposes statistics read from local disk. The --collector.textfile.directory flag must be set. |
any |
| thermal | Exposes thermal statistics like pmset -g therm. |
Darwin |
| thermal_zone | Exposes thermal zone & cooling device statistics from /sys/class/thermal. |
Linux |
| time | Exposes the current system time. | any |
| timex | Exposes selected adjtimex(2) system call stats. | Linux |
| udp_queues | Exposes UDP total lengths of the rx_queue and tx_queue from /proc/net/udp and /proc/net/udp6. |
Linux |
| uname | Exposes system information as provided by the uname system call. | Darwin, FreeBSD, Linux, OpenBSD |
| vmstat | Exposes statistics from /proc/vmstat. |
Linux |
| watchdog | Exposes statistics from /sys/class/watchdog |
Linux |
| xfs | Exposes XFS runtime statistics. | Linux (kernel 4.4+) |
| zfs | Exposes ZFS performance statistics. | FreeBSD, Linux, Solaris |
Disabled by default
node_exporter also implements a number of collectors that are disabled by default. Reasons for this vary by
collector, and may include:
- High cardinality
- Prolonged runtime that exceeds the Prometheus
scrape_intervalorscrape_timeout - Significant resource demands on the host
You can enable additional collectors as desired by adding them to your
init system's or service supervisor's startup configuration fornode_exporter but caution is advised. Enable at most one at a time,
testing first on a non-production system, then by hand on a single
production node. When enabling additional collectors, you should
carefully monitor the change by observing the scrape_duration_seconds metric to ensure that collection completes
and does not time out. In addition, monitor thescrape_samples_post_metric_relabeling metric to see the changes in
cardinality.
| Name | Description | OS |
|---|---|---|
| buddyinfo | Exposes statistics of memory fragments as reported by /proc/buddyinfo. | Linux |
| cgroups | A summary of the number of active and enabled cgroups | Linux |
| cpu_vulnerabilities | Exposes CPU vulnerability information from sysfs. | Linux |
| devstat | Exposes device statistics | Dragonfly, FreeBSD |
| drm | Expose GPU metrics using sysfs / DRM, amdgpu is the only driver which exposes this information through DRM |
Linux |
| drbd | Exposes Distributed Replicated Block Device statistics (to version 8.4) | Linux |
| ethtool | Exposes network interface information and network driver statistics equivalent to ethtool, ethtool -S, and ethtool -i. |
Linux |
| interrupts | Exposes detailed interrupts statistics. | Linux, OpenBSD |
| ksmd | Exposes kernel and system statistics from /sys/kernel/mm/ksm. |
Linux |
| lnstat | Exposes stats from /proc/net/stat/. |
Linux |
| logind | Exposes session counts from logind. | Linux |
| meminfo_numa | Exposes memory statistics from /sys/devices/system/node/node[0-9]*/meminfo, /sys/devices/system/node/node[0-9]*/numastat. |
Linux |
| mountstats | Exposes filesystem statistics from /proc/self/mountstats. Exposes detailed NFS client statistics. |
Linux |
| network_route | Exposes the routing table as metrics | Linux |
| nvmesubsystem | Exposes NVMe over Fabrics subsystem path health metrics from /sys/class/nvme-subsystem/. |
Linux |
| pcidevice | Exposes pci devices' information including their link status and parent devices. | Linux |
| perf | Exposes perf based metrics (Warning: Metrics are dependent on kernel configuration and settings). | Linux |
| processes | Exposes aggregate process statistics from /proc. |
Linux |
| qdisc | Exposes queuing discipline statistics | Linux |
| slabinfo | Exposes slab statistics from /proc/slabinfo. Note that permission of /proc/slabinfo is usually 0400, so set it appropriately. |
Linux |
| softirqs | Exposes detailed softirq statistics from /proc/softirqs. |
Linux |
| sysctl | Expose sysctl values from /proc/sys. Use --collector.sysctl.include(-info) to configure. |
Linux |
| swap | Expose swap information from /proc/swaps. |
Linux |
| systemd | Exposes service and system status from systemd. | Linux |
| tcpstat | Exposes TCP connection status information from /proc/net/tcp and /proc/net/tcp6. (Warning: the current version has potential performance issues in high load situations.) |
Linux |
| wifi | Exposes WiFi device and station statistics. | Linux |
| xfrm | Exposes statistics from /proc/net/xfrm_stat |
Linux |
| zoneinfo | Exposes NUMA memory zone metrics. | Linux |
Deprecated
These collectors are deprecated and will be removed in the next major release.
| Name | Description | OS |
|---|---|---|
| ntp | Exposes local NTP daemon health to check time | any |
| runit | Exposes service status from runit. | any |
| supervisord | Exposes service status from supervisord. | any |
Perf Collector
The perf collector may not work out of the box on some Linux systems due to kernel
configuration and security settings. To allow access, set the following sysctl
parameter:
sysctl -w kernel.perf_event_paranoid=X- 2 allow only user-space measurements (default since Linux 4.6).
- 1 allow both kernel and user measurements (default before Linux 4.6).
- 0 allow access to CPU-specific data but not raw tracepoint samples.
- -1 no restrictions.
Depending on the configured value different metrics will be available, for most
cases 0 will provide the most complete set. For more information see man 2 perf_event_open.
By default, the perf collector will only collect metrics of the CPUs thatnode_exporter is running on (ieruntime.NumCPU. If this is
insufficient (e.g. if you run node_exporter with its CPU affinity set to
specific CPUs), you can specify a list of alternate CPUs by using the--collector.perf.cpus flag. For example, to collect metrics on CPUs 2-6, you
would specify: --collector.perf --collector.perf.cpus=2-6. The CPU
configuration is zero indexed and can also take a stride value; e.g.--collector.perf --collector.perf.cpus=1-10:5 would collect on CPUs
1, 5, and 10.
The perf collector is also able to collect
tracepoint
counts when using the --collector.perf.tracepoint flag. Tracepoints can be
found using perf list or
from debugfs. And example usage of this would be--collector.perf.tracepoint="sched:sched_process_exec".
Sysctl Collector
The sysctl collector can be enabled with --collector.sysctl. It supports exposing numeric sysctl values
as metrics using the --collector.sysctl.include flag and string values as info metrics by using the--collector.sysctl.include-info flag. The flags can be repeated. For sysctl with multiple numeric values,
an optional mapping can be given to expose each value as its own metric. Otherwise an index label is used
to identify the different fields.
Examples
Numeric values
Single values
Using --collector.sysctl.include=vm.user_reserve_kbytes:vm.user_reserve_kbytes = 131072 -> node_sysctl_vm_user_reserve_kbytes 131072
Multiple values
A sysctl can contain multiple values, for example:
net.ipv4.tcp_rmem = 4096 131072 6291456Using --collector.sysctl.include=net.ipv4.tcp_rmem the collector will expose:
node_sysctl_net_ipv4_tcp_rmem{index="0"} 4096
node_sysctl_net_ipv4_tcp_rmem{index="1"} 131072
node_sysctl_net_ipv4_tcp_rmem{index="2"} 6291456If the indexes have defined meaning like in this case, the values can be mapped to multiple metrics by appending the mapping to the --collector.sysctl.include flag:
Using --collector.sysctl.include=net.ipv4.tcp_rmem:min,default,max the collector will expose:
node_sysctl_net_ipv4_tcp_rmem_min 4096
node_sysctl_net_ipv4_tcp_rmem_default 131072
node_sysctl_net_ipv4_tcp_rmem_max 6291456String values
String values need to be exposed as info metric. The user selects them by using the --collector.sysctl.include-info flag.
Single values
kernel.core_pattern = core -> node_sysctl_info{key="kernel.core_pattern_info", value="core"} 1
Multiple values
Given the following sysctl:
kernel.seccomp.actions_avail = kill_process kill_thread trap errno trace log allowSetting --collector.sysctl.include-info=kernel.seccomp.actions_avail will yield:
node_sysctl_info{key="kernel.seccomp.actions_avail", index="0", value="kill_process"} 1
node_sysctl_info{key="kernel.seccomp.actions_avail", index="1", value="kill_thread"} 1
...Textfile Collector
The textfile collector is similar to the Pushgateway,
in that it allows exporting of statistics from batch jobs. It can also be used
to export static metrics, such as what role a machine has. The Pushgateway
should be used for service-level metrics. The textfile module is for metrics
that are tied to a machine.
To use it, set the --collector.textfile.directory flag on the node_exporter commandline. The
collector will parse all files in that directory matching the glob *.prom
using the text
format. Note: Timestamps are not supported.
To atomically push completion time for a cron job:
echo my_batch_job_completion_time $(date +%s) > /path/to/directory/my_batch_job.prom.$$
mv /path/to/directory/my_batch_job.prom.$$ /path/to/directory/my_batch_job.promTo statically set roles for a machine using labels:
echo 'role{role="application_server"} 1' > /path/to/directory/role.prom.$$
mv /path/to/directory/role.prom.$$ /path/to/directory/role.promFiltering enabled collectors
The node_exporter will expose all metrics from enabled collectors by default. This is the recommended way to collect metrics to avoid errors when comparing metrics of different families.
For advanced use the node_exporter can be passed an optional list of collectors to filter metrics. The parameters collect[] and exclude[] can be used multiple times (but cannot be combined). In Prometheus configuration you can use this syntax under the scrape config.
Collect only cpu and meminfo collector metrics:
params:
collect[]:
- cpu
- meminfoCollect all enabled collector metrics but exclude netdev:
params:
exclude[]:
- netdevThis can be useful for having different Prometheus servers collect specific metrics from nodes.
Development building and running
Prerequisites:
- Go compiler
- RHEL/CentOS:
glibc-staticpackage.
Building:
git clone https://github.com/prometheus/node_exporter.git
cd node_exporter
make build
./node_exporter <flags>To see all available configuration flags:
./node_exporter -hRunning tests
make testTLS endpoint
EXPERIMENTAL
The exporter supports TLS via a new web configuration file.
./node_exporter --web.config.file=web-config.ymlSee the exporter-toolkit web-configuration for more details.
File: docs/node-mixin/README.md
Node Mixin
This is a work in progress. We aim for it to become a good role model for alerts
and dashboards eventually, but it is not quite there yet.
The Node Mixin is a set of configurable, reusable, and extensible alerts and
dashboards based on the metrics exported by the Node Exporter. The mixin creates
recording and alerting rules for Prometheus and suitable dashboard descriptions
for Grafana.
To use them, you need to have jsonnet (v0.16+) and jb installed. If you
have a working Go development environment, it's easiest to run the following:
go install github.com/google/go-jsonnet/cmd/jsonnet@latest
go install github.com/google/go-jsonnet/cmd/jsonnetfmt@latest
go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latestNext, install the dependencies by running the following command in this
directory:
jb installYou can then build the Prometheus rules files node_alerts.yaml andnode_rules.yaml:
make node_alerts.yaml node_rules.yamlYou can also build a directory dashboard_out with the JSON dashboard files
for Grafana:
make dashboards_outNote that some of the generated dashboards require recording rules specified in
the previously generated node_rules.yaml.
For more advanced uses of mixins, see
https://github.com/monitoring-mixins/docs.
File: docs/TIME.md
Monitoring time sync with node_exporter
`timex` collector
This collector exports state of kernel time synchronization flag that should be
maintained by time-keeping daemon and is eventually raised by Linux kernel if
time-keeping daemon does not update it regularly.
Unfortunately some daemons do not handle this flag properly, e.g. chrony-1.30
from Debian/jessie clears STA_UNSYNC flag during daemon initialisation and
does not indicate clock synchronization status using this flag. Modern chrony
versions should work better. All chrony versions require rtcsync option to
maintain this flag. OpenNTPD does not touch this flag at all till
OpenNTPD-5.9p1.
On the other hand combination of sync_status and offset exported by timex
module is the way to monitor if systemd-timesyncd does its job.
`ntp` collector
NOTE: This collector is deprecated and will be removed in the next major version release.
This collector is intended for usage with local NTP daemons including ntp.org, chrony, and OpenNTPD.
Note, some chrony packages have local stratum 10 configuration value making chrony a valid server when it is unsynchronised. This configuration makes one of the heuristics that derive node_ntp_sanity unreliable.
Note, OpenNTPD does not listen for SNTP queries by default. Add listen on 127.0.0.1 to the OpenNTPD configuration when using this collector with that package.
`node_ntp_stratum`
This metric shows the stratum of the local NTP daemon.
Stratum 16 means that clock are unsynchronised. See also aforementioned note about default local stratum in chrony.
`node_ntp_leap`
Raw leap flag value. 0 โ OK, 1 โ add leap second at UTC midnight, 2 โ delete leap second at UTC midnight, 3 โ unsynchronised.
OpenNTPD ignores leap seconds and never sets leap flag to 1 or 2.
`node_ntp_rtt`
RTT (round-trip time) from node_exporter collector to local NTPD. This value is
used in sanity check as part of causality violation estimate.
`node_ntp_offset`
Clock offset between local time and NTPD time.
ntp.org always sets NTPD time to local clock instead of relaying remote NTP
time, so this offset is irrelevant for this NTPD.
This value is used in sanity check as part of causality violation estimate.
`node_ntp_reference_timestamp_seconds`
Reference Time. This field show time when the last adjustment was made, but
implementation details vary from "local wall-clock time" to "Reference Time
field in incoming SNTP packet".
time() - node_ntp_reference_timestamp_seconds andnode_time_seconds - node_ntp_reference_timestamp_seconds represent some estimate of
"freshness" of synchronization.
`node_ntp_root_delay` and `node_ntp_root_dispersion`
These values are used to calculate synchronization distance that is limited bycollector.ntp.max-distance.
ntp.org adds known local offset to announced root dispersion and linearly
increases dispersion in case of NTP connectivity problems, OpenNTPD does not
account dispersion at all and always reports 0.
`node_ntp_sanity`
Aggregate NTPD health including stratum, leap flag, sane freshness, root
distance being less than collector.ntp.max-distance and causality violation
being less than collector.ntp.local-offset-tolerance.
Causality violation is lower bound estimate of clock error done using SNTP,
it's calculated as positive portion of abs(node_ntp_offset) - node_ntp_rtt / 2.
File: docs/V0_16_UPGRADE_GUIDE.md
Version 0.16.0 Upgrade Guide
The node_exporter 0.16.0 and newer renamed many metrics in order to conform with Prometheus naming best practices.
In order to allow easy upgrades, there are several options.
Update dashboards
Grafana users can add multiple queries in order to display both the old and new data simultaneously.
Use recording rules
We have provided a sample recording rule set that translates old metrics to new ones and the one that translates new metrics format to old one to create duplicate metrics (it translates "old" metrics format to new one). This has a minor disadvantage that it creates a lot of extra data, and re-aligns the timestamps of the data.
Run both old and new versions simultaneously.
It's possible to run both the old and new exporter on different ports, and include an additional scrape job in Prometheus. It's recommended to enable only the collectors that have name changes that you care about.
File: examples/systemd/README.md
Systemd Unit
If you are using distribution packages or the copr repository, you don't need to deal with these files!
The unit files (*.service and *.socket) in this directory are to be put into /etc/systemd/system.
It needs a user named node_exporter, whose shell should be /sbin/nologin and should not have any special privileges.
It needs a sysconfig file in /etc/sysconfig/node_exporter.
It needs a directory named /var/lib/node_exporter/textfile_collector, whose owner should be node_exporter:node_exporter.
A sample file can be found in sysconfig.node_exporter.
File: examples/launchctl/README.md
MacOS LaunchDaemon
If you're installing through a package manager, you probably don't need to deal
with this file.
The plist file should be put in /Library/LaunchDaemons/ (user defined daemons), and the binary installed at/usr/local/bin/node_exporter.
Ex. install globally by
sudo cp -n node_exporter /usr/local/bin/
sudo cp -n examples/launchctl/io.prometheus.node_exporter.plist /Library/LaunchDaemons/
sudo launchctl bootstrap system/ /Library/LaunchDaemons/io.prometheus.node_exporter.plist
# Optionally configure by dropping CLI arguments in a file
echo -- '--web.listen-address=:9101' | sudo tee /usr/local/etc/node_exporter.args
# Check it's running
sudo launchctl list | grep node_exporter
# See full process state
sudo launchctl print system/io.prometheus.node_exporter
# View logs
sudo tail /tmp/node_exporter.logFile: text_collector_examples/README.md
Text collector example scripts
The scripts have been moved to
https://github.com/prometheus-community/node-exporter-textfile-collector-scripts
2. Official Technical Reference & Guides (prometheus/docs)
File: README.md
Prometheus landing page and documentation website
This repository contains both the content and the static-site generator code for the Prometheus documentation site and associated landing pages.
This is a Next.js-based website with some custom code to integrate documentation from other repositories and fetch information about available Prometheus component downloads from GitHub.
Contributing Changes
See CONTRIBUTING.md for general instructions for new Prometheus contributors.
The documentation hosted on this website is pulled together from multiple repositories:
- The main documentation contents are located in the
docsdirectory of this repository. - Documentation concerning the Prometheus server is maintained in the Prometheus server repository and cloned into the website at build time.
- Documentation concerning the Alertmanager server is maintained in the Alertmanager server repository and cloned into the website at build time.
As a guideline, please keep the documentation generally applicable and avoid use-case-specific changes.
For guidelines around Markdown formatting and available frontmatter fields and features, please see the Markdown guide.
Building and running the website
Prerequisites
You'll need to have the following installed on your system:
Environment variables
To bypass anonymous user rate limits while downloading documentation from the other repositories, as well as fetching information about available downloads from the GitHub API, the pre-build scripts require a GitHub access token with read access to the repositories (no write access is required). You can create a personal access token in your GitHub account settings (https://github.com/settings/tokens/new).
Create a .env file in the root of the repository and add the following environment variable:
GITHUB_TOKEN=<your_github_token>Installing npm dependencies
To install all required npm package dependencies, run:
npm installBuilding the website
To build the website, run:
npm run build-allThis cleans any previous build artifacts, fetches the latest documentation from the Prometheus and Alertmanager repositories, fetches information about available downloads (for the Download page), builds the website, and then indexes it (for the built-in Pagefind-based search functionality).
The final output is a static website in the out directory.
You can also run each of these build steps separately:
npm run clean- Cleans any build output and generated files from previous runs.npm run fetch-repo-docs- Fetches the latest documentation from the Prometheus and Alertmanager repositories.npm run fetch-downloads-info- Fetches information about available downloads (for the Download page).npm run build- Builds the website. When usingnpm, this automatically also runs thepostbuildscript, which generates Pagefind search indexes. If you are usingpnpm, you will either need to runnpm run postbuildmanually, or set theenablePrePostScriptsoption in yourpnpm-workspace.yamlfile.
Serving the static build output
To serve the static build output, run:
npx serve outThis will start a web server on port 3000. You can access the website at http://localhost:3000.
Running the website in development mode
To run the website in development mode, run:
npm run devThis will start a web server on port 3000. You can access the website at http://localhost:3000.
The website will automatically reload when you make changes to the source files.
NOTE: Site search is not available in development mode, as it requires building a Pagefind index on the static build output and then loading the generated /pagefind/pagefind.js file. This only happens when building the app for production via npm run build (part of npm run build-all).
Configuration
You can configure some high-level settings for the documentation website in the docs-config.ts file in the root of the repository. This file configures:
- The base URL of the website.
- Which repositories to fetch documentation from.
- Which repositories to fetch download information from.
- Information about LTS (long-term-support) versions.
Automatic Deployment
This site is automatically deployed using Netlify.
If you have the prerequisite access rights, you can view the Netlify settings here:
- GitHub webhook notifying Netlify of branch changes: https://github.com/prometheus/docs/settings/hooks
- Netlify project: https://app.netlify.com/sites/prometheus-docs
Changes to the main branch are deployed to the main site at https://prometheus.io.
Netlify also creates preview deploys for every pull request. To view these for a PR where all checks have passed:
- In the CI section of the PR, click on "Show all checks".
- On the "deploy/netlify" entry, click on "Details" to view the preview site for the PR.
You may have to wait a while for the "deploy/netlify" check to appear after creating or updating the PR, even if the other checks have already passed.
License
Apache License 2.0, see LICENSE.
File: blog/README.md
Prometheus Blog Content Guide
The Prometheus blog exists to share whatโs happening in and around the Prometheus project.
Itโs a space for updates, tutorials, deep dives, and stories from the community.
Our goal is to keep Prometheus users and contributors informed and engaged.
What belongs on the blog?
We feature posts that help people learn, stay up to date, or feel more
connected to the project.
That could mean announcing new releases, explaining how a feature works,
or walking readers through a setup guide.
It might also mean sharing how your organization uses Prometheus,
talking about a recent event, or reflecting on your journey as a contributor.
What doesnโt belong are ads, marketing pitches, or reposts from company blogs.
We want posts that feel original, useful, and rooted in the spirit of open source collaboration.
How should posts be written?
We understand that everyone has their own writing style, and weโd hate to cramp yours.
So, there are no rigid rules around style. But here a few formatting guidelines to keep the posts consistent:
Headings: See this guide for headings.
Links: Add them with descriptive text instead of just dropping the raw URL. Example:
[Prometheus documentation](https://prometheus.io/docs/introduction/overview/).Images and diagrams: Always include alt text so the content is accessible to everyone.
Store images in the<repo_root>/public/assetsfolder (instead of linking from external sites) and reference them in your post.
[!NOTE]
See the general Markdown Documentation Formatting Guide for more formatting rules.
The tone should be friendly and professional.
If youโre not sure what that looks like, take a look at some of the previously published posts
on the blog for inspiration.
Most posts fall somewhere between 800 words (like this short announcements)
and 1500 words (like this long deep dive).
If you include code snippets or configuration examples, please make sure they work as written.
Diagrams or screenshots are also great additions if they help readers grasp complex ideas more quickly.
When multiple people contribute to a post, weโll make sure everyone is credited at the end.
[!IMPORTANT]
After your introductory section, add a `` marker on its own line.
This marker indicates where the preview cuts off on https://prometheus.io/blog/. See the example below.
Example structure:
---
title: "Getting Started with Prometheus"
author: Your Name (@yourgithubusername)
date: 2025-11-02
---
Prometheus makes it easy to collect and query metrics from your applications. In this post, we'll walk through
setting up your first metrics endpoint and understanding what Prometheus collects.
## Installing Prometheus
First, let's get Prometheus installed on your system...How to contribute
If youโd like to write for the blog, the process is simple:
- Find a sponsor (a maintainer with expertise
in your topic area), discuss your post idea with them, and see if they can sponsor your post.
[!IMPORTANT]
For Sponsors:
By agreeing to sponsor a post, you are committing to reviewing the post PR for technical accuracy and
merging it once you are satisfied it meets the required standard.
- Create an issue in the
prometheus/docsrepo using the Blog Post Proposal template. - Wait for feedback from maintainers or editors to confirm itโs a good fit.
- Draft your post in Markdown and submit it as a pull request.
- Go through the review process, where weโll help refine the draft together.
- Once itโs approved, weโll merge and publish it on the blog. ๐
- Share your post on your socials and feel free to tag us so we can boost it too.
Review process
Every post should be reviewed before it goes live.
Whoever reviews the pull request will check for both technical accuracy and editorial quality.
This ensures that the content is both correct and accessible.
In some cases, these might be done by different people, but often one reviewer can cover both.
Why contribute?
Contributing to the blog is a way to give back to the Prometheus community beyond code.
It helps others learn from your experience and brings visibility to your work.
Plus, non-code contributions like this count as real contributions. Youโll be joining
the long list of people whoโve shaped Prometheus in meaningful ways.
File: docs/visualization/browser.md
title: Expression browser sort_rank: 1
The expression browser is available at /graph on the Prometheus server, allowing you
to enter any expression and see its result either in a table or graphed over time.
This is primarily useful for ad-hoc queries and debugging. For graphs, use
Grafana or Console templates.
File: docs/visualization/consoles.md
title: Console templates sort_rank: 4
CAUTION: Starting with Prometheus 3.0, console templates and libraries are no longer bundled with Prometheus. If you wish to use console templates, you must provide your own templates and libraries by specifying the --web.console.templates and --web.console.libraries command-line flags. This documentation page is maintained for historical reference and to demonstrate the capabilities of console templates. Please be aware that any referenced console libraries from the Prometheus 2.x branch are no longer maintained and may contain known security vulnerabilities (CVEs).
Console templates allow for creation of arbitrary consoles using the Go
templating language. These are served
from the Prometheus server.
Console templates are the most powerful way to create templates that can be
easily managed in source control. There is a learning curve though, so users new
to this style of monitoring should try out
Grafana first.
Getting started
Prometheus comes with an example set of consoles to get you going. These can be
found at /consoles/index.html.example on a running Prometheus and will
display Node Exporter consoles if Prometheus is scraping Node Exporters with ajob="node" label.
The example consoles have 5 parts:
- A navigation bar on top
- A menu on the left
- Time controls on the bottom
- The main content in the center, usually graphs
- A table on the right
The navigation bar is for links to other systems, such as other Prometheis
1,
documentation, and whatever else makes sense to you. The menu is for navigation
inside the same Prometheus server, which is very useful to be able to quickly
open a console in another tab to correlate information. Both are configured inconsole_libraries/menu.lib.
The time controls allow changing of the duration and range of the graphs.
Console URLs can be shared and will show the same graphs for others.
The main content is usually graphs. There is a configurable JavaScript graphing
library provided that will handle requesting data from Prometheus, and rendering
it via Rickshaw.
Finally, the table on the right can be used to display statistics in a more
compact form than graphs.
Example Console
This is a basic console. It shows the number of tasks, how many of them are up,
the average CPU usage, and the average memory usage in the right-hand-side
table. The main content has a queries-per-second graph.
{{template "head" .}}
{{template "prom_right_table_head"}}
MyJob
{{ template "prom_query_drilldown" (args "sum(up{job='myjob'})") }}
/ {{ template "prom_query_drilldown" (args "count(up{job='myjob'})") }}
CPU
{{ template "prom_query_drilldown" (args
"avg by(job)(rate(process_cpu_seconds_total{job='myjob'}[5m]))"
"s/s" "humanizeNoSmallPrefix") }}
Memory
{{ template "prom_query_drilldown" (args
"avg by(job)(process_resident_memory_bytes{job='myjob'})"
"B" "humanize1024") }}
{{template "prom_right_table_tail"}}
{{template "prom_content_head" .}}
<h1>MyJob</h1>
<h3>Queries</h3>
<script>
new PromConsole.Graph({
node: document.querySelector("#queryGraph"),
expr: "sum(rate(http_query_count{job='myjob'}[5m]))",
name: "Queries",
yAxisFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
yHoverFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
yUnits: "/s",
yTitle: "Queries"
})
</script>
{{template "prom_content_tail" .}}
{{template "tail"}}The prom_right_table_head and prom_right_table_tail templates contain the
right-hand-side table. This is optional.
prom_query_drilldown is a template that will evaluate the expression passed to it, format it,
and link to the expression in the expression browser. The first
argument is the expression. The second argument is the unit to use. The third
argument is how to format the output. Only the first argument is required.
Valid output formats for the third argument to prom_query_drilldown:
- Not specified: Default Go display output.
humanize: Display the result using metric prefixes.humanizeNoSmallPrefix: For absolute values greater than 1, display the
result using metric prefixes. For
absolute values less than 1, display 3 significant digits. This is useful
to avoid units such as milliqueries per second that can be produced byhumanize.humanize1024: Display the humanized result using a base of 1024 rather than 1000.
This is usually used withBas the second argument to produce units such asKiBandMiB.printf.3g: Display 3 significant digits.
Custom formats can be defined. See
prom.lib for examples.
Graph Library
The graph library is invoked as:
<script>
new PromConsole.Graph({
node: document.querySelector("#queryGraph"),
expr: "sum(rate(http_query_count{job='myjob'}[5m]))"
})
</script>The head template loads the required Javascript and CSS.
Parameters to the graph library:
| Name | Description |
|---|---|
| expr | Required. Expression to graph. Can be a list. |
| node | Required. DOM node to render into. |
| duration | Optional. Duration of the graph. Defaults to 1 hour. |
| endTime | Optional. Unixtime the graph ends at. Defaults to now. |
| width | Optional. Width of the graph, excluding titles. Defaults to auto-detection. |
| height | Optional. Height of the graph, excluding titles and legends. Defaults to 200 pixels. |
| min | Optional. Minimum x-axis value. Defaults to lowest data value. |
| max | Optional. Maximum y-axis value. Defaults to highest data value. |
| renderer | Optional. Type of graph. Options are line and area (stacked graph). Defaults to line. |
| name | Optional. Title of plots in legend and hover detail. If passed a string, [[ label ]] will be substituted with the label value. If passed a function, it will be passed a map of labels and should return the name as a string. Can be a list. |
| xTitle | Optional. Title of the x-axis. Defaults to Time. |
| yUnits | Optional. Units of the y-axis. Defaults to empty. |
| yTitle | Optional. Title of the y-axis. Defaults to empty. |
| yAxisFormatter | Optional. Number formatter for the y-axis. Defaults to PromConsole.NumberFormatter.humanize. |
| yHoverFormatter | Optional. Number formatter for the hover detail. Defaults to PromConsole.NumberFormatter.humanizeExact. |
| colorScheme | Optional. Color scheme to be used by the plots. Can be either a list of hex color codes or one of the color scheme names supported by Rickshaw. Defaults to 'colorwheel'. |
If both expr and name are lists, they must be of the same length. The name
will be applied to the plots for the corresponding expression.
Valid options for the yAxisFormatter and yHoverFormatter:
PromConsole.NumberFormatter.humanize: Format using metric prefixes.PromConsole.NumberFormatter.humanizeNoSmallPrefix: For absolute values
greater than 1, format using metric prefixes.
For absolute values less than 1, format with 3 significant digits. This is
useful to avoid units such as milliqueries per second that can be produced byPromConsole.NumberFormatter.humanize.PromConsole.NumberFormatter.humanize1024: Format the humanized result using a base of 1024 rather than 1000.
File: docs/visualization/grafana.md
title: Grafana support for Prometheus nav_title: Grafana sort_rank: 2
Grafana is an open-source analytics and visualization platform used to monitor and analyze metrics from various data
sources. It allows users to create, explore, and share interactive dashboards, supporting integrations with databases
like Prometheus, InfluxDB, Elasticsearch, and more. Grafana is widely used for observability, providing alerting, plugin
extensibility, and a flexible query editor for real-time data visualization.
Note: The Grafana data source for Prometheus is included since Grafana 2.5.0 (2015-10-28).
The following shows an example Grafana dashboard which queries Prometheus for data:
Installing
To install Grafana see the official Grafana
documentation.
Using
By default, Grafana will be listening on
http://localhost:3000. The default login is "admin" /
"admin".
Creating a Prometheus data source
To create a Prometheus data source in Grafana:
- Click on the "cogwheel" in the sidebar to open the Configuration menu.
- Click on "Data Sources".
- Click on "Add data source".
- Select "Prometheus" as the type.
- Set the appropriate Prometheus server URL (for example,
http://localhost:9090/) - Adjust other data source settings as desired (for example, choosing the right Access method).
- Click "Save & Test" to save the new data source.
The following shows an example data source configuration:
Creating a Prometheus graph
Follow the standard way of adding a new Grafana graph. Then:
- Click the graph title, then click "Edit".
- Under the "Metrics" tab, select your Prometheus data source (bottom right).
- Enter any Prometheus expression into the "Query" field, while using the
"Metric" field to lookup metrics via autocompletion. - To format the legend names of time series, use the "Legend format" input. For
example, to show only themethodandstatuslabels of a returned query
result, separated by a dash, you could use the legend format string{{method}} - {{status}}. - Tune other graph settings until you have a working graph.
The following shows an example Prometheus graph configuration:
In Grafana 7.2 and later, the $__rate_interval variable is
recommended
for use in the rateand increase functions.
Importing pre-built dashboards from Grafana.com
Grafana.com maintains a collection of shared dashboards
which can be downloaded and used with standalone instances of Grafana. Use
the Grafana.com "Filter" option to browse dashboards for the "Prometheus"
data source only.
You must currently manually edit the downloaded JSON files and correct thedatasource: entries to reflect the Grafana data source name which you
chose for your Prometheus server. Use the "Dashboards" โ "Home" โ "Import"
option to import the edited dashboard file into your Grafana install.
File: docs/visualization/perses.md
title: Perses support for Prometheus nav_title: Perses sort_rank: 3
Perses is an open-source dashboard and visualization platform designed for observability, with
native support for Prometheus as a data source.
It enables users to create, manage, and share dashboards for monitoring metrics and visualizing data.
Perses aims to provide a simple, flexible, and extensible alternative to other dashboarding tools, focusing on ease of
use, community-driven development, GitOps capabilities and dashboard as code approach.
Here is an example of a Perses dashboard querying Prometheus for data:
Installing
To install Perses, see the official Perses documentation.
Using
By default, Perses will be listening on port 8080. You can access the web UI at http://localhost:8080. There is no
login by default.
Creating a Prometheus data source
To learn about how to set up a data source in Perses, please refer
to Perses documentation.
Once this connection to your Prometheus instance is configured, you are able to query it from the Dashboard and Explore
views.
Importing pre-built dashboards
Perses is providing a set of pre-built dashboards that you can import into your instance. These dashboards are
maintained by the community and can be found in
the Perses dashboard repository
File: docs/tutorials/alerting_based_on_metrics.md
title: Alerting based on metrics sort_rank: 5
In this tutorial we will create alerts on the ping_request_count metric that we instrumented earlier in the
Instrumenting HTTP server written in Go tutorial.
For the sake of this tutorial we will alert when the ping_request_count metric is greater than 5. Check out real world best practices to learn more about alerting principles.
Download the latest release of Alertmanager for your operating system from here.
Alertmanager supports various receivers like email, webhook, pagerduty, slack etc through which it can notify when an alert is firing. You can find the list of receivers and how to configure them here. We will use webhook as a receiver for this tutorial, head over to webhook.site and copy the webhook URL which we will use later to configure the Alertmanager.
First let's setup Alertmanager with the webhook receiver.
alertmanager.yml
global:
resolve_timeout: 5m
route:
receiver: webhook_receiver
receivers:
- name: webhook_receiver
webhook_configs:
- url: ''
send_resolved: falseReplace `` with the webhook that we copied earlier in the alertmanager.yml file and run the Alertmanager using the following command.
alertmanager --config.file=alertmanager.yml
Once the Alertmanager is up and running navigate to http://localhost:9093 and you should be able to access it.
Now that we have configured the Alertmanager with webhook receiver let's add the rules to the Prometheus config.
prometheus.yml
global:
scrape_interval: 15s
evaluation_interval: 10s
rule_files:
- rules.yml
alerting:
alertmanagers:
- static_configs:
- targets:
- localhost:9093
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ["localhost:9090"]
- job_name: simple_server
static_configs:
- targets: ["localhost:8090"]Note that the evaluation_interval,rule_files and alerting sections were added to the Prometheus config. evaluation_interval defines the intervals at which the rules are evaluated, rule_files accepts an array of yaml files that defines the rules and the alerting section defines the Alertmanager configuration. As mentioned in the beginning of this tutorial we will create a basic rule where we want to
raise an alert when the ping_request_count value is greater than 5.
rules.yml
groups:
- name: Count greater than 5
rules:
- alert: CountGreaterThan5
expr: ping_request_count > 5
for: 10sNow let's run Prometheus using the following command.
prometheus --config.file=./prometheus.yml
Open http://localhost:9090/rules in your browser to see the rules. Next run the instrumented ping server and visit the http://localhost:8090/ping endpoint and refresh the page at least 6 times. You can check the ping count by navigating to the http://localhost:8090/metrics endpoint. To see the status of the alert visit http://localhost:9090/alerts. Once the condition ping_request_count > 5 is true for more than 10s the state will become FIRING. Now if you navigate back to your webhook.site URL you will see the alert message.
Similarly Alertmanager can be configured with other receivers to notify when an alert is firing.
File: docs/tutorials/getting_started.md
title: Getting started with Prometheus sort_rank: 1
What is Prometheus ?
Prometheus is a system monitoring and alerting system. It was opensourced by SoundCloud in 2012 and is the second project both to join and to graduate within Cloud Native Computing Foundation after Kubernetes. Prometheus stores all metrics data as time series, i.e metrics information is stored along with the timestamp at which it was recorded, optional key-value pairs called as labels can also be stored along with metrics.
What are metrics and why is it important?
Metrics in layperson terms is a standard for measurement. What we want to measure depends from application to application. For a web server it can be request times, for a database it can be CPU usage or number of active connections etc.
Metrics play an important role in understanding why your application is working in a certain way. If you run a web application and someone comes up to you and says that the application is slow, you will need some information to find out what is happening with your application. For example the application can become slow when the number of requests are high. If you have the request count metric you can spot the reason and increase the number of servers to handle the heavy load. Whenever you are defining the metrics for your application you must put on your detective hat and ask this question what all information will be important for me to debug if any issue occurs in my application?
Basic Architecture of Prometheus
The basic components of a Prometheus setup are:
- Prometheus Server (the server which scrapes and stores the metrics data).
- Targets to be scraped, for example an instrumented application that exposes its metrics, or an exporter that exposes metrics of another application.
- Alertmanager to raise alerts based on preset rules.
(Note: Apart from this Prometheus has push_gateway which is not covered here).
Let's consider a web server as an example application and we want to extract a certain metric like the number of API calls processed by the web server. So we add certain instrumentation code using the Prometheus client library and expose the metrics information. Now that our web server exposes its metrics we can configure Prometheus to scrape it. Now Prometheus is configured to fetch the metrics from the web server which is listening on xyz IP address port 7500 at a specific time interval, say, every minute.
At 11:00:00 when I make the server public for consumption, the application calculates the request count and exposes it, Prometheus simultaneously scrapes the count metric and stores the value as 0.
By 11:01:00 one request is processed. The instrumentation logic in the server increments the count to 1. When Prometheus scrapes the metric the value of count is 1 now.
By 11:02:00 two more requests are processed and the request count is 1+2 = 3 now. Similarly metrics are scraped and stored.
The user can control the frequency at which metrics are scraped by Prometheus.
| Time Stamp | Request Count (metric) |
|---|---|
| 11:00:00 | 0 |
| 11:01:00 | 1 |
| 11:02:00 | 3 |
(Note: This table is just a representation for understanding purposes. Prometheus doesnโt store the values in this exact format)
Prometheus also has an API which allows to query metrics which have been stored by scraping. This API is used to query the metrics, create dashboards/charts on it etc. PromQL is used to query these metrics.
A simple Line chart created on the Request Count metric will look like this
One can scrape multiple useful metrics to understand what is happening in the application and create multiple charts on them. Group the charts into a dashboard and use it to get an overview of the application.
Show me how it is done
Letโs get our hands dirty and setup Prometheus. Prometheus is written using Go and all you need is the binary compiled for your operating system. Download the binary corresponding to your operating system from here and add the binary to your path.
Prometheus exposes its own metrics which can be consumed by itself or another Prometheus server.
Now that we have Prometheus installed, the next step is to run it. All that we need is just the binary and a configuration file. Prometheus uses yaml files for configuration.
global:
scrape_interval: 15s
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ["localhost:9090"]In the above configuration file we have mentioned the scrape_interval, i.e how frequently we want Prometheus to scrape the metrics. We have added scrape_configs which has a name and target to scrape the metrics from. Prometheus by default listens on port 9090. So add it to targets.
prometheus --config.file=prometheus.yml
Now we have Prometheus up and running and scraping its own metrics every 15s. Prometheus has standard exporters available to export metrics. Next we will run a node exporter which is an exporter for machine metrics and scrape the same using Prometheus. (Download node metrics exporter.)
Run the node exporter in a terminal.
./node_exporter
Next, add node exporter to the list of scrape_configs:
global:
scrape_interval: 15s
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ["localhost:9090"]
- job_name: node_exporter
static_configs:
- targets: ["localhost:9100"]In this tutorial we discussed what are metrics and why they are important, basic architecture of Prometheus and how to
run Prometheus.