{"tsql":"SELECT SUM( CASE\r\nWHEN f.xact_seqno > e.xact_seqno THEN\r\n1\r\nELSE\r\n0\r\nEND\r\n) AS UndeliveredCommands\r\nFROM MSpublications (NOLOCK) AS a\r\nJOIN MSpublisher_databases (NOLOCK) AS b\r\nON b.publisher_id = a.publisher_id\r\nAND b.publisher_db = a.publisher_db\r\nJOIN MSsubscriptions (NOLOCK) AS c\r\nON c.publisher_database_id = b.id\r\nAND c.publication_id = a.publication_id\r\nCROSS APPLY\r\n(\r\nSELECT ah.agent_id,\r\nISNULL(MAX(ah.xact_seqno), 0x0) AS xact_seqno,\r\nMAX(time) AS time\r\nFROM MSdistribution_history (NOLOCK) AS ah\r\nWHERE ah.agent_id = c.agent_id\r\nGROUP BY ah.agent_id\r\n) AS e\r\nJOIN MSrepl_commands (NOLOCK) AS f\r\nON f.publisher_database_id = c.publisher_database_id\r\nAND f.article_id = c.article_id\r\nGROUP BY a.publication\r\nORDER BY a.publication;","instances":false,"databases":{"mode":1},"frequency":600,"alertenabled":false,"metricenabled":true,"aboveorbelow":"above","name":"Distributor With Undelivered Commands","description":"We can identify when a distributor has undelivered commands. You can't tell which database it is though. You'll have to go to the distributor and run queries.","frequency_comment":"seconds (collected every 10 minutes)","rateofchange":false,"_thresholds_high":{"selected":false},"_thresholds_medium":{"selected":false},"_thresholds_low":{"selected":false},"collections":1,"targetentitytype":0}