{"name":"Status of mirroring on 'InsertDatabaseNameHere'","description":"<p>This metric returns the current state of the mirroring system on the named database. States are represented by the following values:<\/p>\r\n<ul>\r\n<li>0 = Suspended<\/li>\r\n<li>1 = Disconnected<\/li>\r\n<li>2 = Synchronizing<\/li>\r\n<li>3 = Pending Failover<\/li>\r\n<li>4 = Synchronized<\/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\n \r\nSELECT\tmirror_state\r\nFROM\t@MonitorResults;\r\n","instances":true,"frequency":60,"databases":{"mode":1},"rateofchange":false,"metricenabled":true,"alertname":"Mirror state disconnected or suspended on 'InsertDatabaseNameHere'","alertdescription":"This alert is raised if the status of mirroring changes from synchronizing to either disconnected or suspended.","aboveorbelow":"below","collections":1,"alertenabled":true,"_thresholds_high":{"selected":true,"value":2},"_thresholds_medium":{"selected":false},"_thresholds_low":{"selected":false},"frequency_comment":"Note: The frequency depends on the status you\u2019re attempting to monitor. If you\u2019re looking for errors, it may be best to run this once a minute.","name_comment":"Note: Replace 'InsertDatabaseNameHere' with the name of the database you're monitoring.","tsql_comment":"Note: Replace 'InsertDatabaseNameHere' with the name of the database you're monitoring.","alertname_comment":"Note: Replace 'InsertDatabaseNameHere' with the name of the database you're monitoring.","targetentitytype":0}