{"name":"Status of the witness 'InsertWitnessNameHere'","description":"<p>This metric returns the state of the SQL Server instance configured as the mirroring witness. States are represented by the following values:<\/p>\r\n<ul>\r\n<li>0 = Unknown<\/li>\r\n<li>1 = Connected<\/li>\r\n<li>2 = Disconnected<\/li>\r\n<\/ul>","tsql":"DECLARE\t@MonitorResults AS TABLE (\r\n\tdatabase_name VARCHAR(255),\r\n\trole INT,\r\n\tmirror_state TINYINT,\r\n\twitness_status TINYINT,\r\n\tlog_generat_rate INT,\r\n\tunsent_log INT,\r\n\tsent_rate INT,\r\n\tunrestored_log INT,\r\n\trecovery_rate INT,\r\n\ttransaction_delay INT,\r\n\ttransaction_per_sec INT,\r\n\taverage_delay INT,\r\n\ttime_recorded DATETIME,\r\n\ttime_behind DATETIME,\r\n\tlocal_time DATETIME);\r\n \r\nINSERT\tINTO @MonitorResults\r\n\t\tEXEC sp_dbmmonitorresults \r\n\t\t\t@database_name = 'InsertDatabaseNameHere',\r\n\t\t\t@mode = 0,\r\n\t\t\t@update_table = 0;\r\nSELECT\twitness_status\r\nFROM\t@MonitorResults;","instances":true,"frequency":60,"databases":{"mode":1},"rateofchange":false,"metricenabled":true,"alertname":"Witness 'InsertWitnessNameHere' disconnected","alertdescription":"This alert is raised when the state of the SQL Server instance configured as the witness changes to disconnected.","aboveorbelow":"above","collections":1,"alertenabled":true,"_thresholds_high":{"selected":true,"value":1},"_thresholds_medium":{"selected":false},"_thresholds_low":{"selected":false},"name_comment":"Note: Replace 'InsertWitnessNameHere' with the name of the instance configured as the witness.","tsql_comment":"Note: Replace 'InsertDatabaseNameHere' with the name of the database you're monitoring.","alertname_comment":"Note: Replace 'InsertWitnessNameHere' with the name of the instance configured as the witness.","targetentitytype":0}