tutorial

Monitoring Snowflake with Vigilmon: Query Health Checks, Warehouse Heartbeats & Data Pipeline Uptime

Practical guide to uptime monitoring for Snowflake — HTTP health endpoints, warehouse heartbeat pings, data pipeline watchdogs, and alerting with Vigilmon.

Snowflake is invisible to your users — until it isn't. A suspended warehouse, a runaway query consuming all credits, a failed data load: none of these fire a visible alarm by default. Snowflake's built-in Resource Monitors help cap spend, but they don't tell your application team when the data warehouse is unreachable or when a nightly pipeline silently stopped running. Vigilmon provides an external, independent health check that fires alerts even when your Snowflake account itself has a problem.

This tutorial shows you how to wire Snowflake into Vigilmon for availability monitoring, pipeline heartbeats, and smart alert thresholds.

What You'll Build

  • A lightweight Python health endpoint that probes Snowflake connectivity
  • A Vigilmon HTTP monitor that checks Snowflake reachability from outside your VPC
  • A heartbeat monitor for nightly ELT jobs
  • A per-warehouse alerting strategy

Prerequisites

  • A Snowflake account with at least one active warehouse
  • Python 3.9+ with snowflake-connector-python installed
  • A free account at vigilmon.online

Step 1: Build a Snowflake Health Endpoint

Run a minimal Flask (or FastAPI) service that authenticates to Snowflake and validates the warehouse is active. Deploy it on your application server or a small cloud VM — Vigilmon will probe it from the outside.

# health_server.py
import os
import json
import snowflake.connector
from flask import Flask, jsonify

app = Flask(__name__)

SNOWFLAKE_CONFIG = {
    "user": os.environ["SNOWFLAKE_USER"],
    "password": os.environ["SNOWFLAKE_PASSWORD"],
    "account": os.environ["SNOWFLAKE_ACCOUNT"],
    "warehouse": os.environ["SNOWFLAKE_WAREHOUSE"],
    "database": os.environ["SNOWFLAKE_DATABASE"],
    "schema": os.environ.get("SNOWFLAKE_SCHEMA", "PUBLIC"),
}

@app.route("/health")
def health():
    checks = {}
    ok = True

    try:
        ctx = snowflake.connector.connect(**SNOWFLAKE_CONFIG)
        cursor = ctx.cursor()

        # Lightweight connectivity probe
        cursor.execute("SELECT CURRENT_VERSION()")
        row = cursor.fetchone()
        checks["snowflake_version"] = row[0]

        # Warehouse state check
        cursor.execute(f"SHOW WAREHOUSES LIKE '{SNOWFLAKE_CONFIG['warehouse']}'")
        wh_rows = cursor.fetchall()
        if wh_rows:
            wh_state = wh_rows[0][3]  # state column
            checks["warehouse_state"] = wh_state
            if wh_state not in ("STARTED", "SUSPENDED"):
                ok = False
                checks["warehouse_error"] = "unexpected warehouse state"
        else:
            ok = False
            checks["warehouse_error"] = "warehouse not found"

        cursor.close()
        ctx.close()
    except Exception as e:
        checks["snowflake_error"] = str(e)
        ok = False

    status_code = 200 if ok else 503
    return jsonify({"status": "ok" if ok else "degraded", "checks": checks}), status_code

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=8080)

Start the server and expose it on a port reachable from the internet (or via a public reverse proxy):

pip install flask snowflake-connector-python
python health_server.py

Step 2: Configure the Vigilmon HTTP Monitor

  1. Log in to VigilmonAdd Monitor → HTTP.
  2. URL: https://your-server.example.com/health
  3. Check interval: 60 seconds.
  4. Response timeout: 15 seconds — Snowflake connection setup can take 3–5 seconds on a cold pool.
  5. Expected status: 200.
  6. JSON assertion: path status, expected value ok.

Tip: Use a dedicated Snowflake service account with a MONITOR role and minimal privileges. Never expose your ACCOUNTADMIN credentials to a health-check service.


Step 3: Heartbeat Monitor for ELT Pipelines

If you run nightly ELT jobs (dbt, Fivetran, custom Python pipelines) that load data into Snowflake, a standard HTTP monitor won't detect a silently failed job. Wire a heartbeat ping into the end of your pipeline.

dbt project hook

Add a post-hook to your dbt_project.yml that pings Vigilmon on successful completion:

# dbt_project.yml
on-run-end:
  - "{{ run_results | selectattr('status', 'equalto', 'success') | list | length > 0 and log('dbt run succeeded', info=True) }}"

Then call the heartbeat from your CI runner or orchestration script after dbt run:

#!/bin/bash
set -e

dbt run --profiles-dir .

# Ping Vigilmon only on success
curl -s -X POST "$VIGILMON_HEARTBEAT_URL"
echo "dbt pipeline complete — heartbeat sent"

Python pipeline

import os
import requests

def run_etl():
    # ... your Snowflake data loading logic ...
    pass

if __name__ == "__main__":
    try:
        run_etl()
        # Ping Vigilmon heartbeat on success
        requests.post(os.environ["VIGILMON_HEARTBEAT_URL"], timeout=5)
        print("ETL complete — heartbeat sent")
    except Exception as e:
        print(f"ETL failed — heartbeat withheld: {e}")
        raise

In Vigilmon, create a Heartbeat monitor and set the grace period to match your schedule plus a buffer:

| Schedule | Recommended grace period | |---|---| | Every 15 minutes | 20 minutes | | Hourly | 75 minutes | | Nightly (12 AM) | 26 hours |

Store the heartbeat URL in your secrets manager or CI/CD environment variables — never hardcode it.


Step 4: Per-Warehouse Alerting Strategy

Large Snowflake accounts run multiple warehouses for different workloads. Monitor them independently so a BI warehouse suspension doesn't wake up your data engineering on-call.

Create one health endpoint per warehouse (parameterize by environment variable) and one Vigilmon monitor per warehouse:

| Warehouse | Monitor name | Alert channel | |---|---|---| | TRANSFORM_WH | Snowflake Transform | Data Engineering Slack | | BI_WH | Snowflake BI | Analytics Team Slack | | PROD_API_WH | Snowflake API Prod | On-call PagerDuty |

Group all warehouse monitors under a single Status Page so stakeholders see one aggregate Snowflake health view.


Step 5: Alerting Configuration

| Alert type | Recommended channel | |---|---| | Primary on-call | Email or PagerDuty webhook | | Team visibility | Slack webhook | | Business stakeholders | Public Vigilmon status page |

Set alert escalation: notify immediately on first failure, re-notify after 5 minutes if still down. Snowflake warehouse auto-suspension is normal — configure your health endpoint to return 200 for SUSPENDED state if that's expected behavior, and only return 503 for error states like FAILED or unreachability.


What Vigilmon Catches That Snowflake Resource Monitors Miss

| Scenario | Resource Monitor | Vigilmon | |---|---|---| | Warehouse unreachable from app | No visibility | HTTP monitor catches immediately | | Nightly pipeline silently stopped | No coverage | Heartbeat grace period fires alert | | Snowflake account outage | Alarm may not fire | External check — unaffected | | Slow query causing app timeout | No alert | Response timeout triggers alert | | BI warehouse suspended mid-day | Credit limit alert only | HTTP monitor catches immediately |


Data teams move fast. Pipelines break silently. External monitoring from Vigilmon gives your team an independent signal that catches failures your internal tooling misses.

Start monitoring your Snowflake warehouse in under 5 minutes — register free at vigilmon.online.

Monitor your app with Vigilmon

Free plan — 5 monitors, no credit card required. Up and running in 60 seconds.

Start free →