externalLibs/SQLPSX/PBM/Policies/EPM - Replication Latency Greater Than 15 minutes.xml
<?xml version="1.0" encoding="utf-8"?><model xmlns="http://schemas.serviceml.org/smlif/2007/02"><identity><name>urn:uuid:96fe1236-abf6-4a57-b54d-e9baab394fd1</name><baseURI>http://documentcollection/</baseURI></identity><xs:bufferSchema xmlns:xs="http://www.w3.org/2001/XMLSchema"><definitions xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08"><document><docinfo><aliases><alias>/system/schema/DMF</alias></aliases><sfc:version DomainVersion="3" /></docinfo><data><xs:schema targetNamespace="http://schemas.microsoft.com/sqlserver/DMF/2007/08" xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08" xmlns:sml="http://schemas.serviceml.org/sml/2007/02" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"><xs:element name="Policy"><xs:complexType><xs:sequence><xs:any namespace="http://schemas.microsoft.com/sqlserver/DMF/2007/08" processContents="skip" minOccurs="0" maxOccurs="unbounded" /></xs:sequence></xs:complexType></xs:element><xs:element name="ObjectSet"><xs:complexType><xs:sequence><xs:any namespace="http://schemas.microsoft.com/sqlserver/DMF/2007/08" processContents="skip" minOccurs="0" maxOccurs="unbounded" /></xs:sequence></xs:complexType></xs:element><xs:element name="Condition"><xs:complexType><xs:sequence><xs:any namespace="http://schemas.microsoft.com/sqlserver/DMF/2007/08" processContents="skip" minOccurs="0" maxOccurs="unbounded" /></xs:sequence></xs:complexType></xs:element><xs:element name="PolicyCategory"><xs:complexType><xs:sequence><xs:any namespace="http://schemas.microsoft.com/sqlserver/DMF/2007/08" processContents="skip" minOccurs="0" maxOccurs="unbounded" /></xs:sequence></xs:complexType></xs:element><xs:element name="TargetSet"><xs:complexType><xs:sequence><xs:any namespace="http://schemas.microsoft.com/sqlserver/DMF/2007/08" processContents="skip" minOccurs="0" maxOccurs="unbounded" /></xs:sequence></xs:complexType></xs:element><xs:element name="TargetSetLevel"><xs:complexType><xs:sequence><xs:any namespace="http://schemas.microsoft.com/sqlserver/DMF/2007/08" processContents="skip" minOccurs="0" maxOccurs="unbounded" /></xs:sequence></xs:complexType></xs:element><DMF:bufferData xmlns:DMF="http://schemas.microsoft.com/sqlserver/DMF/2007/08"><instances xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08"><document><docinfo><aliases><alias>/PolicyStore/Policy/EPM - Replication Latency Greater Than 15 minutes</alias></aliases><sfc:version DomainVersion="3" /></docinfo><data><DMF:Policy xmlns:DMF="http://schemas.microsoft.com/sqlserver/DMF/2007/08" xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08" xmlns:sml="http://schemas.serviceml.org/sml/2007/02" xmlns:xs="http://www.w3.org/2001/XMLSchema"><DMF:Parent><sfc:Reference sml:ref="true"><sml:Uri>/PolicyStore</sml:Uri></sfc:Reference></DMF:Parent><DMF:PolicyCondition><sfc:Reference sml:ref="true"><sml:Uri>/PolicyStore/Condition/EPM - Replication Latency > 15 mins</sml:Uri></sfc:Reference></DMF:PolicyCondition><DMF:PolicyObjectSet><sfc:Reference sml:ref="true"><sml:Uri>/PolicyStore/ObjectSet/EPM - Replication Latency Greater Than 15 minutes__ObjectSet</sml:Uri></sfc:Reference></DMF:PolicyObjectSet><DMF:PolicyRootCondition><sfc:Reference sml:ref="true"><sml:Uri>/PolicyStore/Condition/EPM - Is Replicated</sml:Uri></sfc:Reference></DMF:PolicyRootCondition><DMF:PolicyPolicyCategory><sfc:Reference sml:ref="true"><sml:Uri>/PolicyStore/PolicyCategory/EPM_b Performance</sml:Uri></sfc:Reference></DMF:PolicyPolicyCategory><DMF:Name type="string">EPM - Replication Latency Greater Than 15 minutes</DMF:Name><DMF:Description type="string" /><DMF:Condition type="string">EPM - Replication Latency > 15 mins</DMF:Condition><DMF:ObjectSet type="string">EPM - Replication Latency Greater Than 15 minutes_ObjectSet</DMF:ObjectSet><DMF:RootCondition type="string">EPM - Is Replicated</DMF:RootCondition><DMF:PolicyCategory type="string">EPM: Performance</DMF:PolicyCategory><DMF:Enabled type="boolean">false</DMF:Enabled><DMF:AutomatedPolicyEvaluationMode type="AutomatedPolicyEvaluationMode">CheckOnSchedule</DMF:AutomatedPolicyEvaluationMode><DMF:ScheduleUid type="guid">3853c052-9621-4141-b856-3677fab4a161</DMF:ScheduleUid><DMF:HelpText type="string" /><DMF:HelpLink type="string" /><DMF:ActiveEndDate type="dateTime">9999-12-31T00:00:00</DMF:ActiveEndDate><DMF:ActiveEndTimeOfDay type="long">863990000000</DMF:ActiveEndTimeOfDay><DMF:ActiveStartDate type="dateTime">2008-07-09T00:00:00</DMF:ActiveStartDate><DMF:ActiveStartTimeOfDay type="long">0</DMF:ActiveStartTimeOfDay><DMF:FrequencyInterval type="int">1</DMF:FrequencyInterval><DMF:FrequencyRecurrenceFactor type="int">0</DMF:FrequencyRecurrenceFactor><DMF:FrequencyRelativeIntervals type="FrequencyRelativeIntervals" /><DMF:FrequencySubDayInterval type="int">10</DMF:FrequencySubDayInterval><DMF:FrequencySubDayTypes type="FrequencySubDayTypes">Minute</DMF:FrequencySubDayTypes><DMF:FrequencyTypes type="FrequencyTypes">Daily</DMF:FrequencyTypes><DMF:Schedule type="string">CollectorSchedule_Every_10min</DMF:Schedule></DMF:Policy></data></document><document><docinfo><aliases><alias>/PolicyStore/ObjectSet/EPM - Replication Latency Greater Than 15 minutes__ObjectSet</alias></aliases><sfc:version DomainVersion="3" /></docinfo><data><DMF:ObjectSet xmlns:DMF="http://schemas.microsoft.com/sqlserver/DMF/2007/08" xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08" xmlns:sml="http://schemas.serviceml.org/sml/2007/02" xmlns:xs="http://www.w3.org/2001/XMLSchema"><DMF:TargetSets><sfc:Collection><sfc:Reference sml:ref="true"><sml:Uri>/PolicyStore/ObjectSet/EPM - Replication Latency Greater Than 15 minutes__ObjectSet/TargetSet/Server_/Database</sml:Uri></sfc:Reference></sfc:Collection></DMF:TargetSets><DMF:Parent><sfc:Reference sml:ref="true"><sml:Uri>/PolicyStore</sml:Uri></sfc:Reference></DMF:Parent><DMF:Name type="string">EPM - Replication Latency Greater Than 15 minutes_ObjectSet</DMF:Name><DMF:Facet type="string">Database</DMF:Facet></DMF:ObjectSet></data></document><document><docinfo><aliases><alias>/PolicyStore/Condition/EPM - Replication Latency > 15 mins</alias></aliases><sfc:version DomainVersion="3" /></docinfo><data><DMF:Condition xmlns:DMF="http://schemas.microsoft.com/sqlserver/DMF/2007/08" xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08" xmlns:sml="http://schemas.serviceml.org/sml/2007/02" xmlns:xs="http://www.w3.org/2001/XMLSchema"><DMF:Parent><sfc:Reference sml:ref="true"><sml:Uri>/PolicyStore</sml:Uri></sfc:Reference></DMF:Parent><DMF:Expression type="string"><Operator><?char 13?>
<TypeClass>Bool</TypeClass><?char 13?> <OpType>EQ</OpType><?char 13?> <Count>2</Count><?char 13?> <Function><?char 13?> <TypeClass>String</TypeClass><?char 13?> <FunctionType>ExecuteSql</FunctionType><?char 13?> <ReturnType>String</ReturnType><?char 13?> <Count>2</Count><?char 13?> <Constant><?char 13?> <TypeClass>String</TypeClass><?char 13?> <ObjType>System.String</ObjType><?char 13?> <Value>String</Value><?char 13?> </Constant><?char 13?> <Constant><?char 13?> <TypeClass>String</TypeClass><?char 13?> <ObjType>System.String</ObjType><?char 13?> <Value>&lt;?char 13?&gt;<?char 13?> SET NOCOUNT ON&lt;?char 13?&gt;<?char 13?> &lt;?char 13?&gt;<?char 13?> CREATE TABLE #results&lt;?char 13?&gt;<?char 13?> (&lt;?char 13?&gt;<?char 13?> agent VARCHAR(64),&lt;?char 13?&gt;<?char 13?> latency_in_minutes INT&lt;?char 13?&gt;<?char 13?> )&lt;?char 13?&gt;<?char 13?> &lt;?char 13?&gt;<?char 13?> DECLARE @milliseconds INT,&lt;?char 13?&gt;<?char 13?> @distribution_agent_id INT,&lt;?char 13?&gt;<?char 13?> @latency INT,&lt;?char 13?&gt;<?char 13?> @strng VARCHAR(2048),&lt;?char 13?&gt;<?char 13?> @minutes INT&lt;?char 13?&gt;<?char 13?> &lt;?char 13?&gt;<?char 13?> SET @minutes = 15&lt;?char 13?&gt;<?char 13?> SET @milliseconds = (@minutes*60)*1000&lt;?char 13?&gt;<?char 13?> &lt;?char 13?&gt;<?char 13?> DECLARE distribution_agents CURSOR FOR&lt;?char 13?&gt;<?char 13?> SELECT id&lt;?char 13?&gt;<?char 13?> FROM distribution.dbo.msdistribution_agents&lt;?char 13?&gt;<?char 13?> &lt;?char 13?&gt;<?char 13?> OPEN distribution_agents&lt;?char 13?&gt;<?char 13?> &lt;?char 13?&gt;<?char 13?> FETCH NEXT FROM distribution_agents INTO @distribution_agent_id&lt;?char 13?&gt;<?char 13?> &lt;?char 13?&gt;<?char 13?> WHILE @@fetch_status = 0&lt;?char 13?&gt;<?char 13?> BEGIN&lt;?char 13?&gt;<?char 13?> SET @latency = (SELECT delivery_latency &lt;?char 13?&gt;<?char 13?> FROM distribution.dbo.msdistribution_history &lt;?char 13?&gt;<?char 13?> WHERE time =( SELECT MAX(time)&lt;?char 13?&gt;<?char 13?> FROM distribution.dbo.msdistribution_history &lt;?char 13?&gt;<?char 13?> WHERE agent_id = @distribution_agent_id)&lt;?char 13?&gt;<?char 13?> AND @distribution_agent_id = agent_id)&lt;?char 13?&gt;<?char 13?> IF @latency &gt; @milliseconds&lt;?char 13?&gt;<?char 13?> BEGIN&lt;?char 13?&gt;<?char 13?> INSERT INTO #results&lt;?char 13?&gt;<?char 13?> SELECT name, ((@latency/1000)/60)&lt;?char 13?&gt;<?char 13?> FROM distribution.dbo.msdistribution_agents &lt;?char 13?&gt;<?char 13?> WHERE @distribution_agent_id = id&lt;?char 13?&gt;<?char 13?> END&lt;?char 13?&gt;<?char 13?> &lt;?char 13?&gt;<?char 13?> FETCH NEXT FROM distribution_agents INTO @distribution_agent_id&lt;?char 13?&gt;<?char 13?> END&lt;?char 13?&gt;<?char 13?> &lt;?char 13?&gt;<?char 13?> CLOSE distribution_agents&lt;?char 13?&gt;<?char 13?> DEALLOCATE distribution_agents&lt;?char 13?&gt;<?char 13?> &lt;?char 13?&gt;<?char 13?> SELECT @strng = ISNULL(@strng, '''') + agent + '' is experiencing '' + CONVERT(VARCHAR(32),latency_in_minutes) + '' minutes of latency.'' + CHAR(10) &lt;?char 13?&gt;<?char 13?> FROM #results&lt;?char 13?&gt;<?char 13?> &lt;?char 13?&gt;<?char 13?> SELECT ISNULL(LEFT(RTRIM(@strng), (LEN(@strng) - 1)),'''') AS [policy_violation_message]&lt;?char 13?&gt;<?char 13?> &lt;?char 13?&gt;<?char 13?> DROP TABLE #results&lt;?char 13?&gt;<?char 13?> &lt;?char 13?&gt;<?char 13?> SET NOCOUNT OFF&lt;?char 13?&gt;<?char 13?> </Value><?char 13?> </Constant><?char 13?> </Function><?char 13?> <Constant><?char 13?> <TypeClass>String</TypeClass><?char 13?> <ObjType>System.String</ObjType><?char 13?> <Value /><?char 13?> </Constant><?char 13?> </Operator></DMF:Expression><DMF:Name type="string">EPM - Replication Latency > 15 mins</DMF:Name><DMF:Description type="string" /><DMF:Facet type="string">Database</DMF:Facet></DMF:Condition></data></document><document><docinfo><aliases><alias>/PolicyStore/Condition/EPM - Is Replicated</alias></aliases><sfc:version DomainVersion="3" /></docinfo><data><DMF:Condition xmlns:DMF="http://schemas.microsoft.com/sqlserver/DMF/2007/08" xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08" xmlns:sml="http://schemas.serviceml.org/sml/2007/02" xmlns:xs="http://www.w3.org/2001/XMLSchema"><DMF:Parent><sfc:Reference sml:ref="true"><sml:Uri>/PolicyStore</sml:Uri></sfc:Reference></DMF:Parent><DMF:Expression type="string"><Operator><?char 13?> <TypeClass>Bool</TypeClass><?char 13?> <OpType>NE</OpType><?char 13?> <Count>2</Count><?char 13?> <Function><?char 13?> <TypeClass>Numeric</TypeClass><?char 13?> <FunctionType>ExecuteSql</FunctionType><?char 13?> <ReturnType>Numeric</ReturnType><?char 13?> <Count>2</Count><?char 13?> <Constant><?char 13?> <TypeClass>String</TypeClass><?char 13?> <ObjType>System.String</ObjType><?char 13?> <Value>Numeric</Value><?char 13?> </Constant><?char 13?> <Constant><?char 13?> <TypeClass>String</TypeClass><?char 13?> <ObjType>System.String</ObjType><?char 13?> <Value>&lt;?char 13?&gt;<?char 13?> SET NOCOUNT ON&lt;?char 13?&gt;<?char 13?> &lt;?char 13?&gt;<?char 13?> SELECT COUNT(name)&lt;?char 13?&gt;<?char 13?> FROM master.dbo.sysdatabases&lt;?char 13?&gt;<?char 13?> WHERE name = ''distribution''&lt;?char 13?&gt;<?char 13?> &lt;?char 13?&gt;<?char 13?> SET NOCOUNT OFF&lt;?char 13?&gt;<?char 13?> </Value><?char 13?> </Constant><?char 13?> </Function><?char 13?> <Constant><?char 13?> <TypeClass>Numeric</TypeClass><?char 13?> <ObjType>System.Double</ObjType><?char 13?> <Value>0</Value><?char 13?> </Constant><?char 13?> </Operator></DMF:Expression><DMF:Name type="string">EPM - Is Replicated</DMF:Name><DMF:Description type="string" /><DMF:Facet type="string">Server</DMF:Facet></DMF:Condition></data></document><document><docinfo><aliases><alias>/PolicyStore/PolicyCategory/EPM_b Performance</alias></aliases><sfc:version DomainVersion="3" /></docinfo><data><DMF:PolicyCategory xmlns:DMF="http://schemas.microsoft.com/sqlserver/DMF/2007/08" xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08" xmlns:sml="http://schemas.serviceml.org/sml/2007/02" xmlns:xs="http://www.w3.org/2001/XMLSchema"><DMF:Parent><sfc:Reference sml:ref="true"><sml:Uri>/PolicyStore</sml:Uri></sfc:Reference></DMF:Parent><DMF:Name type="string">EPM: Performance</DMF:Name></DMF:PolicyCategory></data></document><document><docinfo><aliases><alias>/PolicyStore/ObjectSet/EPM - Replication Latency Greater Than 15 minutes__ObjectSet/TargetSet/Server_/Database</alias></aliases><sfc:version DomainVersion="3" /></docinfo><data><DMF:TargetSet xmlns:DMF="http://schemas.microsoft.com/sqlserver/DMF/2007/08" xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08" xmlns:sml="http://schemas.serviceml.org/sml/2007/02" xmlns:xs="http://www.w3.org/2001/XMLSchema"><DMF:Levels><sfc:Collection><sfc:Reference sml:ref="true"><sml:Uri>/PolicyStore/ObjectSet/EPM - Replication Latency Greater Than 15 minutes__ObjectSet/TargetSet/Server_/Database/TargetSetLevel/Server_/Database</sml:Uri></sfc:Reference></sfc:Collection></DMF:Levels><DMF:Parent><sfc:Reference sml:ref="true"><sml:Uri>/PolicyStore/ObjectSet/EPM - Replication Latency Greater Than 15 minutes__ObjectSet</sml:Uri></sfc:Reference></DMF:Parent><DMF:TargetTypeSkeleton type="string">Server/Database</DMF:TargetTypeSkeleton><DMF:Enabled type="boolean">true</DMF:Enabled></DMF:TargetSet></data></document><document><docinfo><aliases><alias>/PolicyStore/Condition/Is master</alias></aliases><sfc:version DomainVersion="3" /></docinfo><data><DMF:Condition xmlns:DMF="http://schemas.microsoft.com/sqlserver/DMF/2007/08" xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08" xmlns:sml="http://schemas.serviceml.org/sml/2007/02" xmlns:xs="http://www.w3.org/2001/XMLSchema"><DMF:Parent><sfc:Reference sml:ref="true"><sml:Uri>/PolicyStore</sml:Uri></sfc:Reference></DMF:Parent><DMF:Expression type="string"><Operator><?char 13?> <TypeClass>Bool</TypeClass><?char 13?> <OpType>EQ</OpType><?char 13?> <Count>2</Count><?char 13?> <Attribute><?char 13?> <TypeClass>Unsupported</TypeClass><?char 13?> <Name>Name</Name><?char 13?> </Attribute><?char 13?> <Constant><?char 13?> <TypeClass>String</TypeClass><?char 13?> <ObjType>System.String</ObjType><?char 13?> <Value>master</Value><?char 13?> </Constant><?char 13?> </Operator></DMF:Expression><DMF:Name type="string">Is master</DMF:Name><DMF:Description type="string">Confirms that the database name is master.</DMF:Description><DMF:Facet type="string">Database</DMF:Facet></DMF:Condition></data></document><document><docinfo><aliases><alias>/PolicyStore/ObjectSet/EPM - Replication Latency Greater Than 15 minutes__ObjectSet/TargetSet/Server_/Database/TargetSetLevel/Server_/Database</alias></aliases><sfc:version DomainVersion="3" /></docinfo><data><DMF:TargetSetLevel xmlns:DMF="http://schemas.microsoft.com/sqlserver/DMF/2007/08" xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08" xmlns:sml="http://schemas.serviceml.org/sml/2007/02" xmlns:xs="http://www.w3.org/2001/XMLSchema"><DMF:Parent><sfc:Reference sml:ref="true"><sml:Uri>/PolicyStore/ObjectSet/EPM - Replication Latency Greater Than 15 minutes__ObjectSet/TargetSet/Server_/Database</sml:Uri></sfc:Reference></DMF:Parent><DMF:TargetSetLevelCondition><sfc:Reference sml:ref="true"><sml:Uri>/PolicyStore/Condition/Is master</sml:Uri></sfc:Reference></DMF:TargetSetLevelCondition><DMF:TargetTypeSkeleton type="string">Server/Database</DMF:TargetTypeSkeleton><DMF:LevelName type="string">Database</DMF:LevelName><DMF:Condition type="string">Is master</DMF:Condition></DMF:TargetSetLevel></data></document></instances></DMF:bufferData></xs:schema></data></document></definitions></xs:bufferSchema></model> |