tutorial

Monitoring Piwigo with Vigilmon

Piwigo is a mature self-hosted photo gallery — here's how to monitor its web interface, REST API, admin backend, SSL certificate, and background maintenance tasks with Vigilmon.

Piwigo is one of the most established self-hosted photo gallery platforms: a PHP/MySQL web application that lets photographers, camera clubs, museums, and families organize and share large photo collections without relying on Flickr, Smugmug, or cloud providers. Because Piwigo runs as a PHP application backed by MySQL with periodic background tasks for thumbnail generation and metadata sync, it has several failure points that won't surface until a visitor hits the gallery or an admin notices photos are stale. Vigilmon monitors Piwigo end-to-end: the gallery homepage, the REST API, the admin backend, SSL certificate validity, and a heartbeat that confirms the database and gallery data layer are healthy.

What You'll Set Up

  • HTTP monitor for the Piwigo gallery homepage (port 80/443)
  • HTTP monitor for the Piwigo REST API health endpoint (/ws.php)
  • HTTP monitor for the Piwigo admin login page (/admin.php)
  • SSL certificate expiry alerts for HTTPS Piwigo deployments
  • Heartbeat monitor that confirms the database is populated and background maintenance is healthy

Prerequisites

  • Piwigo deployed and accessible (Apache or Nginx serving PHP on port 80 or 443)
  • A free Vigilmon account

Step 1: Monitor the Piwigo Gallery Homepage

The Piwigo homepage is served by Apache or Nginx at the root URL. A GET / returns the photo gallery front page — a 200 response confirms PHP is running, the web server is healthy, and Piwigo can render the gallery template.

  1. Log in to vigilmon.online and click Add Monitor.
  2. Set Type to HTTP / HTTPS.
  3. Enter your Piwigo URL: http://your-server or https://photos.yourdomain.com.
  4. Set Check interval to 1 minute.
  5. Set Expected HTTP status to 200.
  6. Under Response body check, enter Piwigo to confirm the gallery application rendered rather than a generic web server error page.
  7. Click Save.

If your Piwigo instance requires login to view the gallery, the homepage may redirect to the login page — enable Follow redirects and check for the text Identification (the Piwigo login form title) to confirm the application is serving correctly.


Step 2: Monitor the Piwigo REST API

Piwigo's REST API lives at /ws.php. A GET /ws.php?format=json&method=pwg.getVersion returns a JSON response containing the installed Piwigo version string. This confirms not just that PHP is running, but that Piwigo's API layer has loaded its configuration and can reach MySQL — the API won't respond with version data if the database connection is broken.

  1. Click Add Monitor in Vigilmon.
  2. Set Type to HTTP / HTTPS.
  3. Enter the API URL: http://your-server/ws.php?format=json&method=pwg.getVersion
  4. Set Expected HTTP status to 200.
  5. Under Response body check, enter "result" to confirm the API returned a JSON result object rather than an error.
  6. Set Check interval to 5 minutes.
  7. Click Save.

A healthy response looks like:

{"stat":"ok","result":"14.5.0"}

If Piwigo cannot connect to MySQL, the API will return {"stat":"fail","err":...} — the body check for "result" will fail and Vigilmon will alert you.


Step 3: Monitor the Piwigo Admin Backend

The Piwigo admin panel at /admin.php confirms that PHP session handling is working and that the admin interface — which depends on the database for user authentication — is accessible. A GET /admin.php returns either the admin login form or (if already authenticated) the admin dashboard.

  1. Click Add Monitor in Vigilmon.
  2. Set Type to HTTP / HTTPS.
  3. Enter the admin URL: http://your-server/admin.php
  4. Set Expected HTTP status to 200.
  5. Under Response body check, enter identification (the French-origin term Piwigo uses for its login form) or piwigo-admin to confirm the admin interface loaded.
  6. Set Check interval to 5 minutes.
  7. Click Save.

If the admin backend is inaccessible while the gallery homepage still loads, this monitor will alert you to a partial failure — for example, a PHP session configuration problem or a broken admin.php file after an incomplete Piwigo update.


