DEV Community

Andrey
Andrey

Posted on

API connection failed

Hey, so I finally automated our Cacti reports with Cacti-ReportIt...

You know how every month I spend like an hour manually exporting graphs from Cacti and pasting them into a Word doc for the management report? Yeah. So I tried Cacti-ReportIt – that macOS app that connects directly to Cacti and generates automated PDF reports – and honestly, it's a huge time-saver. But of course, getting it to actually connect to our Cacti server was a whole thing.

The "API connection failed" wall

So I installed Cacti-ReportIt, launched it, entered our Cacti server URL, username, password... and got "API connection failed – check credentials." But I could log into the Cacti web interface just fine with those same credentials. Spent way too long resetting passwords and checking network connectivity.

First dumb move: I assumed it was a firewall thing. Checked ports, tried from different networks, even temporarily disabled the firewall. Same error.

What I didn't realize is that modern Cacti installations often have the JSON API disabled by default for security. Cacti-ReportIt needs that API to fetch data, and our server didn't have it enabled.

What actually fixed it

On the Cacti server, I had to:

  1. Install the JSON API plugin if not already present
  2. Enable it in Cacti's plugin management
  3. Create a dedicated API user with the right permissions (the admin account worked, but best practice is a separate user with read-only access to graphs/data)

After that, Cacti-ReportIt connected immediately. The Cacti JSON API docs explain the setup, and I found this Cacti-ReportIt setup guide that walked through the API configuration step by step. Also the Cacti forums had some useful threads about API permissions.

Quick checklist for next time

  • Verify JSON API is installed and enabled – it's not always there by default
  • Create a dedicated API user with at least "Viewer" permissions on graphs
  • Test the API directly – visiting https://your-cacti-server/api_json.php should show something, not just an error
  • Check Cacti's log – it often shows why API calls are failing

Once I got the connection working, Cacti-ReportIt is exactly what I needed. Now I have scheduled reports that automatically generate at the end of each month, formatted nicely with all the bandwidth graphs management wants to see. The Cacti-ReportIt template gallery has some good starting points.

Anyway, if you're still manually screenshotting Cacti graphs, do yourself a favor and set this up. Let me know if you need help with the API config.

Catch you later

Top comments (0)