有没有人可能会编写一个查询来同时监视所有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.
Run Code Online (Sandbox Code Playgroud)
我为至少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
Run Code Online (Sandbox Code Playgroud)
在上面的查询中,我将状态映射到数字,对于我使用与BizTalk相同的消息传递状态,对于端口状态,我将启用和禁用映射到4和5,因此我可以在同一列中看到接收位置状态
可能的消息状态:
可能的端口状态:
| 归档时间: |
|
| 查看次数: |
842 次 |
| 最近记录: |