Are you a young IMC Padawan and want to become a Jedi? There is a very easy way to look like an IMC guru: RESTful eAPIs!! If you're unfamiliar with IMC check out this blog to get started I'll wait.
IMC is already a very powerful tool to manage your network end-to-end, but sometimes you need some extra feature which to achieve a specific business requirement which wasn't designed into the product. This is where the REST APIs and a bit of programing can come in to save the day. I had just such an example a few months ago:
My customer was deploying IMC on his infrastructure and since he was using Microsoft System Center to aggregate all the monitoring he wanted to integrate IMC with Microsoft SCOM (System Center Operations Manager).
No problem Mr. Customer, there is a plugin which automatically pushes IMC alarms in SCOM (using HTTP or HTTPS API calls).
Ok, that's great, but The point is that for Cisco devices, System Center has a predefined performance pack which gives performance monitoring (CPU usage, Memory usage, bandwidth ) ; but for nothing is predefined.
So we had two option:
- Define a System Center SNMP performance pack (which means eventually we'll have to define different ones depending on the device model)
- If possible, use the information we already have in IMC and push this to SCOM, a one-time development, I like the sound of that!
Obviously, we chose the #2. Anything that helps me quickly solve a problem and move on to the next challenge is a good thing, right?
So let's begin the dev.
Note: For the complete code for this project, check out our GITHUB repository
- First thing to do is to provide credential parameters and RESTful API base url (we'll use each time we want to get info via API). In PowerShell this should look like the following
___________________________________________________________________________________
# iMC Connection variable and initialization
$imchost = "192.168.20.21"
$imcport = "8080"
$imcprot = "http"
$iMCUser = "admin"
$iMCPWD = "admin"
$ImcApiBaseUrl = $imcprot + "://" + $imchost + ":" + $imcport + "/imcrs/"
$secpasswd = ConvertTo-SecureString $iMCPWD -AsPlainText -Force
$imcadmin = New-Object System.Management.Automation.PSCredential ($iMCUser, $secpasswd)
___________________________________________________________________________________
2. Then we need to get the list of performance tasks managed by IMC that we want to display in System Center. The fantastic thing about the IMC eAPI is that it has online documentation. We just have to open the following URL to get the list of all available API methods: HTTP://
Moreover, we can test it online and then just copy paste the full API call URL
So in our case this should look like:
___________________________________________________________________________________
$ImcApiBaseUrl/perf/task?name=
___________________________________________________________________________________
3. Next step: find the IMC device ids of the node we monitor in System Center. Again: online help (HTTP://
4. Last, but not least, we need to get the performance data for each task and device. If you are paying attention you'll know how to find help: the online docs Yes!
Hint: http://
5. Finally we need to add some lines in order to put the data in System Center "bag". Below are the three parameters we'll use in System Center
___________________________________________________________________________________
$bag.AddValue("Counter",$Counter)
$bag.AddValue("Instance",$devName)
$bag.AddValue("PerfValue",$PerfValue)
___________________________________________________________________________________
Congratulations! You just wrote a powerful script in very few steps and your IMC eAPI is done!
There is only one task left, add this script in a performance pack. I personally use MP Author from Silect Software Inc. This allows you to add the script to a performance pack and map the variables of the script to info in System Center.
And now we have performance data for any device supported by IMC in Microsoft System Center (coming from IMC, so compatible basically with any SNMP device).
If you enjoyed this intergalactic trip and would like to find out more on IMC eAPI and on IMC itself, search for IMC on YouTube, there is plenty on there to help a young Jedi in training, no swamp workouts required. May the Force be with you