Prometheus Concepts: Difference between revisions
Line 40: | Line 40: | ||
cpu_usage{core="1",ip="127.0.01"} 14.04 | cpu_usage{core="1",ip="127.0.01"} 14.04 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Also see: {{Internal|Monitoring_Concepts#Metric|Monitoring Concepts | Metrics}} | Also see: {{Internal|Monitoring_Concepts#Metric|Monitoring Concepts | Metrics}} | ||
<font color=darkgray> | |||
TODO: | |||
* https://prometheus.io/docs/instrumenting/exposition_formats/ | |||
</font> | |||
==Metric Types== | ==Metric Types== | ||
===Counter=== | ===Counter=== | ||
Line 49: | Line 52: | ||
===Histogram=== | ===Histogram=== | ||
===Summary=== | ===Summary=== | ||
=PromQL= | =PromQL= | ||
Vectors. Instant vectors. Time ranged vectors. | Vectors. Instant vectors. Time ranged vectors. | ||
=Configuration= | =Configuration= | ||
{{Internal|Prometheus Configuration|Configuration}} | {{Internal|Prometheus Configuration|Configuration}} |
Revision as of 18:40, 14 October 2020
External
Internal
Overview
Prometheus is a time series database plus tools to collect metrics to be stored in the database as aggregated metrics. Prometheus is a solution for system monitoring. It is not designed to catch individual events in time (such as a service outage) but it is designed to gather aggregated metrics about services. Prometheus is not designed to store raw information, such as text. Prometheus provides alerting capabilities with Alertmanager. Prometheus has some built-in visualization capabilities, but Grafana can also be used.
Target
Prometheus will monitor targets. A target can be a server, database, virtual machine, etc. Different targets can have different pull rates. Targets can be discovered dynamically with service discovery.
Instance
Job
Pull vs. Push
Prometheus will actively pull (scrap) metrics, by connecting to targets. The retrieval is done by invoking HTTP into endpoints, which are defined in the configuration.
Advantages of pull vs. push:
- Centralized control - the configuration is done on Prometheus and not on individual targets.
- Adjustable pull rate - the system has control over pull rate, and avoids being overloaded.
Pull Rate
Sources of Metrics
Instrumented Applications
Prometheus pulls metrics from instrumented applications. An instrumented application exposes Prometheus metrics on a given URL. Such an application will be identified by Prometheus as a target and scrapped at regular periods.
Exporters
An alternative are prebuilt exporters. Examples: node exporter, SQL exporter, HAProxy exporter. The exporters are usually exposed as Docker images, and can be configured to monitor existing targets.
Push Gateway
Push gateways are used in case of applications or short-lived jobs that do not export metrics directly.
Storage
Alertmanager
Prometheus pushes alerts to Alertmanager via custom rules defined in its configuration files.
Service Discovery
Prometheus can discover targets dynamically.
Metrics
A Prometheus metric is a key/value pair plus a set of labels, commonly referred to as metadata. The key is the name of the metric. The value is a float numerical value.
cpu_usage{core="1",ip="127.0.01"} 14.04
Also see:
TODO:
Metric Types
Counter
A counter counts elements over time. A counter is a monotonically increasing positive value. A counter can only go up or can be reset. It must never decrease.
Gauge
A gauge measures values that can go up and down.
Histogram
Summary
PromQL
Vectors. Instant vectors. Time ranged vectors.