tutorial

Monitoring Polr with Vigilmon

Polr is a self-hosted Laravel URL shortener with multi-user support and click analytics — here's how to monitor its web UI, REST API, queue workers, and SSL certificates with Vigilmon.

Polr is a feature-complete self-hosted URL shortener built on Laravel — giving you branded short links, per-user API keys, custom aliases, and detailed click analytics without relying on Bit.ly or TinyURL. Running your own Polr instance means owning your link data and analytics pipeline, but it also means you own the uptime. Vigilmon monitors your Polr web application, REST API, and queue workers so link creation and analytics stay healthy around the clock.

What You'll Set Up

  • HTTP monitor for the Polr web application
  • REST API health check via the link lookup endpoint
  • Write-path heartbeat that tests database inserts end-to-end
  • SSL certificate expiry alerts for your Polr domain
  • Laravel queue worker health via scheduled API calls

Prerequisites

  • Polr installed and accessible over HTTP/HTTPS (port 80 or 443)
  • A valid Polr API key (generated in the Polr admin panel under API Settings)
  • A known short link alias for lookup testing
  • A free Vigilmon account

Step 1: Monitor the Polr Web Application

The Polr homepage confirms that nginx (or Apache) is serving traffic and the Laravel application has booted. A redirect to /login is normal for private-mode Polr — add a keyword check rather than relying solely on status code.

  1. Log in to vigilmon.online and click Add Monitor.
  2. Set Type to HTTP / HTTPS.
  3. Enter your Polr URL: https://s.yourdomain.com/
  4. Set Check interval to 1 minute.
  5. Set Expected HTTP status to 200 (or 302 if you expect a login redirect — Vigilmon lets you specify either).
  6. Under Keyword check, enter Polr to confirm the response body is your application, not an nginx default page.
  7. Click Save.

If Polr returns a 500 error (common when the .env is misconfigured or the database is unreachable), Vigilmon alerts immediately.


Step 2: Monitor the Polr REST API

Polr's REST API lives at /api/v2/. The link lookup endpoint validates a short alias and returns the destination URL — a perfect health check that exercises both the API layer and the database query path:

GET https://s.yourdomain.com/api/v2/links/lookup?url_ending={your-test-alias}&key={api-key}

Expected response:

{
  "action": "lookup",
  "result": "https://example.com/your-long-url"
}

Add this as a monitor in Vigilmon:

  1. Click Add MonitorHTTP / HTTPS.
  2. URL: https://s.yourdomain.com/api/v2/links/lookup?url_ending=test&key=YOUR_API_KEY (replace test with an alias you created in Polr)
  3. Expected status: 200.
  4. Keyword check: result — confirms the JSON contains a resolved URL.
  5. Check interval: 2 minutes.
  6. Click Save.

If the API key is revoked or the database is down, the response body will contain error instead of result, triggering the keyword mismatch alert.


Step 3: Monitor the Polr Write Path

Read-path API calls can succeed even when the database write path is degraded. To validate that Polr can create new short links (the core operation), use a scheduled POST to create a private test link:

POST https://s.yourdomain.com/api/v2/links?key={api_key}&url=https://vigilmon.online&is_secret=1

Expected response:

{
  "action": "shorten",
  "result": "https://s.yourdomain.com/abc123"
}

In Vigilmon:

  1. Click Add MonitorCron Heartbeat.
  2. Set Expected ping interval to 10 minutes.
  3. Copy the heartbeat URL.
  4. On your server, create a script that posts a test link and pings the heartbeat only on success:
#!/bin/bash
RESPONSE=$(curl -sf -X POST \
  "https://s.yourdomain.com/api/v2/links?key=YOUR_API_KEY&url=https%3A%2F%2Fvigilmon.online&is_secret=1")

if echo "$RESPONSE" | grep -q '"action":"shorten"'; then
  curl -s https://vigilmon.online/heartbeat/abc123
fi

Schedule it every 10 minutes:

*/10 * * * * /opt/polr-healthcheck.sh

This catches write failures that read-only API checks miss — such as a full disk, a locked MySQL table, or an exhausted database connection pool.

Cleanup: Private (secret) links are not indexed publicly, but periodically delete test links via the Polr admin panel or the API to keep the link count tidy.


Step 4: SSL Certificate Alerts for Your Polr Domain

Polr is typically deployed with a Let's Encrypt certificate behind nginx. Auto-renewal can silently fail if port 80 is firewalled, the webroot path is wrong, or the renewal cron is missing.

Enable SSL monitoring on your Polr HTTP monitor:

  1. Open the monitor created in Step 1.
  2. Enable Monitor SSL certificate.
  3. Set Alert when certificate expires in less than 21 days.
  4. Click Save.

Check Certbot renewal status manually:

certbot certificates
# shows expiry dates

certbot renew --dry-run
# tests renewal without making changes

If renewal fails, force it:

certbot renew --force-renewal
systemctl reload nginx

Step 5: Verify the Laravel Queue Worker

Polr processes click analytics asynchronously using Laravel queues. If the queue worker (php artisan queue:work) stops, clicks are still recorded in the database but the analytics processing pipeline stalls. The queue backlog grows until the worker restarts.

To verify the queue worker is processing jobs, check the queue table in MySQL:

# Count pending jobs — should stay near zero in healthy operation
mysql -u polr -p polr_db -e "SELECT COUNT(*) FROM jobs;"

Alternatively, monitor the queue depth with a Vigilmon heartbeat:

  1. Create a Cron Heartbeat with a 5-minute expected interval.
  2. On the server, run a check that pings only when the queue is draining:
#!/bin/bash
PENDING=$(mysql -u polr -p"$DB_PASS" polr_db -se "SELECT COUNT(*) FROM jobs;")
if [ "$PENDING" -lt 100 ]; then
  curl -s https://vigilmon.online/heartbeat/queue-abc123
fi

If the queue exceeds 100 pending jobs, the heartbeat is skipped and Vigilmon alerts after 5 minutes — indicating the worker has stopped.


Step 6: Configure Alert Channels

  1. Go to Alert Channels in Vigilmon and add email, Slack, or webhook notification channels.
  2. Set Consecutive failures before alert to 2 on the web application monitor — Laravel's boot sequence can occasionally cause a single slow response.
  3. Set Consecutive failures to 1 on the write-path heartbeat — a failed link creation means the core Polr function is broken.

Summary

| Monitor | Target | What It Catches | |---|---|---| | Web application | / | nginx down, Laravel boot failure | | API lookup | /api/v2/links/lookup | API broken, database read failure | | Write-path heartbeat | POST /api/v2/links | Database write failure, disk full | | SSL certificate | Your short domain | Let's Encrypt renewal failure | | Queue worker heartbeat | MySQL jobs table | Queue worker stopped, analytics stalled |

Polr gives you a modern, multi-user URL shortener with analytics you fully own. With Vigilmon monitoring the web UI, API, write path, SSL, and queue worker, you catch the full range of failure modes — from a downed web server to a silently stalled analytics pipeline.

Monitor your app with Vigilmon

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

Start free →