SQL Monitor 8

Add Monitored Entities to SQL Monitor using the Web API

The Web API allows you to start monitoring a monitored entity (SQL Server, machine or cluster) without having to manually do it through the SQL Monitor website. 

This is useful for integrating SQL Monitor with your build processes and inventory management systems.

Download PowerShell module

You can download the PowerShell module to access the Web API with the following link:

SQMAPIADDSERVER.psm1

And then load it (from directory which contains the file):

Loading Powershell module

Import-Module .\SQMAPIADDSERVER.psm1


You can see example usages from the PowerShell documentation:

Getting help for the PowerShell Module

Get-Help Add-MonitoredEntity
Get-Help Add-MonitoredEntity -examples

Monitored entities supported

  1. Clusters
  2. Machines
  3. SQL Server instances

Step-by-step guide

  1. Get the Authentication token (this is the contents of %ProgramData%\Red Gate\SQL Monitor\WebApi.config on the web server machine)
  2. Run the following Powershell script and supply the values needed to add a monitored entity
  3. The script will send a JSON request to the Web API to add a monitored entity

Responses

If successful, you are going to see the following response:

Output

Success Message                                                                                                        
------- -------                                                                                                            True                                                                                                                                         

Known limitations

  1. You can add a server with invalid credentials and it will add it and return true (it doesn't test it)
  2. Cluster/SQL Server is still added when a non existent group is specified




Do you have any feedback on this documentation?

Let us know at sqlmonitorfeedback@red-gate.com


Didn't find what you were looking for?