Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Set up Prometheus for comprehensive metric collection, storage, and monitoring of infrastructure and applications. Use when implementing metrics collection, setting up monitoring infrastructure, or configuring alerting systems.
.claude/skills/microck-prometheus-configuration/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 114% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 258% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 347% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 370% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 279% | 0% |
Complete guide to Prometheus setup, metric collection, scrape configuration, and recording rules.
Configure Prometheus for comprehensive metric collection, alerting, and monitoring of infrastructure and applications.
┌──────────────┐
│ Applications │ ← Instrumented with client libraries
└──────┬───────┘
│ /metrics endpoint
↓
┌──────────────┐
│ Prometheus │ ← Scrapes metrics periodically
│ Server │
└──────┬───────┘
│
├─→ AlertManager (alerts)
├─→ Grafana (visualization)
└─→ Long-term storage (Thanos/Cortex)bashhelm repo add prometheus-community https://prometheus-community.github.io/helm-charts helm repo update helm install prometheus prometheus-community/kube-prometheus-stack \ --namespace monitoring \ --create-namespace \ --set prometheus.prometheusSpec.retention=30d \ --set prometheus.prometheusSpec.storageVolumeSize=50Gi
yamlversion: '3.8' services: prometheus: image: prom/prometheus:latest ports: - "9090:9090" volumes: - ./prometheus.yml:/etc/prometheus/prometheus.yml - prometheus-data:/prometheus command: - '--config.file=/etc/prometheus/prometheus.yml' - '--storage.tsdb.path=/prometheus' - '--storage.tsdb.retention.time=30d' volumes: prometheus-data:
prometheus.yml:
yamlglobal: scrape_interval: 15s evaluation_interval: 15s external_labels: cluster: 'production' region: 'us-west-2' # Alertmanager configuration alerting: alertmanagers: - static_configs: - targets: - alertmanager:9093 # Load rules files rule_files: - /etc/prometheus/rules/*.yml # Scrape configurations scrape_configs: # Prometheus itself - job_name: 'prometheus' static_configs: - targets: ['localhost:9090'] # Node exporters - job_name: 'node-exporter' static_configs: - targets: - 'node1:9100' - 'node2:9100' - 'node3:9100' relabel_configs: - source_labels: [__address__] target_label: instance regex: '([^:]+)(:[0-9]+)?' replacement: '${1}' # Kubernetes pods with annotations - 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__ regex: (.+) - source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port] action: replace regex: ([^:]+)(?::\d+)?;(\d+) replacement: $1:$2 target_label: __address__ - source_labels: [__meta_kubernetes_namespace] action: replace target_label: namespace - source_labels: [__meta_kubernetes_pod_name] action: replace target_label: pod # Application metrics - job_name: 'my-app' static_configs: - targets: - 'app1.example.com:9090' - 'app2.example.com:9090' metrics_path: '/metrics' scheme: 'https' tls_config: ca_file: /etc/prometheus/ca.crt cert_file: /etc/prometheus/client.crt key_file: /etc/prometheus/client.key
Reference: See assets/prometheus.yml.template
yamlscrape_configs: - job_name: 'static-targets' static_configs: - targets: ['host1:9100', 'host2:9100'] labels: env: 'production' region: 'us-west-2'
yamlscrape_configs: - job_name: 'file-sd' file_sd_configs: - files: - /etc/prometheus/targets/*.json - /etc/prometheus/targets/*.yml refresh_interval: 5m
targets/production.json:
json[ { "targets": ["app1:9090", "app2:9090"], "labels": { "env": "production", "service": "api" } } ]
yamlscrape_configs: - job_name: 'kubernetes-services' kubernetes_sd_configs: - role: service relabel_configs: - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scrape] action: keep regex: true - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scheme] action: replace target_label: __scheme__ regex: (https?) - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_path] action: replace target_label: __metrics_path__ regex: (.+)
Reference: See references/scrape-configs.md
Create pre-computed metrics for frequently queried expressions:
yaml# /etc/prometheus/rules/recording_rules.yml groups: - name: api_metrics interval: 15s rules: # HTTP request rate per service - record: job:http_requests:rate5m expr: sum by (job) (rate(http_requests_total[5m])) # Error rate percentage - record: job:http_requests_errors:rate5m expr: sum by (job) (rate(http_requests_total{status=~"5.."}[5m])) - record: job:http_requests_error_rate:percentage expr: | (job:http_requests_errors:rate5m / job:http_requests:rate5m) * 100 # P95 latency - record: job:http_request_duration:p95 expr: | histogram_quantile(0.95, sum by (job, le) (rate(http_request_duration_seconds_bucket[5m])) ) - name: resource_metrics interval: 30s rules: # CPU utilization percentage - record: instance:node_cpu:utilization expr: | 100 - (avg by (instance) (rate(node_cpu_seconds_total{mode="idle"}[5m])) * 100) # Memory utilization percentage - record: instance:node_memory:utilization expr: | 100 - ((node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes) * 100) # Disk usage percentage - record: instance:node_disk:utilization expr: | 100 - ((node_filesystem_avail_bytes / node_filesystem_size_bytes) * 100)
Reference: See references/recording-rules.md
yaml# /etc/prometheus/rules/alert_rules.yml groups: - name: availability interval: 30s rules: - alert: ServiceDown expr: up{job="my-app"} == 0 for: 1m labels: severity: critical annotations: summary: "Service {{ $labels.instance }} is down" description: "{{ $labels.job }} has been down for more than 1 minute" - alert: HighErrorRate expr: job:http_requests_error_rate:percentage > 5 for: 5m labels: severity: warning annotations: summary: "High error rate for {{ $labels.job }}" description: "Error rate is {{ $value }}% (threshold: 5%)" - alert: HighLatency expr: job:http_request_duration:p95 > 1 for: 5m labels: severity: warning annotations: summary: "High latency for {{ $labels.job }}" description: "P95 latency is {{ $value }}s (threshold: 1s)" - name: resources interval: 1m rules: - alert: HighCPUUsage expr: instance:node_cpu:utilization > 80 for: 5m labels: severity: warning annotations: summary: "High CPU usage on {{ $labels.instance }}" description: "CPU usage is {{ $value }}%" - alert: HighMemoryUsage expr: instance:node_memory:utilization > 85 for: 5m labels: severity: warning annotations: summary: "High memory usage on {{ $labels.instance }}" description: "Memory usage is {{ $value }}%" - alert: DiskSpaceLow expr: instance:node_disk:utilization > 90 for: 5m labels: severity: critical annotations: summary: "Low disk space on {{ $labels.instance }}" description: "Disk usage is {{ $value }}%"
bash# Validate configuration promtool check config prometheus.yml # Validate rules promtool check rules /etc/prometheus/rules/*.yml # Test query promtool query instant http://localhost:9090 'up'
Reference: See scripts/validate-prometheus.sh
Check scrape targets:
bashcurl http://localhost:9090/api/v1/targets
Check configuration:
bashcurl http://localhost:9090/api/v1/status/config
Test query:
bashcurl 'http://localhost:9090/api/v1/query?query=up'
assets/prometheus.yml.template - Complete configuration templatereferences/scrape-configs.md - Scrape configuration patternsreferences/recording-rules.md - Recording rule examplesscripts/validate-prometheus.sh - Validation scriptgrafana-dashboards - For visualizationslo-implementation - For SLO monitoringdistributed-tracing - For request tracing| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 10,798 | 8,264 | -23% | 1 | 1 | 0% | 2,048 | 4,387 | +114% | 0 | 0 | — |
case-02 | pass→pass | 8,496 | 6,173 | -27% | 1 | 1 | 0% | 1,484 | 4,021 | +171% | 0 | 0 | — |
case-03 | fail→fail | 6,739 | 5,367 | -20% | 1 | 1 | 0% | 1,201 | 3,759 | +213% | 0 | 0 | — |
case-04 | fail→fail | 8,315 | 5,768 | -31% | 1 | 1 | 0% | 1,492 | 3,903 | +162% | 0 | 0 | — |
case-05 | pass→pass | 7,440 | 7,666 | +3% | 1 | 1 | 0% | 1,353 | 4,255 | +214% | 0 | 0 | — |
case-06 | fail→fail | 5,061 | 4,296 | -15% | 1 | 1 | 0% | 1,028 | 3,670 | +257% | 0 | 0 | — |
case-07 | fail→fail | 6,455 | 4,451 | -31% | 1 | 1 | 0% | 1,203 | 3,645 | +203% | 0 | 0 | — |
case-08 | pass→pass | 6,079 | 3,823 | -37% | 1 | 1 | 0% | 999 | 3,577 | +258% | 0 | 0 | — |
case-09 | fail→pass | 5,147 | 4,932 | -4% | 1 | 1 | 0% | 1,023 | 3,662 | +258% | 0 | 0 | — |
case-10 | fail→pass | 4,514 | 3,306 | -27% | 1 | 1 | 0% | 773 | 3,457 | +347% | 0 | 0 | — |
case-11 | fail→pass | 4,330 | 4,501 | +4% | 1 | 1 | 0% | 752 | 3,536 | +370% | 0 | 0 | — |
case-12 | pass→pass | 6,145 | 3,438 | -44% | 1 | 1 | 0% | 1,036 | 3,311 | +220% | 0 | 0 | — |
case-13 | fail→pass | 5,359 | 3,263 | -39% | 1 | 1 | 0% | 878 | 3,325 | +279% | 0 | 0 | — |
case-14 | pass→pass | 8,184 | 4,011 | -51% | 1 | 1 | 0% | 1,343 | 3,489 | +160% | 0 | 0 | — |
case-15 | pass→pass | 5,674 | 4,112 | -28% | 1 | 1 | 0% | 1,000 | 3,500 | +250% | 0 | 0 | — |
case-16 | pass→pass | 7,922 | 4,578 | -42% | 1 | 1 | 0% | 1,306 | 3,580 | +174% | 0 | 0 | — |
case-17 | pass→pass | 3,876 | 2,685 | -31% | 1 | 1 | 0% | 624 | 3,201 | +413% | 0 | 0 | — |
case-18 | pass→pass | 3,424 | 3,104 | -9% | 1 | 1 | 0% | 568 | 3,351 | +490% | 0 | 0 | — |
case-19 | pass→pass | 5,806 | 4,900 | -16% | 1 | 1 | 0% | 1,082 | 3,764 | +248% | 0 | 0 | — |
case-20 | fail→fail | 7,631 | 10,942 | +43% | 1 | 1 | 0% | 1,464 | 4,964 | +239% | 0 | 0 | — |
case-21 | fail→fail | 10,498 | 12,087 | +15% | 1 | 1 | 0% | 2,054 | 4,891 | +138% | 0 | 0 | — |
case-22 | fail→fail | 11,730 | 12,239 | +4% | 1 | 1 | 0% | 2,190 | 5,160 | +136% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +23 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.