kholbrook

Members
  • Content Count

    3
  • Joined

  • Last visited

  • Days Won

    1

Community Reputation

1 Neutral

About kholbrook

  • Rank
    Community Member
  1. kholbrook

    Tracking Server Reboots

    Hello All! Have any of you been successful with using LM to monitor when servers are bounced(without the up time monitor). I am trying to nail down a way to see when a server was rebooted and by who. I know i could use the event log, but i have not been successful with event sources staying active after the next poll. I was wondering if any of you were successful with other methods and what were they? Also if you were successful using the eventsource in LM could you provide some details on how you configured it? Thanks in advance =).
  2. @Andrey Kitsen Thanks man! I just published it and the ID is 4TH3HA. In regards to what LM offers for this, since it involved creating a new database for tracking I figured it would be easier to use this method for the time being.
  3. Hello all! I just recently created a monitor to track the amount of time in seconds the secondary replicas are behind the primary and I figured I would share my solution. This will display the span of time in which past transactions could be lost in the event of a fail over. This assumes the secondaries are asynchronous. We are using SQL 2016, I do not know if this will work on earlier versions of SQL. I created a datasource and set the "Applies to" to the server in question. I set the collector to "SCRIPT" and I set the datasource to multi-instance and enabled active discovery. I used JDBC as the discovery method and Instance List as the discovery type. The details are as follows: Connection String: jdbc:sqlserver://##HOSTNAME##;IntegratedSecurity=true; SQL Statement: (This query gets the name of each secondary replica) SELECT CS.replica_server_name FROM sys.availability_groups_cluster AS C INNER JOIN sys.dm_hadr_availability_replica_cluster_states AS CSON CS.group_id = C.group_id INNER JOIN sys.dm_hadr_availability_replica_states AS RS ON RS.replica_id = CS.replica_id WHERE RS.Role_desc <> 'PRIMARY' I wrote a script in Powershell that actually pulls the data that I need from the server itself. Powershell Script: [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null $SqlServer = New-Object Microsoft.SqlServer.Management.Smo.Server("##HOSTNAME##") $SqlServer.AvailabilityGroups["your ag name here"].DatabaseReplicaStates | Where-Object {$_.IsLocal -eq $false -and $_.AvailabilityReplicaServerName -eq "##WILDVALUE##" -and $_.AvailabilityDatabaseName -eq "your server name here"} | Select -ExpandProperty EstimatedDataLoss In our environment there is only one database on the server that we are concerned with for tracking this information so I have not explored monitoring multiple databases. This method pulls the same data that is in the Estimated Data Loss(seconds) column in the Availability Groups dashboard in SQL Management Studio. In the event you wanted to track multiple databases on the secondaries, you will likely have to create a separate datasource for each secondary server you want to track. Additionally you would have to adjust the JDBC query to enumerate the databases on the server and the powershell script accordingly. I hope this helps someone. Thanks, Kyle