Step 4: SSL Certificate Alerts for HTTPS Deployments

Piwigo is commonly served over HTTPS directly via Apache/Nginx with Let's Encrypt. An expired certificate will immediately block all gallery visitors and API integrations.

  1. Open the HTTPS monitor for your Piwigo domain (created in Step 1).
  2. Enable Monitor SSL certificate under the SSL settings.
  3. Set Alert when certificate expires in less than 21 days.
  4. Click Save.

Verify that your certificate renewal process is active on the Piwigo server:

# Check the certificate expiry date
openssl s_client -connect photos.yourdomain.com:443 -servername photos.yourdomain.com \
  </dev/null 2>/dev/null | openssl x509 -noout -dates

# Test certbot renewal (if using Let's Encrypt)
certbot renew --dry-run

A 21-day alert window gives you three full weeks to investigate before visitors see browser security warnings.


Step 5: Heartbeat Monitoring for Database and Maintenance Health

The REST API being available does not confirm that the gallery has actual content or that Piwigo's periodic maintenance tasks are running. The pwg.getInfos method returns gallery statistics including photo count and category count — if this returns meaningful data, it confirms the database is populated and Piwigo's data layer is healthy. Thumbnail generation and metadata sync tasks run in the background; a scheduled heartbeat proves the full stack is operational.

Create the heartbeat monitor first:

  1. In Vigilmon, click Add MonitorCron Heartbeat.
  2. Set Expected ping interval to 60 minutes.
  3. Copy the heartbeat URL (e.g. https://vigilmon.online/heartbeat/abc123).

Then set up a cron job on the Piwigo host:

#!/bin/bash
# /etc/cron.hourly/piwigo-heartbeat

PIWIGO_URL="http://localhost"
VIGILMON_HEARTBEAT="https://vigilmon.online/heartbeat/abc123"

# Call pwg.getInfos — returns photo count and category count if DB is healthy
RESPONSE=$(curl -s "${PIWIGO_URL}/ws.php?format=json&method=pwg.getInfos")

# Check that the response contains "nb_elements" (total photo count field)
if echo "$RESPONSE" | grep -q '"nb_elements"'; then
  curl -s "${VIGILMON_HEARTBEAT}" > /dev/null
fi

Make the script executable:

chmod +x /etc/cron.hourly/piwigo-heartbeat

For Docker-based Piwigo deployments, run the check from the host:

docker exec piwigo curl -s "http://localhost/ws.php?format=json&method=pwg.getInfos" \
  | grep -q '"nb_elements"' && curl -s "https://vigilmon.online/heartbeat/abc123"

If the database becomes unreachable or gallery data is missing (for example after a failed migration), the pwg.getInfos response will not contain photo statistics and the heartbeat will not fire — alerting you before the gallery appears broken to visitors.


Step 6: Configure Alert Channels

  1. Go to Alert Channels in Vigilmon and add Slack, email, or a webhook.
  2. For the homepage and API monitors, set Consecutive failures before alert to 2 — PHP-FPM worker recycling can cause a single brief failure.
  3. For the heartbeat monitor, a single missed ping is enough to alert — set Grace period to 0.

Summary

| Monitor | Target | What It Catches | |---|---|---| | Gallery homepage | http://your-server/ | PHP/web server down, Piwigo not bootstrapping | | REST API | /ws.php?method=pwg.getVersion | API layer broken, MySQL unreachable | | Admin backend | /admin.php | Admin UI inaccessible, PHP session failure | | SSL certificate | Gallery domain | Let's Encrypt certificate expiry | | Cron heartbeat | Heartbeat URL | Database unpopulated, maintenance tasks stalled |

Piwigo stores years of irreplaceable photo memories — a silent MySQL failure or a stalled thumbnail worker can mean visitors see broken images or missing galleries without anyone knowing. With Vigilmon watching the gallery, API, and admin stack from multiple angles and a heartbeat that proves the database has live content, you'll catch failures in minutes rather than finding them the next time someone tries to share a photo album.

Monitor your app with Vigilmon

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

Start free →