Tuesday, August 25, 2015

Building DevOps dashboard using SolarWinds and Opserver


It's been a long time since I've started using Opserver - a monitoring system by the team at Stack Exchange. Opserver gives you a great overview of what's going on with your company's infrastructure, I am still really amazed by it's simplicity and the feature set.

Unfortunately, there is no "wallboard" mode in it, which could be used to show most important metrics at a single screen. So today I'll show how to use OpServer as an API for SolarWinds, and build DevOps dashboards in minutes, simply by accessing existing classes.


In brief, all you need to access SolarWinds data from your app is to:

  1. Add references to Opserver and Opserver.Core 
  2. Add required sections to the App.config file
  3. Place /Config folder to the output folder.

The step #1 is self-explanatory, so I'll start from #2 - just add the following lines after the opening <configuration> section:

The only config file that needs to be placed in the /Config directory is standard DashboardSettings.json containing connection string to the SolarWinds database. Here's the sample code:

After it, you can start using the API's, for example get all nodes and start playing: 

var allNodes = DashboardData.AllNodes.Where(s => !s.IsUnwatched).Where(s => s.CPULoad >= 0 || s.MemoryUsed >= 0).ToList();

I've pushed sample project to GitHub, it contains simple console app which outputs the following:







Similar code can be used to build something like this:








You can also output active alerts and many other things. If you come up with some interesting ideas - please share them!

No comments:

Post a Comment