tutorial

Monitoring Hastebin with Vigilmon

Hastebin is your self-hosted code snippet server — fast, minimal, and easy to lose track of when it quietly goes down. Here's how to monitor paste creation, retrieval, storage backends, TLS certificates, and cleanup jobs with Vigilmon.

Hastebin is an open source code and text paste server inspired by Pastebin, designed for quickly sharing code snippets with syntax highlighting. It runs as a Node.js application on port 7777 and supports multiple storage backends — Redis, Memcached, file-based, or S3 — giving you flexibility but also multiple failure points. When Hastebin goes down, developers lose access to shared snippets mid-workflow and paste links in chat history lead nowhere. Vigilmon keeps Hastebin reliably available by monitoring every critical layer, from paste creation to TLS certificate expiry.

What You'll Set Up

  • Web server availability monitor on port 7777
  • Paste creation endpoint response times (/documents POST)
  • Paste retrieval health (/raw/:key and /documents/:key)
  • Storage backend connectivity (Redis, Memcached, or file-based)
  • HTTPS/TLS certificate expiry alerts
  • Document expiry and cleanup job heartbeat
  • Disk space threshold monitoring for file-based storage

Prerequisites

  • Hastebin running at http://your-server:7777 (or behind a reverse proxy on port 80/443)
  • One of: Redis, Memcached, file, or S3 configured as the storage backend
  • A free Vigilmon account

Step 1: Monitor Web Server Availability

The first and most fundamental check is whether Hastebin's Node.js server is responding at all.

  1. Log in to vigilmon.online and click Add Monitor.
  2. Set Type to HTTP / HTTPS.
  3. Enter your Hastebin URL: http://your-server:7777 (or https://paste.yourdomain.com if behind a proxy).
  4. Set Check interval to 1 minute.
  5. Set Expected HTTP status to 200.
  6. Under Content verification, enter haste or about as a keyword to confirm the UI rendered.
  7. Click Save.

This catches Node.js crashes, port binding failures, and reverse proxy misconfigurations in one monitor.


Step 2: Monitor Paste Creation Endpoint

The /documents POST endpoint is the core write operation of Hastebin. A slow or broken paste creation endpoint means users can't save any new snippets.

  1. Click Add MonitorHTTP / HTTPS.
  2. URL: http://your-server:7777/documents.
  3. Set Method to POST.
  4. Add header Content-Type: text/plain.
  5. Set Request body to vigilmon-health-check (a harmless test document).
  6. Set Expected HTTP status to 200.
  7. Set Response time threshold to 2000ms — paste creation should be near-instant.
  8. Click Save.

A successful response from /documents returns a JSON body like {"key":"abc123"}. If your Vigilmon plan supports body assertions, verify the response contains "key" to confirm the write completed successfully rather than returning an error JSON.

Note: This monitor will create a real document in your Hastebin storage on every check. Most storage backends handle this gracefully, but if you want to avoid accumulating test documents, use a separate cleanup rule or monitor only with GET checks as described in the next step.


Step 3: Monitor Paste Retrieval Endpoints

Reads are the most frequent operation — every time someone opens a shared link, Hastebin fetches from storage. Monitor both retrieval paths:

Raw content endpoint. First, create a permanent test document manually in Hastebin and note its key (e.g. test1234).

  1. Click Add MonitorHTTP / HTTPS.
  2. URL: http://your-server:7777/raw/test1234.
  3. Expected status: 200.
  4. Content verification: enter the first few words of your test document.
  5. Set Check interval to 2 minutes.

JSON documents endpoint.

  1. Click Add MonitorHTTP / HTTPS.
  2. URL: http://your-server:7777/documents/test1234.
  3. Expected status: 200.
  4. Content verification: "data" (confirms the JSON payload structure is intact).

If either retrieval monitor fails while the web server monitor passes, the storage backend has a read-path failure — a more specific and actionable alert.


Step 4: Monitor the Storage Backend

The storage backend is the most common cause of Hastebin outages. Choose the monitor type that matches your configuration.

Redis backend:

  1. Click Add MonitorTCP Port.
  2. Host: localhost (or your Redis host), Port: 6379.
  3. Set Check interval to 1 minute.

For a more complete Redis health check, add a script probe:

#!/bin/bash
redis-cli -h localhost PING | grep -q PONG && echo "ok" || echo "error"

Wrap this in an HTTP endpoint and monitor it expecting ok.

