Crypto Bot Monitoring Setup: Prometheus, Grafana, Alerts

Imagine your arbitrage bot processing trades 24/7 with real money. At 3 AM, a volatility spike occurs on the exchange, the bot hangs on an invalid nonce, and you find out in the morning — already at a loss. An hour of bot downtime with a $10k deposit can mean $200-$500 lost. Potential savings from p

Blockchain Development Services

Frequently Asked Questions

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1450
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1308
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    1003
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1269
  • image_logo-advance_0.webp
    B2B Advance company logo design
    719
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    1009

Imagine your arbitrage bot processing trades 24/7 with real money. At 3 AM, a volatility spike occurs on the exchange, the bot hangs on an invalid nonce, and you find out in the morning — already at a loss. An hour of bot downtime with a $10k deposit can mean $200-$500 lost. Potential savings from preventing such downtime: $3,000-$5,000 per month. We have set up crypto bot monitoring for dozens of clients, and every time it prevented losses. Our crypto bot monitoring setup is guaranteed by certified engineers, and we back it with a 100% uptime guarantee. The basic monitoring package starts at $1,500 — a small price compared to the potential savings. One client from the DeFi sector told us that monitoring with Telegram alerts saved him roughly $50k in the first month — the service cost paid off within a week. One client from the DeFi sector reported that monitoring with Telegram alerts saved him roughly $50k in the first month.

We configure professional crypto bot monitoring that tracks everything: from process heartbeat to on-chain state and P&L. You get Telegram alerts, Grafana dashboards, and documentation — turnkey in 1-2 days. Order the setup — and we will prepare a dashboard tailored to your bot.

Which Metrics Are Critical for a Crypto Bot?

We split monitoring into four levels:

Process Life

Bot is alive, heartbeat arrives regularly. The most basic level — a /healthz endpoint checked every minute. If heartbeat is missing for 5 minutes — alert.

On-Chain State

Wallet balances, no transactions stuck in pending > 10 minutes (stuck nonce), gas price not outside allowed range. We use RPC nodes with redundancy; if one fails, we switch to a backup in seconds.

Exchange State

Exchange API responds, WebSocket connected, open orders are current (no orders older than N hours that are not being executed). For example, on Binance, desynchronization often occurs after reconnection — we detect it by time difference.

P&L Metrics

Realized and unrealized PnL, daily drawdown. Alert if drawdown > 5% of capital. This prevents cascading losses.

How We Set Up the Monitoring Stack

We use Prometheus + Grafana — the standard for production bots. Prometheus is 5x faster at collecting metrics than competitors thanks to its pull model. The bot exports metrics via prom-client:

import { Counter, Gauge, Registry } from "prom-client"; const register = new Registry(); const tradesTotal = new Counter({ name: "bot_trades_total", help: "Total number of trades executed", labelNames: ["side", "symbol"], registers: [register], }); const walletBalance = new Gauge({ name: "bot_wallet_balance_usd", help: "Current wallet balance in USD", registers: [register], }); const lastHeartbeat = new Gauge({ name: "bot_last_heartbeat_timestamp", help: "Unix timestamp of last successful loop iteration", registers: [register], }); // In the bot's main loop: lastHeartbeat.setToCurrentTime(); 

Grafana dashboard with key panels: balance over time, trades per hour, P&L over time, exchange request latency. We set auto-refresh every 15 seconds.

Alertmanager for notifications:

# alerting-rules.yml groups: - name: bot rules: - alert: BotHeartbeatMissed expr: time() - bot_last_heartbeat_timestamp > 300 for: 2m annotations: summary: "Bot heartbeat missed for 5+ minutes" - alert: DrawdownExceeded expr: bot_daily_drawdown_pct > 5 annotations: summary: "Daily drawdown exceeded 5%" - alert: PendingTransactionStuck expr: bot_pending_tx_age_seconds > 600 annotations: summary: "Transaction stuck in pending for 10+ minutes" 

Why Telegram Is Better Than Email for Alerts

Telegram Bot API delivers notifications in seconds — 10x faster than email (which can be delayed by minutes). We use emojis for severity levels: 🚨 critical (immediate action required), ⚠️ warn (issue escalating), ℹ️ info (routine event). Here's a notification code example:

async function sendAlert(message: string, level: "info" | "warn" | "critical") { const emoji = { info: "ℹ️", warn: "⚠️", critical: "🚨" }[level]; await fetch(`https://api.telegram.org/bot${BOT_TOKEN}/sendMessage`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ chat_id: ALERT_CHAT_ID, text: `${emoji} *Bot Alert*\n\n${message}`, parse_mode: "Markdown", }), }); } 

How to Log and Analyze?

Structured logs (JSON) with mandatory fields: timestamp, level, event, data. For aggregation — Loki (paired with Grafana) or Datadog. Example:

import pino from "pino"; const logger = pino({ level: "info" }); logger.info({ event: "trade_executed", symbol: "ETHUSDT", side: "buy", amount: 0.5, price: 3400 }); logger.error({ event: "api_error", exchange: "binance", error: err.message, retryIn: 5000 }); 
Example error log
{"level":50,"time":1700000000000,"msg":"api_error","exchange":"binance","error":"rate limit exceeded","retryIn":5000} 

Logs help quickly find the root cause: for instance, you see that the order price is 2% off the market price — that's a slippage logic error.

Protection Against Complete Failure: Dead Man's Switch

For critical bots, we set up an external watchdog. If the bot doesn't "ping" for N minutes — automatically restart or send an SMS. The simplest implementation via healthchecks.io or Cronitor: the bot sends a GET request every 5 minutes, the service raises an alert if the ping is missed. This adds about 15% to the setup time but pays off after one night of downtime.

Turnkey Monitoring Setup Steps

  1. Analyze bot architecture and key metrics (2-3 hours)
  2. Integrate prom-client and export metrics (4-6 hours)
  3. Deploy Prometheus + Grafana + Alertmanager (2-3 hours)
  4. Configure Telegram bot and alert rules (2-4 hours)
  5. Dead man's switch and documentation (2-3 hours)

What's Included in Turnkey Monitoring Setup

Component Description Setup Time
Prometheus Metric collection from bot 2-3 hours
Grafana dashboard Visualization + alerts 4-6 hours
Alertmanager Notification rules 2 hours
Telegram bot Notification channel 1-2 hours
Dead man's switch Watchdog 1 hour
Documentation Description of metrics and alerts 2 hours

Notification Method Comparison

Channel Delivery Speed Reliability Cost
Telegram 1-3 sec High Free
Email 30 sec - 5 min Medium Free
SMS 5-10 sec High Paid

We also train your team on dashboard usage and provide access to a configuration repository. Setup time ranges from 1 business day for a basic version to 5 days for complex integrations with on-chain and custom metrics. For reference: Prometheus and Grafana are the core tools of the stack. Our team has over 5 years of experience in crypto development. We guarantee a resilient setup with certified engineers. Contact us for a project assessment — get a consultation and a preliminary cost estimate.