diff --git a/Postgres_anotate b/Postgres_anotate new file mode 100644 index 0000000..92406a8 --- /dev/null +++ b/Postgres_anotate @@ -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." +}