Memcached backend:

  1. Click Add MonitorTCP Port.
  2. Host: localhost, Port: 11211.
  3. Set Check interval to 1 minute.

File-based backend. There's no port to probe for file storage — monitor disk space instead:

#!/bin/bash
# /opt/hastebin/scripts/disk-health.sh
STORE_DIR="/opt/hastebin/data"
USAGE=$(df -P "$STORE_DIR" | awk 'NR==2 {print $5}' | tr -d '%')
if [ "$USAGE" -gt 85 ]; then
  echo "error: disk ${USAGE}% full"
  exit 1
fi
echo "ok: disk ${USAGE}% used"

Expose this via a local HTTP server and add a Vigilmon HTTP monitor expecting ok in the response body. Alert when disk usage exceeds 85% — at 95% Hastebin will start failing writes with no visible warning to users.

S3 backend. Monitor S3 connectivity:

  1. Click Add MonitorHTTP / HTTPS.
  2. URL: https://s3.amazonaws.com (or your S3-compatible endpoint).
  3. Expected status: 200 or 403 — both confirm S3 is reachable.

Step 5: Monitor TLS Certificate Expiry

If Hastebin is exposed over HTTPS (via nginx or Caddy as a reverse proxy), a lapsed TLS certificate will immediately break all paste links for every user.

  1. Open the HTTP monitor for your Hastebin URL (from Step 1).
  2. Enable Monitor SSL certificate.
  3. Set Alert when certificate expires in less than 21 days.
  4. Save.

A 21-day window gives you enough time to investigate and renew without a service interruption. If you use Let's Encrypt, verify auto-renewal is working by checking the renewal log:

# Confirm certbot renewed recently
grep "renewal" /var/log/letsencrypt/letsencrypt.log | tail -5

Vigilmon's SSL alert is an independent safety net for when auto-renewal silently fails.


Step 6: Heartbeat for Document Expiry and Cleanup Jobs

Hastebin supports document expiry — old pastes are removed after a configurable period. If the cleanup job fails, storage fills up over time and write operations eventually fail.

  1. In Vigilmon, click Add MonitorCron Heartbeat.
  2. Set the expected interval to match your cleanup schedule (e.g. 60 minutes for hourly cleanup).
  3. Copy the heartbeat URL: https://vigilmon.online/heartbeat/abc123.

Add the ping to your cleanup script or cron job:

#!/bin/bash
# /opt/hastebin/scripts/cleanup.sh
node /opt/hastebin/server.js --cleanup 2>&1 | logger -t hastebin-cleanup
if [ $? -eq 0 ]; then
  curl -s https://vigilmon.online/heartbeat/abc123
fi

Or if using a built-in expiry mechanism in Hastebin's config, wrap the Node.js process startup in a systemd service with a ExecStartPost hook that pings Vigilmon on successful startup.


Step 7: Configure Alert Channels

  1. Go to Alert Channels in Vigilmon and connect Slack, email, or a webhook.
  2. For the paste creation monitor, set Consecutive failures before alert to 2 — transient POST failures are more common than persistent ones.
  3. For web server availability, set it to 2 — a brief Node.js restart shouldn't wake anyone.
  4. For the storage backend TCP monitors, set to 1 — a storage outage is immediately critical and should alert right away.
  5. For the SSL certificate monitor, use Email for advance warning — no need for an on-call wake.

Summary

| Monitor | Target | What It Catches | |---|---|---| | Web server | http://your-server:7777 | Node.js crash, port failure | | Paste creation | POST /documents | Write path broken, storage rejecting writes | | Raw retrieval | GET /raw/:key | Read path failure | | JSON retrieval | GET /documents/:key | API deserialization broken | | Redis/Memcached (TCP) | localhost:6379 or 11211 | Backend connectivity | | Disk space (file) | Script probe | Storage nearly full | | S3 connectivity | S3 endpoint HTTP | Object storage unreachable | | TLS certificate | HTTPS monitor | Certificate expired or expiring | | Cleanup heartbeat | Heartbeat URL | Expiry job crashed, storage growing |

Hastebin's simplicity is its strength, but that simplicity can also make failures invisible — there are no admin dashboards or built-in health endpoints to check. With Vigilmon probing every write path, read path, and storage backend on a schedule, you get immediate visibility into Hastebin availability without any changes to Hastebin's source code.

Monitor your app with Vigilmon

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

Start free →