Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Postgres_anotate
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This is an example how to Anotate a postgres server on Redgate monitor .

Anotate the Postgres server : Save as script


# -----------------------------------------------
# AddPostgresAnnotation.ps1
# Adds a "Deployment" annotation to a Postgres instance in Redgate Monitor
# -----------------------------------------------

# Set the alias of the Postgres instance you want to annotate, In my example the machine Alias is Postgres
$PostgresAlias = "Postgres"

# Get the monitored Postgres instance by Alias
$Instance = Get-RedgateMonitorMonitoredObject -Type PostgresInstance | Where-Object { $_.Alias -eq $PostgresAlias }

# Check if the instance was found
if ($Instance) {
# Add annotation with current UTC timestamp
Add-RedgateMonitorAnnotation -Target $Instance -Description "Deployment made" -UtcDate ([datetime]::UtcNow)
Write-Output "Annotation added to instance '$PostgresAlias'."
} else {
Write-Output "Postgres instance with Alias '$PostgresAlias' not found."
}