I have created a simple page which will give the "true" status of publishing queue when it is stuck for any reasons for last 15 minutes.
Sample code below:
protected void Page_Load(object sender, EventArgs e)
{
XNamespace tcm = "http://www.tridion.com/ContentManager/5.0";
using (TridionCoreServiceClient client = Common.GetNewClient())
{
PublishTransactionsFilterData filter = new PublishTransactionsFilterData
{
StartDate = DateTime.Now.AddMinutes(-15)
};
IEnumerable<XElement> transactions = client.GetSystemWideListXml(filter).Elements(tcm + "Item")
.Where(t => String.Equals(t.Attribute("State").Value, "10") || String.Equals(t.Attribute("State").Value, "16"));
if (transactions.Count() > 0)
Response.Write("true");
else
Response.Write("Publishing Running successfully");
}
}
Now when configuring in "cd_monitor_conf.xml" I have added below under
<ServiceHealthMonitors>
<HttpServiceHealthMonitor ServiceType="Publishing Queue Alert" ServiceInstance="local" PollInterval="5m" TimeoutInterval="30s">
<Request URL="http://localhost/MonitoringView/GetPublishingQueueStatus.aspx"/>
<Authentication Scheme="NTLM" Host="MYHOST" Domain="MYDOMAIN" Username="XXXX" Password="XXXXX"/>
<Response SuccessPattern="Publishing Running successfully"/>
</HttpServiceHealthMonitor>
</ServiceHealthMonitors>
I am getting below error in logs files
2014-01-28 09:30:49,821 INFO AbstractHTTPHealthMonitor - TMA-PO-10001 Service Publishing Queue Alert#local - Health check failed: HTTP/1.1 401 Unauthorized
2014-01-28 09:30:50,806 DEBUG HealthCheckResultEventHandler - TMA-PO-00000 HealthCheckResultEventHandler - Updating status for Publishing Queue Alert#local with id 1
2014-01-28 09:30:50,806 INFO ServiceStatusStore - TMA-AG-99999 Status of service 'Publishing Queue Alert#local' changed to Error
Webservice Response:
<ServiceStatus><ServiceType>Publishing Queue Alert</ServiceType><ServiceInstance>local</ServiceInstance><ProcessId>-1</ProcessId><Status>Error</Status><StatusChangeTime>2014-01-28T06:27:21Z</StatusChangeTime><LastReportTime>2014-01-28T06:26:18Z</LastReportTime><MonitoredThreadCount>-1</MonitoredThreadCount></ServiceStatus>
Can we avoid giving the authentication? or anything I am missing to put here or any changes in my code would help me.