Monitoring APIs with Grafana

DreamFactory, Prometheus, Docker, and Grafana
DreamFactory, Prometheus, Docker, and Grafana

Now that we have explored monitoring apis with Prometheus, lets take a look at monitoring our APIs with Grafana. You may have noticed from the previous blog that Prometheus is awesome, but takes some time to fully flesh out and their dashboards aren’t the best. Good thing Grafana specializes in data visualization. We will not even have to configure all our Prometheus queries, so let’s get started.

Monitoring APIs with Grafana

We first need to confirm everything is running, if so your output should look similar to the above image. If you are not familiar with getting everything up and running please reference our previous blog. By navigating to 127.0.0.1:3000 you should see the Grafana home page. If you are not familiar with Grafana you may be wondering where the dashboards are. They are all located in the top left dropdown where we will see 4 pre-configured dashboards. Let’s review each of them to understand what each of them does.

Docker Host Dashboard

The Docker Host Dashboard shows metrics for monitoring the usage of the server. Thanks to dockerprom(link github repo) for pre-configuring all this we can now see:

  • Server uptime, CPU idle percent, number of CPU cores, available memory, swap and storage.
  • System load average graph, running and blocked by IO processes graph, interrupts graph.
  • CPU usage graph by mode (guest, idle, iowait, irq, nice, softirq, steal, system, user).
  • Memory usage graph by distribution (used, free, buffers, cached).
  • IO usage graph (read Bps, read Bps and IO time).
  • Network usage graph by device (inbound Bps, Outbound Bps).
  • Swap usage and activity graphs.

Monitoring APIs with Grafana

Docker Containers Dashboard

The Docker Containers Dashboard shows key metrics for monitoring running containers:

  • Total containers CPU load, memory and storage usage.
  • Running containers graph, system load graph, IO usage graph.
  • Container CPU usage graph.
  • Memory usage graph.
  • Cached memory usage graph.
  • Network inbound usage graph.
  • Container network outbound usage graph.

Monitoring APIs with Grafana

Monitor Services Dashboard

The Monitor Services Dashboard shows key metrics for monitoring the containers that make up the monitoring stack:

  • Prometheus container uptime, monitoring stack total memory usage, Prometheus local storage memory chunks and series.
  • Container CPU usage graph.
  • Memory usage graph.
  • Prometheus chunks to persist and persistence urgency graphs.
  • Chunks ops and checkpoint duration graphs.
  • Samples ingested rate, target scrapes and scrape duration graphs.
  • Alerts graph.

Monitoring APIs with Grafana

Conclusion

We now have a fully functioning monitoring tool with no code. Isn’t that awesome? A no code API tool and a no code data visualization tool, it can’t get much better than this. This post has only scratched the surface with regards to what you can accomplish with these tools. If you are interested in this for a Ruby application, check out our friends over at Scout who wrote a blog about doing exactly that. If you like what you see, sign up for a free trial today or contact us for more information!



Get started with DreamFactory commercial edition by starting a free on-premise trial. Or, start a hosted trial now!