Rebuilding the Enterprise - Software, Hardware and Peopleware Migrations for the Systems Architect

1/07/2016

Using UpGuard & Powershell Queries to Monitor your NIC Speed

1/07/2016 Posted by William Berry , , No comments
One of the sweetest features of UpGuard is the ability to add custom queries for node scans.  Though the standard battery of queries that the product provides is very through and well selected, it does have some blind spots.  Previously, I've written about using UpGuard to monitor Disk Space on server drives and to track changes to Active Directory.  In this post we are going to look at a more nefarious problem that we ran into lately and leverage UpGuard to help monitor for changes.

The other day, our ETL pump began to experience SQL connection timeouts with one of our database servers.  As we dug deeper into the issue, we discovered that a primary NIC on that cluster node was running at 100% utilization and the jump to discover that the NIC had reset itself from its originally configured 1GB speed to 100MB, was short.  Under normal loads this would not have posed much of an issue since most SQL connections are small payloads over short duration connections. In this case a large log shipping job was running in the background putting additional pressure on the pipe.  

Whether or not this issue had historical relevancy, which it does, I would still turn to UpGuard to at least get a daily heads up that something might be wrong.  Since the NIC resets tend to occur after server restarts, I moved all our database machines to their own environment and set the scan time to kick off in the last minute of our standard maintenance window, increasing the chance that the daily scan would catch the drift.  The last piece of the puzzle is the actual query...

Since most all the Powershell to do this stuff has been written before I turned to Google for a little help.  A simple query of 'Get NIC speed with Powershell' turned up this StackOverflow answer that has a great place to jump off from. The code simply gets all the network adapter data, filtering on a non-null speed and MAC address setting and then dumps four properties to a table, a'la


Unfortunately, UpGuard won't be too happy with the formatted table of results so we need to modify the script slightly to shape the data correctly.

Here we have simply replaced the call to 'Format-Table' with a 'Select-Object -Property' call with the same property list.

The last step is to add this script to our custom query section and set a Key Name to NetConnectionID so that each eligible NIC is listed under it common name.


With our query configured, our next scan will produce the output below.








With that we are done, Happy UpGuard'in !


PS.  I wanted to post a quick update to show the use of a calculated property for link speed.  So here you go:

0 comments:

Post a Comment