In this years MVP retreat we did small Proof of concept to show the Publishing queue status on AWS cloud-watch in nice format. There are various ways to accomplish it.
- Using CoreService API to access the Queue.
- Directly querying the DB (not very recommended)
- PowerShell to read the queue (Yes its possible)
We choose last option as some Tridion Powershell Module created by SDL MVP Pkjaer makes it very easy.
Steps:
- Install Tridion Powershell module, details in above link.
- Install AWS Powershell module(s) on machine to work.
- Here is code snippet which do following
Auto-scaling:
One of the purpose to push the queue data to AWS Cloudwatch is to configure the auto-scaling of instances.
if there are lots of items in queue, auto-scaling of publishing system can be configured on AWS infrastructure.
- Using CoreService API to access the Queue.
- Directly querying the DB (not very recommended)
- PowerShell to read the queue (Yes its possible)
We choose last option as some Tridion Powershell Module created by SDL MVP Pkjaer makes it very easy.
Steps:
- Install Tridion Powershell module, details in above link.
- Install AWS Powershell module(s) on machine to work.
- Here is code snippet which do following
- Import AWS Powershell
- Create Cloudwatch matrices based on two states "Waiting for Publish" and Waiting for Deployment"
- fill the matrices with count of above two states
- Write the data to cloudwatch
Import-Module "C:\Program Files (x86)\AWS Tools\PowerShell\AWSPowerShell\AWSPowerShell.psd1"
$dat = New-Object Amazon.CloudWatch.Model.MetricDatum
$dat.Timestamp = (Get-Date).ToUniversalTime()
$dat.MetricName = "Waiting For Publish"
$dat.Unit = "Count"
$dat.Value = (Get-TridionPublishTransaction | Where-Object {$_.State -eq "WaitingForPublish"}).Count
$dat1 = New-Object Amazon.CloudWatch.Model.MetricDatum
$dat1.Timestamp = (Get-Date).ToUniversalTime()
$dat1.MetricName = "Waiting For Deployment"
$dat1.Unit = "Count"
$dat1.Value = (Get-TridionPublishTransaction | Where-Object {$_.State -eq "WaitingForDeployment"}).Count
set-AWSCredentials -AccessKey -SecretKey FT1nwN74NHkGtlJ -StoreAs "MVP17"
Set-AWSCredentials -ProfileName "MVP17"
Write-CWMetricData -Namespace "Usage Metrics" -MetricData $dat
Write-CWMetricData -Namespace "Usage Metrics" -MetricData $dat1
Auto-scaling:
One of the purpose to push the queue data to AWS Cloudwatch is to configure the auto-scaling of instances.
if there are lots of items in queue, auto-scaling of publishing system can be configured on AWS infrastructure.
No comments:
Post a Comment