tutorial

Monitoring Cacti with Vigilmon

Cacti is your self-hosted RRDtool-powered network graphing platform — but it has no built-in uptime alerts. Here's how to monitor the Cacti web UI, database health, poller heartbeat, and SSL certificates with Vigilmon.

Cacti is a mature open-source network graphing solution built on RRDtool. It polls routers, switches, and servers via SNMP, stores time-series data, and renders bandwidth and performance graphs. But Cacti itself has no built-in availability monitoring — if the web UI goes down or the scheduled poller stops running, you won't know unless you're watching. Vigilmon fills that gap, watching the Cacti login page, database connectivity, SSL certificates, and the critical cron-based poller that feeds your graphs.

What You'll Set Up

  • HTTP uptime monitor for the Cacti web UI (/cacti/ login page)
  • Database connectivity check via HTTP response body inspection
  • SSL certificate expiry alerts for HTTPS-enabled Cacti setups
  • Cron heartbeat for the Cacti poller (runs every 5 minutes)

Prerequisites

  • Cacti 1.2+ installed on a Linux server (Apache or nginx frontend)
  • Cacti accessible over HTTP or HTTPS at /cacti/
  • A free Vigilmon account

Step 1: Monitor the Cacti Web UI

The Cacti login page at /cacti/ is the primary availability signal. If Apache, nginx, or the PHP backend is down, this page will fail to load.

  1. Log in to vigilmon.online and click Add Monitor.
  2. Set Type to HTTP / HTTPS.
  3. Enter your Cacti URL: https://cacti.yourdomain.com/cacti/ (or http://your-server-ip/cacti/).
  4. Set Check interval to 1 minute.
  5. Set Expected HTTP status to 200.
  6. Click Save.

To verify the page content is actually the login form and not an error page:

  1. Open the monitor settings.
  2. Enable Keyword check.
  3. Enter Login to Cacti as the expected keyword — this text appears in the Cacti login page title.
  4. Click Save.

A keyword match confirms the PHP application is rendering correctly, not just that the web server is returning 200 for an error page.


Step 2: Check Database Connectivity via HTTP Response

Cacti stores all device, graph, and poller data in MySQL/MariaDB. A database failure causes Cacti to show an error page instead of the login form. The keyword check from Step 1 already catches this, but you can make the database check more explicit by adding a dedicated status endpoint.

Create a lightweight PHP health check script at /var/www/html/cacti/health.php:

<?php
$db = new mysqli(
    DB_HOST ?? 'localhost',
    DB_USER ?? 'cactiuser',
    DB_PASS ?? '',
    DB_NAME ?? 'cacti'
);
if ($db->connect_error) {
    http_response_code(503);
    echo json_encode(['status' => 'db_error', 'error' => $db->connect_error]);
    exit;
}
$db->close();
echo json_encode(['status' => 'ok']);

Replace the credentials with your actual Cacti database settings from /etc/cacti/db.php or your config.php. Then add a second Vigilmon monitor:

  1. Click Add MonitorHTTP / HTTPS.
  2. URL: https://cacti.yourdomain.com/cacti/health.php.
  3. Enable Keyword check with expected value "status":"ok".
  4. Set Expected HTTP status to 200.
  5. Click Save.

This monitor fires independently of the UI check, isolating database failures from web server failures.


Step 3: Verify the Cacti Poller is Running

The Cacti poller (poller.php) is the heart of the system — it collects SNMP data on a schedule (typically every 5 minutes via cron) and populates the RRD files that feed your graphs. A silent poller failure means your graphs flatline without any alert.

Check your cron entry:

crontab -l -u www-data
# or
cat /etc/cron.d/cacti

A typical entry looks like:

*/5 * * * * www-data php /usr/share/cacti/poller.php > /dev/null 2>&1

To verify poller health, check the Cacti log for recent activity:

tail -20 /var/log/cacti/cacti.log

You should see entries like POLLER: Time: X.XX seconds for every 5-minute run. Use Vigilmon's heartbeat monitor (Step 5) to get alerted if these runs stop.


Step 4: SSL Certificate Alerts for HTTPS-Enabled Cacti

If your Cacti instance is served over HTTPS (recommended for any internet-accessible setup), configure certificate expiry monitoring:

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

For Let's Encrypt certificates auto-renewed via Certbot, verify your renewal timer:

systemctl status certbot.timer
# Should show: active (waiting)

# Test renewal without actually renewing
certbot renew --dry-run

A 21-day alert window gives you three renewal cycles to catch failures before the certificate expires. If you use a commercial certificate with annual renewal, set the alert threshold to 30 days.


Step 5: Heartbeat Monitoring for the Cacti Poller

The cron-based poller runs silently in the background. Vigilmon's cron heartbeat monitor detects when it stops — even if the server and web UI remain up.

  1. In Vigilmon, click Add MonitorCron Heartbeat.
  2. Set Expected ping interval to 5 minutes (matching your poller cron schedule).
  3. Set Grace period to 2 minutes to account for poller runtime variation.
  4. Copy the heartbeat URL, for example: https://vigilmon.online/heartbeat/abc123.

Add the heartbeat ping to your Cacti poller cron entry:

# Edit /etc/cron.d/cacti
*/5 * * * * www-data php /usr/share/cacti/poller.php > /dev/null 2>&1 && curl -s https://vigilmon.online/heartbeat/abc123

The && operator ensures the ping only fires when the poller exits successfully (exit code 0). If the poller crashes or the cron job is disabled, Vigilmon alerts after 7 minutes (5-minute interval + 2-minute grace period).

For Cacti setups running the spine binary poller instead of poller.php, wrap both in a shell script:

#!/bin/bash
# /usr/local/bin/cacti-poller.sh
php /usr/share/cacti/poller.php > /dev/null 2>&1
if [ $? -eq 0 ]; then
    curl -s https://vigilmon.online/heartbeat/abc123
fi

Then update cron to call the wrapper script.


Step 6: Configure Alert Channels

  1. Go to Alert Channels in Vigilmon and add email, Slack, or a webhook.
  2. Set Consecutive failures before alert to 2 on the web UI monitor — short network glitches should not page you.
  3. Set Consecutive failures before alert to 1 on the database health monitor — a database failure is always critical.
  4. Use Maintenance windows to suppress alerts during Cacti upgrades:
# Before upgrading Cacti
curl -X POST https://vigilmon.online/api/maintenance \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"monitor_id": "abc123", "duration_minutes": 15}'

# Run the upgrade
apt upgrade cacti

# Maintenance window expires automatically

Summary

| Monitor | Target | What It Catches | |---|---|---| | Web UI availability | /cacti/ login page | Apache/nginx/PHP down, app errors | | Database health | /cacti/health.php | MySQL/MariaDB connection failure | | SSL certificate | HTTPS domain | Certificate expiry, renewal failure | | Cron heartbeat | Heartbeat URL | Poller crash, cron job disabled |

Cacti has been graphing networks reliably for over two decades — but it doesn't watch itself. With Vigilmon monitoring the web UI, database, SSL certificate, and cron poller, you get complete observability of the tool that gives you observability over your network.

Monitor your app with Vigilmon

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

Start free →