|
1 | 1 | function ConvertTo-DbaTimeline { |
2 | 2 | <# |
3 | 3 | .SYNOPSIS |
4 | | - Generates interactive HTML timeline visualizations from SQL Server job history and backup history data |
| 4 | + Generates interactive HTML timeline visualizations from SQL Server job history, backup history, and database growth event data |
5 | 5 |
|
6 | 6 | .DESCRIPTION |
7 | | - Transforms SQL Server job execution and backup operation data into visual timeline reports for analysis and troubleshooting. Takes piped output from Get-DbaAgentJobHistory and Get-DbaDbBackupHistory and generates a complete HTML file with an interactive Google Charts timeline. |
| 7 | + Transforms SQL Server job execution, backup operation, and database growth event data into visual timeline reports for analysis and troubleshooting. Takes piped output from Get-DbaAgentJobHistory, Get-DbaDbBackupHistory, or Find-DbaDbGrowthEvent and generates a complete HTML file with an interactive Google Charts timeline. |
8 | 8 |
|
9 | | - Perfect for analyzing job schedules, identifying backup windows, troubleshooting overlapping operations, or creating visual reports for management. The timeline shows execution duration, status, and timing relationships across multiple instances, with hover tooltips displaying detailed information including start/end times and duration calculations. |
| 9 | + Perfect for analyzing job schedules, identifying backup windows, visualizing auto-growth events, troubleshooting overlapping operations, or creating visual reports for management. The timeline shows execution duration, status, and timing relationships across multiple instances, with hover tooltips displaying detailed information including start/end times and duration calculations. |
10 | 10 |
|
11 | 11 | Output is a self-contained HTML file that can be viewed in any browser, emailed to stakeholders, or archived for historical analysis. Supports both single and multi-instance scenarios with automatic labeling and color-coded status indicators. |
12 | 12 |
|
13 | 13 | .PARAMETER InputObject |
14 | | - Specifies the SQL Server data to convert into timeline visualization. Accepts piped output from Get-DbaAgentJobHistory or Get-DbaDbBackupHistory. |
15 | | - Use this to transform job execution history or backup operation data into an interactive HTML timeline chart. |
| 14 | + Specifies the SQL Server data to convert into timeline visualization. Accepts piped output from Get-DbaAgentJobHistory, Get-DbaDbBackupHistory, or Find-DbaDbGrowthEvent. |
| 15 | + Use this to transform job execution history, backup operation data, or database auto-growth/shrink events into an interactive HTML timeline chart. |
16 | 16 | The function automatically detects the input type and formats the timeline appropriately with status colors and duration calculations. |
17 | 17 |
|
18 | 18 | .PARAMETER ExcludeRowLabel |
@@ -61,6 +61,11 @@ function ConvertTo-DbaTimeline { |
61 | 61 |
|
62 | 62 | Creates an output file containing a pretty timeline for the agent job history since 2018-08-13 for all of the registered servers on sqlcm |
63 | 63 |
|
| 64 | + .EXAMPLE |
| 65 | + PS C:\> Find-DbaDbGrowthEvent -SqlInstance sql-1 | ConvertTo-DbaTimeline | Out-File C:\temp\DbaDbGrowthEvent.html -Encoding ASCII |
| 66 | +
|
| 67 | + Creates an output file containing a timeline of all database auto-growth and auto-shrink events for sql-1. |
| 68 | +
|
64 | 69 | .EXAMPLE |
65 | 70 | PS C:\> $messageParameters = @{ |
66 | 71 | >> Subject = "Backup history for sql2017 and sql2016" |
@@ -164,6 +169,9 @@ function ConvertTo-DbaTimeline { |
164 | 169 | } elseif ($InputObject[0] -is [Dataplat.Dbatools.Database.BackupHistory]) { |
165 | 170 | $CallerName = " Get-DbaDbBackupHistory" |
166 | 171 | $data = $InputObject | Select-Object @{ Name = "SqlInstance"; Expression = { $_.SqlInstance } }, @{ Name = "InstanceName"; Expression = { $_.InstanceName } }, @{ Name = "vLabel"; Expression = { "[" + $($_.SqlInstance -replace "\\", "\\\") + "] " + $_.Database } }, @{ Name = "hLabel"; Expression = { $_.Type } }, @{ Name = "StartDate"; Expression = { $(ConvertTo-JsDate($_.Start)) } }, @{ Name = "EndDate"; Expression = { $(ConvertTo-JsDate($_.End)) } } |
| 172 | + } elseif ($null -ne $InputObject[0].PSObject.Properties['EventClass'] -and $null -ne $InputObject[0].PSObject.Properties['ChangeInSize']) { |
| 173 | + $CallerName = "Find-DbaDbGrowthEvent" |
| 174 | + $data = $InputObject | Select-Object @{ Name = "SqlInstance"; Expression = { $_.SqlInstance } }, @{ Name = "InstanceName"; Expression = { $_.InstanceName } }, @{ Name = "vLabel"; Expression = { "[" + $($_.SqlInstance -replace "\\", "\\\") + "] " + $_.DatabaseName } }, @{ Name = "hLabel"; Expression = { switch ([int]$_.EventClass) { 92 { "Data Grow" } 93 { "Log Grow" } 94 { "Data Shrink" } 95 { "Log Shrink" } default { "Unknown" } } } }, @{ Name = "Style"; Expression = { if ([int]$_.EventClass -in 92, 93) { "#36B300" } else { "#FF8C00" } } }, @{ Name = "StartDate"; Expression = { $(ConvertTo-JsDate($_.StartTime)) } }, @{ Name = "EndDate"; Expression = { $(ConvertTo-JsDate($_.EndTime)) } } |
167 | 175 | } else { |
168 | 176 | # sorry to be so formal, can't help it ;) |
169 | 177 | Stop-Function -Message "Unsupported input data. To request support for additional commands, please file an issue at dbatools.io/issues and we'll take a look" |
|
0 commit comments