58 lines
1.3 KiB
Markdown
58 lines
1.3 KiB
Markdown
---
|
|
obj: application
|
|
website: https://prometheus.io
|
|
repo: https://github.com/prometheus/prometheus
|
|
rev: 2024-12-12
|
|
---
|
|
|
|
# Prometheus
|
|
Prometheus is an open-source systems monitoring and alerting toolkit originally built at SoundCloud.
|
|
It collects and stores its metrics as time series data, i.e. metrics information is stored with the timestamp at which it was recorded, alongside optional key-value pairs called labels.
|
|
This data can then be visualized using [Grafana](./Grafana.md).
|
|
|
|
## Docker Compose
|
|
|
|
```yml
|
|
services:
|
|
prometheus:
|
|
image: prom/prometheus
|
|
ports:
|
|
- 9090:9090
|
|
volumes:
|
|
- ./data:/prometheus
|
|
- ./conf:/etc/prometheus
|
|
```
|
|
|
|
## Configuration
|
|
Basic prometheus config:
|
|
|
|
```yml
|
|
global:
|
|
scrape_interval: 15s
|
|
evaluation_interval: 15s
|
|
|
|
scrape_configs:
|
|
- job_name: "prometheus"
|
|
static_configs:
|
|
- targets: ["localhost:9090"]
|
|
|
|
# Node Exporter Config
|
|
- job_name: node_exporter
|
|
scrape_interval: 5s
|
|
static_configs:
|
|
- targets: ['host:9100']
|
|
|
|
# Job with custom CA
|
|
- job_name: custom_ca
|
|
static_configs:
|
|
- targets: ['endpoint']
|
|
tls_config:
|
|
ca_file: '/ca_file.crt'
|
|
|
|
# Job with Bearer Auth
|
|
- job_name: bearer_auth
|
|
scrape_interval: 120s
|
|
static_configs:
|
|
- targets: ['endpoint']
|
|
bearer_token: 'BEARER_TOKEN'
|
|
```
|