knowledge/technology/applications/web/Prometheus.md
2024-12-12 09:39:36 +01:00

1.3 KiB

obj website repo rev
application https://prometheus.io https://github.com/prometheus/prometheus 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.

Docker Compose

services:
    prometheus:
        image: prom/prometheus
        ports:
            - 9090:9090
        volumes:
            - ./data:/prometheus
            - ./conf:/etc/prometheus

Configuration

Basic prometheus config:

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'