monitoring

A command that sets up Prometheus and Grafana monitoring. Prometheus collects application measurements, while Grafana displays them in dashboards.

In plain words
What is it for?
It helps configure monitoring directories, application metrics, dashboards, alert rules, and monitoring status for a project.
Why use it?
It removes much of the manual setup needed to watch an application's health and receive alerts when problems occur.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/alphaaiservice/cortex/monitoring
Clone the repo
git clone --depth 1 https://github.com/alphaaiservice/cortex
Per session 35 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,073 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00035 $0.03073
Opus 5 $0.00017 $0.01537
Sonnet 5 $0.00007 $0.00615
Haiku 4.5 $0.00003 $0.00307

Measured yesterday against content hash f8565abb66f9, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

monitoring scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

echo "Prometheus: $(curl -s -o /dev/null -w '%{http_code}' http://localhost:9090/-/healthy)"
commands/monitoring.md · 419 lines

How it starts

The opening of the file, as written. The whole thing — 419 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Monitoring Stack Setup (Prometheus + Grafana)

Action: $ARGUMENTS (default: setup)

Step 1: Assess Current Monitoring State

echo "=== Check for existing monitoring ==="
ls -la docker/docker-compose*.yml 2>/dev/null
ls -la monitoring/ prometheus/ grafana/ 2>/dev/null
grep -rn "prometheus\|grafana\|metrics" docker/ 2>/dev/null
grep -rn "prometheus_client\|starlette_exporter" requirements*.txt pyproject.toml 2>/dev/null
echo ""
echo "=== Check if Docker is running ==="
docker info --format '{{.ServerVersion}}' 2>/dev/null || echo "Docker not running"

Step 2: Create Monitoring Directory Structure

monitoring/
├── prometheus/
│   ├── prometheus.yml              # Main Prometheus config
│   ├── alerts/
│   │   ├── app_alerts.yml          # Application-level alerts
│   │   ├── infra_alerts.yml        # Infrastructure alerts
│   │   └── business_alerts.yml     # Business metric alerts
│   └── recording_rules.yml        # Pre-computed metrics
├── grafana/
│   ├── provisioning/
│   │   ├── datasources/
│   │   │   └── prometheus.yml      # Auto-configure Prometheus datasource
│   │   └── dashboards/
│   │       ├── dashboard.yml       # Dashboard provisioning config
│   │       ├── app-overview.json   # Application overview dashboard
│   │       ├── api-performance.json # API endpoint performance
│   │       ├── database.json       # Database metrics dashboard
│   │       └── infrastructure.json # System resource dashboard
│   └── grafana.ini                 # Grafana server config
├── alertmanager/
│   └── alertmanager.yml            # Alert routing and notifications
└── docker-compose.monitoring.yml   # Monitoring stack compose file

Step 3: Generate Prometheus Configuration

Create monitoring/prometheus/prometheus.yml:

global:
  scrape_interval: 15s
  evaluation_interval: 15s
  scrape_timeout: 10s

rule_files:
  - "alerts/*.yml"
  - "recording_rules.yml"

alerting:
  alertmanagers:
    - static_configs:
        - targets: ['alertmanager:9093']

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

  - job_name: 'app'
    metrics_path: '/metrics'
    scrape_interval: 10s
    static_configs:
      - targets: ['app:8000']
    relabel_configs:
      - source_labels: [__address__]
        target_label: instance
        replacement: 'app'

  - job_name: 'node-exporter'
    static_configs:
      - targets: ['node-exporter:9100']

  - job_name: 'cadvisor'
    static_configs:
      - targets: ['cadvisor:8080']

  - job_name: 'redis'
    static_configs:
      - targets: ['redis-exporter:9121']

  - job_name: 'mysql'
    static_configs:
      - targets: ['mysql-exporter:9104']

  - job_name: 'mongodb'
    static_configs:
      - targets: ['mongodb-exporter:9216']

Read the full file on GitHub · 419 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 419 lines · 35 tokens per session scan A f8565abb66f9

Subscribe to this mod's changes

monitoring is a command published in the GitHub repository alphaaiservice/cortex (1 stars, last pushed 26d ago), licensed MIT. It adds 35 tokens to every session and 3,073 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.