windows:windowsstart
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| windows:windowsstart [2013/10/15 19:55] – [Gather SQL Server instances info] correct updateinstance PowerShell script is linked haidong | windows:windowsstart [2018/05/15 03:00] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ===== Gathering | + | ====== Windows and SQL Server metrics data capturing ====== |
| Here are step by step instructions on setting up a process to collect Windows and SQL Server related metrics data. Most of the automation scripts are written in PowerShell. To be honest, given a choice, I'd rather write my tools in either Python or Perl. However, on Windows systems, those languages require a separate install, whereas PowerShell is present already. That, plus the tight integration between PowerShell and Windows (and other Microsoft server products), makes starting with PowerShell pretty compelling. I may present the same tools written in Python, Perl, and/or other languages if/when I develop them. | Here are step by step instructions on setting up a process to collect Windows and SQL Server related metrics data. Most of the automation scripts are written in PowerShell. To be honest, given a choice, I'd rather write my tools in either Python or Perl. However, on Windows systems, those languages require a separate install, whereas PowerShell is present already. That, plus the tight integration between PowerShell and Windows (and other Microsoft server products), makes starting with PowerShell pretty compelling. I may present the same tools written in Python, Perl, and/or other languages if/when I develop them. | ||
| - | The whole process | + | Setting this up is pretty |
| + | * We will need to create a SQL Server database, JiMetrics, to store metrics data; | ||
| + | * The collection process relies on SQL Server Agent; | ||
| + | * The domain account SQL Server Agent jobs run under must have: | ||
| + | * Administrative access to all server hosts you intend to collect metrics data from | ||
| + | * sysadmin access to all SQL Server instances you intend to collect metrics data from | ||
| + | * dbo access to the JiMetrics database. | ||
| + | * Manual steps needed are minimal. If you create steps in the order that is presented in this page, you will be fine. Each PowerShell script corresponds to one SQL Server Agent job. Inside | ||
| + | * Once you've started collecting for a while, you will certainly | ||
| - | ==== Set up a database ==== | + | The whole process is pretty lightweight, |
| - | Please [[db: | + | |
| - | ==== Fill server Host table ==== | + | ===== Set up a database ===== |
| - | Enter Windows | + | Please [[db: |
| + | |||
| + | ===== Fill server Host table ===== | ||
| + | Enter Windows | ||
| <code tsql> | <code tsql> | ||
| - | USE SysMetrics; | + | USE JiMetrics; |
| - | GO; | + | GO |
| INSERT INTO Windows.Host (HostName) VALUES (' | INSERT INTO Windows.Host (HostName) VALUES (' | ||
| - | GO; | + | GO |
| </ | </ | ||
| - | Or, if you have a list of servers in a file, it is not hard to import that into the Host table. | + | Or, if you have a list of servers in a file, it is easy to import that into the Host table. |
| - | ==== Gather Windows server info ==== | + | ===== Setup SQL Server Agent proxy account ===== |
| - | Please [[windows: | + | Use the domain account mentioned above to create a SQL Server |
| - | ==== Gather Windows server | + | ===== Gather Windows server |
| - | Please [[windows: | + | |
| + | ==== Windows server | ||
| + | Please [[windows: | ||
| + | |||
| + | Manually run the job after it is created. It should succeed if the proxy account has proper access defined above. Run the T-SQL code below to check the results: | ||
| + | <code tsql> | ||
| + | USE JiMetrics; | ||
| + | GO | ||
| + | SELECT * FROM Windows.Host; | ||
| + | GO | ||
| + | </ | ||
| + | |||
| + | |||
| + | ==== Windows server disk info ==== | ||
| + | Please [[windows: | ||
| + | <code tsql> | ||
| + | USE JiMetrics; | ||
| + | GO | ||
| + | SELECT * FROM Windows.Storage; | ||
| + | GO | ||
| + | </ | ||
| + | |||
| + | ===== Gather SQL Server instances info ===== | ||
| ==== Discover installed SQL Server instances ==== | ==== Discover installed SQL Server instances ==== | ||
| - | Please [[windows: | + | Please [[windows: |
| + | <code tsql> | ||
| + | USE JiMetrics; | ||
| + | GO | ||
| + | SELECT * FROM Windows.Instance; | ||
| + | GO | ||
| + | </ | ||
| - | ==== Gather | + | ==== SQL Server |
| - | After SQL Server instances are discovered in server hosts, it is now time to get some metadata about those instances. This step gathers information like instance | + | After SQL Server instances are discovered in all active servers in the Windows.Host table, it is now time to find out if the instances |
| + | <code tsql> | ||
| + | USE JiMetrics; | ||
| + | GO | ||
| + | SELECT * FROM Windows.Instance; | ||
| + | GO | ||
| + | </ | ||
| - | ==== Gather | + | ==== SQL Server |
| - | After server hosts, hosts' disk information, | + | Now that we have names of all currently running |
| + | <code tsql> | ||
| + | USE JiMetrics; | ||
| + | GO | ||
| + | SELECT * FROM Windows.InstanceConfig; | ||
| + | GO | ||
| + | </ | ||
| - | ==== Gather | + | ==== SQL Server instance performance counters ==== |
| - | We drill down one more level to metrics about database tables. These include database name, schema name, table name, total row count, data size, and index size. Please [[windows: | + | To get a good handle on the performance characteristics and metrics, it is important to gather and store performance counters. Please [[windows: |
| + | <code tsql> | ||
| + | USE JiMetrics; | ||
| + | GO | ||
| + | SELECT * FROM Windows.InstanceDmvPerfCounter; | ||
| + | GO | ||
| + | </ | ||
| + | |||
| + | ==== SQL Server database file info ==== | ||
| + | After server hosts, hosts' disk information, | ||
| + | <code tsql> | ||
| + | USE JiMetrics; | ||
| + | GO | ||
| + | SELECT * FROM Windows.DbFileStats; | ||
| + | GO | ||
| + | </ | ||
| + | |||
| + | ==== SQL Server database table info ==== | ||
| + | We drill down one more level to metrics about database tables. These include database name, schema name, table name, total row count, data size, and index size. Please [[windows: | ||
| + | <code tsql> | ||
| + | USE JiMetrics; | ||
| + | GO | ||
| + | SELECT * FROM Windows.TableStats; | ||
| + | GO | ||
| + | </ | ||
windows/windowsstart.1381866905.txt.gz · Last modified: (external edit)
