Submit a ticketCall us

Training ClassSign up for Network Performance Monitor (NPM) and Scalability instructor-led classes

Attend our instructor-led classes, provided by SolarWinds® Academy, to discuss the more advanced monitoring mechanisms available in NPM as well as how to tune your equipment to optimize its polling capabilities. NPM classes offered:
NPM Custom Monitoring and Polling
Orion Platform Scalability

Reserve your seat.

Home > Success Center > Server & Application Monitor (SAM) > SAM Documentation > SAM Custom Template Guide > Example template: SolarWinds MIB Database

Example template: SolarWinds MIB Database

Table of contents

The SolarWinds MIB Database is a custom template using the Microsoft PowerShell script monitor. The script in this template calculates the age difference for a new database running on your Orion server by pulling the database and comparing creation dates.

Recommended configurations:

  • Polling frequency at 24 hours (86400 seconds) or higher
  • Polling timeout set depending on your Internet Connection speed

    For reference, the MIB Database file download is over 200 MB.

  • Execution mode: Local Host

    Running the Web Client code over remote PowerShell may cause issues.

The script code used in this PowerShell monitor include extensive comments to clearly define the steps taken. Overall, the script:

  • Sets a temporary location and names for the MIB database
  • Downloads and extracts data from the zip
  • Compares the creation date between the original and downloaded MIB database
  • Provides content back to SAM with a message and statistic data of the amount of days older than the original
  • Saves the .cfg file if you want to update it at a later time

The script used in the template is as follows:

$MibUrl = ""
$LocalMib = "$( $env:ProgramData )\SolarWinds\Mibs.cfg"
# Temporary Location for working with the MIB
$MIBZip  = "$env:temp\"
# Create a the name for the MIB.cfg file
$MIBCfg  = $MIBZip.Replace("zip", "cfg")
# Cleanup Temp Folder
Remove-Item -Path $MIBCfg -Force -ErrorAction SilentlyContinue
# Create new Web Client
$WebClient = New-Object System.Net.WebClient
# Download from $MibUrl to $MIBZip
$WebClient.DownloadFile($MibUrl, $MIBZip)
# Create Shell Object
$Shell = New-Object -com Shell.Application
$Location = $Shell.Namespace( $env:temp )
# Extract MIBs.cfg file from Zip File
$ZipFolder = $Shell.Namespace( $MIBZip )
$MibFile = $ZipFolder.Items() | Where-Object { $_.Name -eq "MIBs.cfg" }
$Location.CopyHere( $MibFile )
# Compare UTC Creation date on the newly downloaded and the original MIB.cfg
$DateNewFile = (Get-Item -Path $MIBCfg  ).CreationTimeUtc
$DateOldFile = (Get-Item -Path $LocalMib).CreationTimeUtc
$DaysOld = [int]( ( $DateNewFile - $DateOldFile ).TotalDays )
Write-Host "Message: MIB Database on $( $env:ComputerName ) is $( ( $DateNewFile - $DateOldFile ).TotalDays.ToString("0") ) days old"
Write-Host "Statistic: $( ( $DateNewFile - $DateOldFile ).TotalDays.ToString("0") )"
$ExitCode = 0
Remove-Item -Path $MIBZip -ErrorAction SilentlyContinue
#We Leave the MIBs.cfg file in the $temp folder in case you want to update it.
exit $exitcode

You can import the template through SAM:

  1. On the Web Console, click Settings > All Settings > SAM Settings, and click Manage Templates.
  2. Click the Shared Templates on THWACK tab.

    A page opens and populates with available templates from THWACK.

  3. Enter SolarWinds MIB Database in the search field.
  4. Select a template file and click Import.
  5. Enter your THWACK account credentials when prompted.

    If you need an account, click Create Account and follow the steps.

  6. The SolarWinds MIB Database template imports into the Orion Web Console. In the dialog box, click View Imported Templates.

    A list displays with the imported template.

Options to extend the code:

  • Add error trapping to the script. For example, you could check and ignore or respond with an error for negative values.
  • Add proxy and credentials code if your server is behind a proxy:

    # Create a Web Proxy
    $WebProxy = New-Object System.Net.WebProxy
    $WebProxy.Address = "http://proxy.address.local:80"
    # Create Credentials for Proxy
    $ProxyCreds = New-Object -TypeName System.Net.NetworkCredential
    $ProxyCreds.UserName = "ProxyUsername"
    $ProxyCreds.Password = "ProxyPassword"
    # Assign the Creds to the Proxy
    $WebProxy.Credentials = $ProxyCreds
    # Assign the Proxy to the Client
    $WebClient.Proxy = $WebProxy
  • Add code to clear out the saved .cfg file if needed.


If the database does not fully update, you may have a permissions issue with the local file. Check the permissions of the downloaded .cfg file and temp directory with the Orion Permission Check, or manually. If you make changes, we recommend

Last modified