是否有人编写了一个查询来同时监控所有BizTalk工件。
我的查询不起作用,我似乎无法完成它:
这是我的:
select
RL.Name AS rlName
, ('Url: ' + RL.InboundTransportURL + ' | Receiveport: ' + RP.nvcName) AS rlDescription
, RL.Disabled AS rlStatus
, RL.uidCustomCfgID as uidGuid
from BizTalkMgmtDb.dbo.adm_ReceiveLocation AS RL WITH(READPAST, ROWLOCK)
left join BizTalkMgmtDb.dbo.bts_receiveport AS RP WITH(READPAST, ROWLOCK)
ON RL.ReceivePortId = RP.nID
--Readpast and Rowlock are needed to avoid lock escalation.
答案 0 :(得分:7)
我为至少3个BizTalk工件开发并设计了一个监控查询,它也覆盖了你的。在我展示实际查询之前,我首先尝试解释我的想法。
这个想法是使用尽可能多的BizTalk工件作为一个结果表,同时具有端口状态和消息传递状态。这样很容易监控某些事情是否真的错误。端口状态相当简单,因为它只是一个选择。消息传递状态位于端口的实例上。首先,我向您展示查询的ERD。
在上面的ERD中,您可以看到我的查询中使用的所有表格和字段,在下图中解释了表格如何一起使用:
现在就是,监控Sendports,接收位置和业务流程的查询:
--sendports, receive locations and orchestrations combined into one query
Declare @PortStatus as bigint = null
Declare @MessagingStatus as bigint = null
Declare @Name as Varchar(500) = null
Declare @Type as Varchar(500) = null
Declare @UniqueID as Varchar(500) = null
;with combined as
(
(
select s.uidGUID as uidGuid, s.nvcName AS Name, nPortStatus as PortStatus, 'SENDPORT' as [Type], nvcDescription as Description
from dbo.[bts_sendport] AS s
)
union all
(
select o.uidGUID as uidGuid, o.nvcName AS Name, nOrchestrationStatus as PortStatus, 'ORCHESTRATION' as [Type], nvcDescription as Description
from dbo.[bts_Orchestration] AS o
)
union all
(
select
RL.uidCustomCfgID as UniqueKey, RL.Name AS Name,
CASE WHEN RL.Disabled = 0 THEN 4 ELSE 5 END as [PortStatus],
'RECEIVELOCATION' as [Type]
, ('Url: ' + RL.InboundTransportURL + ' | Receiveport: ' + RP.nvcName) as Description
from BizTalkMgmtDb.dbo.adm_ReceiveLocation AS RL WITH(READPAST, ROWLOCK)
left join BizTalkMgmtDb.dbo.bts_receiveport AS RP WITH(READPAST, ROWLOCK)
ON RL.ReceivePortId = RP.nID
)
)
select uidGuid as UniqueKey, Name, Description,
CASE WHEN i.nState is NULL THEN 0 ELSE COUNT(*) END as [MessageCount],
[Type], i.nState as MessagingStatus, c.PortStatus
from [BizTalkMsgboxDb].dbo.[Instances] AS i WITH (NOLOCK)
right join combined c ON i.uidServiceID = c.uidGuid
WHERE
(@Type is null OR [Type] like '%' + @Type + '%')
AND uidGuid = COALESCE(@UniqueID, uidGuid)
group by uidGUID, Name, i.nState, [Type], c.PortStatus, Description
having c.PortStatus = COALESCE(@PortStatus, c.PortStatus)
AND (@MessagingStatus is NULL OR i.nState = @MessagingStatus)
order by [Type], c.PortStatus, i.nState
在上面的查询中,我将状态映射到数字,对于我使用与BizTalk相同的消息传递状态,对于端口状态,我将启用和禁用映射到4和5,因此我可以在同一列中看到接收位置状态< / p>
可能的消息状态:
可能的端口状态:
答案 1 :(得分:0)
您可以参考以下文章,它解释了如何跟踪所有主机实例并在停止时启动它们。相同的技术可以应用于其他BizTalk工件: http://social.technet.microsoft.com/wiki/contents/articles/17835.biztalk-monitoring-and-automatically-starting-host-instances-via-a-scheduled-task.aspx