Blog Post

Monday Monitor Tips: Using the PowerShell API

,

Redgate Monitor has grown tremendously from its early days and I find many customers using this to monitor lots of servers, like thousands. In those cases, some of tasks you might do to manage your Redgate Monitor server can be cumbersome in the GUI.

This post shows you how to get started with PowerShell to administer your Redgate Monitor Instance.

This is part of a series of posts on Redgate Monitor. Click to see the other posts

The Purpose of the PowerShell API

Redgate Monitor (RGM) has lots of configuration options that you can set. In any size estate, this can be overwhelming when you need to change settings for some servers, but not others. For example, suspending some monitoring for servers being patched or upgraded. While this can be done easily in the web interface, for more than 1 or 2 servers, you might want a programmatic way to do this.

The PowerShell API is designed to help you change your configuration in a programmatic way rather than clicking through the GUI. If you look at the main documentation screen below, it says the same thing.

2025-01_0143

Getting the PowerShell Module

To get the various PoSh modules you need, you need to go to your configuration screen and click the download under the PoSh API section. You can see this below, and it’s also in the docs.

2025-01_0144

While this downloads, you also need an authorization token from your install. This is also on the configuration screen and described in these docs. The PowerShell API section has the Authorization Tokens section. Click that and in this screen you can genernate a new one. Save this, as you can’t see it after generation.

2025-01_0145

From here, test making a basic connection to your server with a script like this one below. One of our solutions specialists wrote it, and it imports the module, sets the URL and token, and then tries a connection. If that works, you are connected. You can run the Get-RedgateMonitorMonitoredObject as well. This gets a list of all objects being monitored.

2024-12_0280

Where to go from there is up to you. What types of things do you find yourself changing in Redgate Monitor? If there are a series of stops, then think about automating them. We have a set of example scripts that might give you some examples. There are things you might do from a list of servers like:

  • add to a group (or move)
  • suspect monitoring
  • annotate them with an event
  • set a tag
  • copy settings from one server to another

With PowerShell, there are so many ways to program a script to do the thing you used to do manually. Give it a try with Redgate Monitor today.

https://youtu.be/eTlg1auKRUA

Redgate Monitor is a world class monitoring solution for your database estate. Download a trial today and see how it can help you manage your estate more efficiently.

Original post (opens in new tab)
View comments in original post (opens in new tab)

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating