
Prometheus Monitoring
- 455 installs
- 305 repo stars
- Updated March 4, 2026
- aj-geddes/useful-ai-prompts
prometheus-monitoring is a useful-ai-prompts skill that instruments services with Prometheus metrics, exporters, scrape jobs, recording rules, and PromQL alerts for developers who need production observability.
About
prometheus-monitoring is a skill from aj-geddes/useful-ai-prompts that guides Prometheus-based production observability setup. It covers application metric instrumentation, exporter configuration, scrape job definitions, recording rules, and PromQL alert expressions so teams can detect regressions in running services. Developers reach for prometheus-monitoring when services are deployed and need standardized metrics pipelines instead of ad hoc logging, especially when on-call needs actionable alerts tied to scrape targets and recorded aggregates.
- Metric instrumentation
- Exporter selection
- Scrape config design
- PromQL alert rules
- SLO recording rules
Prometheus Monitoring by the numbers
- 455 all-time installs (skills.sh)
- Ranked #271 of 1,435 DevOps & CI/CD skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill prometheus-monitoringAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 455 |
|---|---|
| repo stars | ★ 305 |
| Last updated | March 4, 2026 |
| Repository | aj-geddes/useful-ai-prompts ↗ |
How do you set up Prometheus monitoring for a service?
Instrument services with Prometheus metrics, exporters, scrape jobs, recording rules, and PromQL alerts for production observability.
Who is it for?
Backend or platform engineers operating production services who need Prometheus metrics, scrape jobs, and PromQL-based alerting.
Skip if: Developers who only need local debug logging without metrics pipelines, because prometheus-monitoring targets production Prometheus observability stacks.
When should I use this skill?
The user asks to add Prometheus metrics, exporters, scrape configs, recording rules, or PromQL alerts to a running service.
What you get
Prometheus metrics instrumentation, exporter configs, scrape jobs, recording rules, and PromQL alert definitions.
- Metrics instrumentation
- Scrape job configuration
- PromQL alert rules
Files
Prometheus Monitoring
Table of Contents
Overview
Implement comprehensive Prometheus monitoring infrastructure for collecting, storing, and querying time-series metrics from applications and infrastructure.
When to Use
- Setting up metrics collection
- Creating custom application metrics
- Configuring scraping targets
- Implementing service discovery
- Building monitoring infrastructure
Quick Start
Minimal working example:
# /etc/prometheus/prometheus.yml
global:
scrape_interval: 15s
evaluation_interval: 15s
external_labels:
cluster: production
alerting:
alertmanagers:
- static_configs:
- targets: ["localhost:9093"]
rule_files:
- "/etc/prometheus/alert_rules.yml"
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
- job_name: "node"
static_configs:
- targets: ["localhost:9100"]
- job_name: "api-service"
// ... (see reference guides for full implementation)Reference Guides
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| Prometheus Configuration | Prometheus Configuration |
| Node.js Metrics Implementation | Node.js Metrics Implementation |
| Python Prometheus Integration | Python Prometheus Integration |
| Alert Rules | Alert Rules |
| Docker Compose Setup | Docker Compose Setup |
Best Practices
✅ DO
- Use consistent metric naming conventions
- Add comprehensive labels for filtering
- Set appropriate scrape intervals (10-60s)
- Implement retention policies
- Monitor Prometheus itself
- Test alert rules before deployment
- Document metric meanings
❌ DON'T
- Add unbounded cardinality labels
- Scrape too frequently (< 10s)
- Ignore metric naming conventions
- Create alerts without runbooks
- Store raw event data in Prometheus
- Use counters for gauge-like values
Alert Rules
Alert Rules
# /etc/prometheus/alert_rules.yml
groups:
- name: application
rules:
- alert: HighErrorRate
expr: rate(requests_total{status_code=~"5.."}[5m]) > 0.05
for: 5m
labels:
severity: critical
annotations:
summary: "High error rate: {{ $value }}"
- alert: HighLatency
expr: histogram_quantile(0.95, request_duration_seconds) > 1
for: 10m
labels:
severity: warning
annotations:
summary: "p95 latency: {{ $value }}s"
- alert: HighMemoryUsage
expr: node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes < 0.1
for: 5m
labels:
severity: warning
annotations:
summary: "Low memory: {{ $value }}"Docker Compose Setup
Docker Compose Setup
version: "3.8"
services:
prometheus:
image: prom/prometheus:latest
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- ./alert_rules.yml:/etc/prometheus/alert_rules.yml
- prometheus_data:/prometheus
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/prometheus"
- "--storage.tsdb.retention.time=30d"
node-exporter:
image: prom/node-exporter:latest
ports:
- "9100:9100"
volumes:
prometheus_data:Node.js Metrics Implementation
Node.js Metrics Implementation
// metrics.js
const promClient = require("prom-client");
const register = new promClient.Registry();
promClient.collectDefaultMetrics({ register });
const httpRequestDuration = new promClient.Histogram({
name: "http_request_duration_seconds",
help: "HTTP request duration",
labelNames: ["method", "route", "status_code"],
buckets: [0.1, 0.5, 1, 2, 5],
registers: [register],
});
const requestsTotal = new promClient.Counter({
name: "requests_total",
help: "Total requests",
labelNames: ["method", "route", "status_code"],
registers: [register],
});
// Express middleware
const express = require("express");
const app = express();
app.get("/metrics", (req, res) => {
res.set("Content-Type", register.contentType);
res.end(register.metrics());
});
app.use((req, res, next) => {
const start = Date.now();
res.on("finish", () => {
const duration = (Date.now() - start) / 1000;
httpRequestDuration
.labels(req.method, req.path, res.statusCode)
.observe(duration);
requestsTotal.labels(req.method, req.path, res.statusCode).inc();
});
next();
});
module.exports = { register, httpRequestDuration, requestsTotal };Prometheus Configuration
Prometheus Configuration
# /etc/prometheus/prometheus.yml
global:
scrape_interval: 15s
evaluation_interval: 15s
external_labels:
cluster: production
alerting:
alertmanagers:
- static_configs:
- targets: ["localhost:9093"]
rule_files:
- "/etc/prometheus/alert_rules.yml"
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
- job_name: "node"
static_configs:
- targets: ["localhost:9100"]
- job_name: "api-service"
static_configs:
- targets: ["localhost:8080/metrics"]
scrape_interval: 10s
- job_name: "kubernetes-pods"
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
action: keep
regex: "true"
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path]
action: replace
target_label: __metrics_path__Python Prometheus Integration
Python Prometheus Integration
from prometheus_client import Counter, Histogram, start_http_server
from flask import Flask, request
import time
app = Flask(__name__)
request_count = Counter('requests_total', 'Total requests', ['method', 'endpoint'])
request_duration = Histogram('request_duration_seconds', 'Request duration', ['method', 'endpoint'])
@app.before_request
def before():
request.start_time = time.time()
@app.after_request
def after(response):
duration = time.time() - request.start_time
request_count.labels(request.method, request.path).inc()
request_duration.labels(request.method, request.path).observe(duration)
return response
if __name__ == '__main__':
start_http_server(8000)
app.run(port=5000)#!/bin/bash
# health-check.sh - Check service health
# Usage: ./health-check.sh <service_url>
set -euo pipefail
SERVICE_URL="${{1:?Usage: $0 <service_url>}}"
echo "Checking health: $SERVICE_URL"
# TODO: Implement health checks
# - HTTP endpoint check
# - Response time validation
# - Dependency health
# - Resource utilization
# - Error rate check
echo "Health check complete."
# Monitoring Dashboard Configuration
# TODO: Customize for your monitoring platform (Grafana, Datadog, etc.)
dashboard:
title: "Service Dashboard"
refresh: 30s
panels:
- title: "Request Rate"
type: graph
# TODO: Add metric query
- title: "Error Rate"
type: graph
# TODO: Add metric query
- title: "Latency (p50/p95/p99)"
type: graph
# TODO: Add metric query
alerts:
- name: "High Error Rate"
# TODO: Configure alert thresholds
Related skills
How it compares
Pick prometheus-monitoring over generic logging guides when scrape jobs, recording rules, and PromQL alerts must be designed together.
FAQ
What does prometheus-monitoring help configure?
prometheus-monitoring helps configure Prometheus metrics instrumentation, exporters, scrape jobs, recording rules, and PromQL alerts. The skill targets production observability rather than local-only debugging.
Does prometheus-monitoring replace an existing monitoring stack?
prometheus-monitoring guides Prometheus-specific setup within an observability stack. It helps instrument services and define alerts when Prometheus is the metrics and alerting backbone.