cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post

PSDPA - Database Performance Analyzer PowerShell Module

With the release of the Database Performance Analyzer 12.1 and the Management API, I have started developing a PowerShell module called PSDPA. The module is now available through the PowerShell Gallery and GitHub. I would still consider this release a "beta" release, as not everything has been implemented and not everything has been tested. If you have ideas on additional features - feel free to submit a GitHub issue. Pull requests are also welcome!

Prerequisites

  • PowerShell 5.x
  • PSFramework PowerShell Module
  • DPA 12.1 and an API Refresh Token

Installation

if (-not (Get-Module PSFramework -ListAvailable)) { Install-Module PSFramework }

Install-Module PSDPA

Configuration

Set-DpaConfig -BaseUri 'http://yourserver:8123/iwc/api' -RefreshToken 'yourrefreshtoken'

Links

PowerShell Gallery

GitHub

Practical Examples

# add an annotation to all servers after patching

Get-DpaMonitor | Add-DpaAnnotation -Title "Patching" -Description "Operating system patching"

# reboot a server, but make sure to stop/start DPA on the instance before so we don't get alerts

Stop-DpaMonitor -MonitorName "MyServer"

Restart-Computer -ComputerName "MyServer"

Start-DpaMonitor -MonitorName "MyServer"

Labels (1)
Comments

awickham10​ :

I get the following error when attempting to add an annotation to an Azure SQL Database instance/database. Oddly, I can add an annotation both via Swagger and by creating a full-blown PowerShell script. But the one-line Add-DpaAnnotation approach in the example above gives this:

New-Object : Cannot find type [AzureSQLDatabaseMonitor]: verify that the assembly containing this type is loaded.

At C:\Program Files\WindowsPowerShell\Modules\PSDPA\0.0.1\Classes\Monitor.ps1:87 char:17

+         return (New-Object -TypeName "$type" -ArgumentList $Json)

+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidType: (:) [New-Object], PSArgumentException

    + FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand

Which is unfortunate, because this would be my preferred approach.

Thanks in advance for any help.

Hi gjspielman​ - I'm working on getting a testing environment to get some support setup for Azure SQL DB. That's an area we are not currently using, so I wasn't able to test it. I'll post back here soon with an update!

gjspielman​​ - I got my lab environment up and running and just released 0.0.2 which resolves your issue. You can get the latest version by doing an Update-Module in PowerShell.

Any feedback is appreciated!

Worked perfectly on the first try! Awesome work, awickham10​!

I do not hold any current DPA instances at the moment, but will give this a try as soon as I get my hands on a new environment, nice work!

Version history
Revision #:
1 of 1
Last update:
‎02-14-2019 11:58 AM
Updated by: