Troubleshooting MRTG: Common Issues and Quick Fixes

Troubleshooting MRTG: Common Issues and Quick Fixes

1. Graphs not updating

  • Cause: mrtg process/crontab not running or incorrect permissions.
  • Fix: Ensure mrtg is scheduled (crontab or systemd timer). Run mrtg manually:

    bash

    /usr/bin/mrtg /etc/mrtg.cfg

    Check file ownership and permissions for generated HTML/PNG files; adjust with chown/chmod.

2. Incorrect or flatlined data

  • Cause: Wrong SNMP community, host, interface OID, or SNMP version mismatch.
  • Fix: Test SNMP with snmpwalk/snmpget:

    bash

    snmpwalk -v2c -c public router.example.com .1.3.6.1.2.1.2.2.1.10

    Update MRTG target lines to use correct OIDs and SNMP version.

3. High CPU or slow rendering

  • Cause: Large number of targets or frequent polling interval.
  • Fix: Increase polling interval, stagger cron jobs, or run multiple mrtg instances on different threads/hosts. Enable rrdtool backend to reduce load.

4. Permission denied saving graphs

  • Cause: Web server user can’t write output directory.
  • Fix: Set outputdir writable by web server (e.g., chown www-data:www-data /var/www/mrtg -R) and secure permissions.

5. Time/date on graphs wrong

  • Cause: Server timezone mismatch or incorrect system time.
  • Fix: Sync time with NTP/chrony and ensure PHP/HTTP server and mrtg use same timezone.

6. Missing PNG generation

  • Cause: rrdtool or GD library missing, or mrtg compiled without PNG support.
  • Fix: Install rrdtool and required image libs; rebuild mrtg if necessary. Verify mrtg output mentions rrdtool usage.

7. Alerts/thresholds not triggering

  • Cause: Wrong mrtg.cfg threshold settings or missing cfg include.
  • Fix: Verify AbsMax, MaxBytes, and Target[…] options; test with known values and check log output.

8. Duplicate or overlapping graphs

  • Cause: Multiple cfgs referencing same target or include order issues.
  • Fix: Consolidate targets, remove duplicates, and ensure unique SetEnv/Target lines.

9. SSL/HTTPS access problems for generated pages

  • Cause: Web server misconfiguration or mixed-content blocking images.
  • Fix: Serve images over HTTPS, update base URLs, and fix webserver virtual host settings.

10. Debugging tips and logs

  • Run mrtg in debug/verbose mode:

    bash

    mrtg –logging /var/log/mrtg.log /etc/mrtg.cfg
  • Check syslog, web server logs, and SNMP agent logs. Use snmpwalk/snmpget to confirm device responses.

If you want, I can generate a checklist customized to your mrtg.cfg or help debug specific errors—paste the relevant config lines or log output.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *