Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

2.6 KB
Raw Blame
id: prometheus
name: Prometheus
version: "2.48"
description: Open-source monitoring and alerting toolkit designed for reliability and scalability
icon: https://serverkit.ai/imgs/template-icons/prometheus.svg
website: https://prometheus.io
documentation: https://prometheus.io/docs/
categories:
  - monitoring
  - metrics
  - alerting

variables:
  - name: HTTP_PORT
    description: HTTP port
    type: port
    default: "9090"
    hidden: true
  - name: RETENTION_TIME
    description: Data retention period
    default: 15d
  - name: PANEL_TARGET
    description: Where Prometheus reaches this panel (host:port, from inside the container)
    default: host.docker.internal:80
    hidden: true
  - name: PANEL_SCHEME
    description: http, or https if the panel only answers on HTTPS
    default: http
    hidden: true

# What an app (Grafana) gets through `fromService`, over the shared network.
connection:
  port: 9090
  properties:
    url: "http://{host}:{port}"

files:
  - path: /etc/prometheus/prometheus.yml
    content: |
      # Written by ServerKit at install. The serverkit job scrapes this panel
      # (/api/v1/fleet-monitor/prometheus) with the panel's own scrape token.
      global:
        scrape_interval: 15s
        evaluation_interval: 15s

      scrape_configs:
        - job_name: prometheus
          static_configs:
            - targets: ['localhost:9090']

        - job_name: serverkit
          scheme: ${PANEL_SCHEME}
          metrics_path: /api/v1/fleet-monitor/prometheus
          params:
            token: ['${SERVERKIT_METRICS_TOKEN}']
          static_configs:
            - targets: ['${PANEL_TARGET}']

ports:
  - port: 9090
    protocol: tcp
    description: Web interface and API

volumes:
  - name: data
    path: /prometheus
    description: Prometheus data storage

requirements:
  memory: 2GB
  storage: 20GB

compose:
  services:
    prometheus:
      image: prom/prometheus:v${VERSION:-2.48.0}
      container_name: ${APP_NAME}
      restart: unless-stopped
      command:
        - '--config.file=/etc/prometheus/prometheus.yml'
        - '--storage.tsdb.path=/prometheus'
        - '--storage.tsdb.retention.time=${RETENTION_TIME}'
        - '--web.console.libraries=/etc/prometheus/console_libraries'
        - '--web.console.templates=/etc/prometheus/consoles'
        - '--web.enable-lifecycle'
      # Lets the container reach the panel on the host (Linux has no
      # host.docker.internal otherwise).
      extra_hosts:
        - "host.docker.internal:host-gateway"
      volumes:
        - prometheus_data:/prometheus
      ports:
        - "${HTTP_PORT}:9090"

  volumes:
    prometheus_data: