├── .gitignore ├── Documentation ├── Documentation.md ├── Home_CollectionItemEditor.png ├── Home_CollectionSetEditor.png ├── Home_CollectionSetManager.png ├── Home_CollectorTypeEditor.png ├── Home_Connect.png ├── Home_ParametersEditor.png ├── Home_SQLEditor.png ├── Home_XEDataForm.png ├── Home_XEReaderParametersEditor_1.png ├── Home_XEReaderParametersEditor_2.png ├── Home_XMLEditor.png ├── Home_collectionset.png ├── Screenshots.md ├── Using the TSQL Collector type.md ├── Using the TSQL Collector type_collectionset.png ├── Using the XEReader Collector type.md ├── Using the XEReader Collector type_XEReaderCollectionSet.png └── Using the XEReader Collector type_email.png ├── ExtendedTSQLCollector ├── CollectionSet │ ├── CollectionSet.database │ ├── CollectionSet.dtproj │ ├── CollectionSet.sln │ ├── CollectionSetSetup.sql │ ├── ExtendedTSQLCollect.dtsx │ ├── ExtendedTSQLUpload.dtsx │ ├── ExtendedXEReaderCollect.dtsx │ ├── ExtendedXEReaderUpload.dtsx │ ├── Setup │ │ └── CollectionSetSetup.sql │ ├── test.dtsconfig │ └── test.dtsx ├── CollectionSetManager │ ├── 1397849464_68701.ico │ ├── 1397849640_69471.png │ ├── AboutBox.Designer.cs │ ├── AboutBox.cs │ ├── AboutBox.resx │ ├── App.config │ ├── Banner.png │ ├── CollectionItemControl.Designer.cs │ ├── CollectionItemControl.cs │ ├── CollectionItemControl.resx │ ├── CollectionSetControl.Designer.cs │ ├── CollectionSetControl.cs │ ├── CollectionSetControl.resx │ ├── CollectionSetDataForm.Designer.cs │ ├── CollectionSetDataForm.cs │ ├── CollectionSetDataForm.resx │ ├── CollectionSetManager.csproj │ ├── CollectionSetManager.csproj.vspscc │ ├── CollectorTypeControl.Designer.cs │ ├── CollectorTypeControl.cs │ ├── CollectorTypeControl.resx │ ├── ComboboxItem.cs │ ├── Main.Designer.cs │ ├── Main.cs │ ├── Main.resx │ ├── Manager.Designer.cs │ ├── Manager.cs │ ├── Manager.resx │ ├── Program.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── Resources │ │ ├── 1397849640_69471.ico │ │ ├── DataCollection.ico │ │ ├── folder.ico │ │ ├── jobs.ico │ │ ├── package.ico │ │ ├── server.ico │ │ ├── steps.ico │ │ └── text3835.png │ ├── SelectPackageDialog.Designer.cs │ ├── SelectPackageDialog.cs │ ├── SelectPackageDialog.resx │ ├── TSQLParametersEditor.Designer.cs │ ├── TSQLParametersEditor.cs │ ├── TSQLParametersEditor.resx │ ├── TablessControl.cs │ ├── XEReaderParametersEditor.Designer.cs │ ├── XEReaderParametersEditor.cs │ ├── XEReaderParametersEditor.resx │ ├── XMLEditor.Designer.cs │ ├── XMLEditor.cs │ ├── XMLEditor.resx │ ├── get_tv_items.sql │ └── packages.config ├── Common │ ├── AlertConfig.cs │ ├── AlertDispatcher.cs │ ├── CollectionItemConfig.cs │ ├── CollectorConfig.cs │ ├── CollectorLogger.cs │ ├── CollectorUtils.cs │ ├── Common.csproj │ ├── Common.csproj.vspscc │ ├── DataTableTSQLAdapter.cs │ ├── EmailAlertDispatcher.cs │ ├── Enum.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ └── Resources.resx │ ├── Resources │ │ ├── DataTableHtmlXslt.xml │ │ └── HtmlTableStyle.css │ ├── TSQLCollectionItemConfig.cs │ ├── TSQLCollectorConfig.cs │ ├── Uploader.cs │ ├── XEReaderCollectionItemConfig.cs │ └── XEReaderCollectorConfig.cs ├── ExtendedTSQLCollector.sln ├── ExtendedTSQLCollector.vssscc ├── ExtendedTSQLCollector │ ├── App.config │ ├── Collector.cs │ ├── ExtendedTSQLCollector.csproj │ ├── ExtendedTSQLCollector.csproj.vspscc │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── packages.config ├── ExtendedTSQLUploader │ ├── App.config │ ├── ExtendedTSQLUploader.csproj │ ├── ExtendedTSQLUploader.csproj.vspscc │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Uploader.cs │ └── packages.config ├── ExtendedXEReaderCollector │ ├── Collector.cs │ ├── ExtendedXEReaderCollector.csproj │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── app.config │ └── packages.config ├── ExtendedXEReaderCollectorTrigger │ ├── App.config │ ├── ExtendedXEReaderCollectorTrigger.csproj │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── packages.config ├── ExtendedXEReaderUploader │ ├── App.config │ ├── ExtendedXEReaderUploader.csproj │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Uploader.cs │ └── packages.config ├── InstallCollectorType │ ├── App.config │ ├── CollectorTypeInstaller.cs │ ├── InstallCollectorType.csproj │ ├── InstallCollectorType.csproj.vspscc │ ├── Program.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ └── Resources.resx │ ├── Resources │ │ ├── XEReaderParamFormatter.xslt │ │ └── XEReaderParamSchema.xml │ └── packages.config ├── Packages.dgml ├── Setup │ ├── Product.wxs │ ├── Setup.wixproj │ └── Setup.wixproj.vspscc ├── UpgradeLog.htm ├── UserControlLibrary │ ├── Converters │ │ ├── DateTimeDoubleConverter.cs │ │ └── TimeSpanConverter.cs │ ├── DateRangeSlider │ │ ├── DateRangeSlider.xaml │ │ ├── DateRangeSlider.xaml.cs │ │ └── SliderResources.xaml │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ └── UserControlLibrary.csproj └── packages │ └── repositories.config ├── Readme.md └── license.md /.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | obj/ 3 | packages/ 4 | *.suo 5 | /ExtendedTSQLCollector/.vs/ExtendedTSQLCollector/v15/sqlite3/storage.ide 6 | -------------------------------------------------------------------------------- /Documentation/Documentation.md: -------------------------------------------------------------------------------- 1 | **Installation** 2 | 3 | * Download the appropriate package (x86 or x64) depending on the bitness of the SQL Server instance to monitor. A 32 bit instance on a 64 bit OS needs the x86 setup kit. 4 | * Make sure the SSIS components are installed on the target SQL Server machine. 5 | * Install the msi to the target SQL Server machine. Remember that the collection items run locally on the SQL Server box. 6 | * Install the msi to your client machine, in order to manage data collection remotely. 7 | * Run the ExtendedTSQLCollector application in your Start Menu. It will start the CollectionSet Manager, which will ask for a target SQL Server instance: type the instance name and hit "Connect". 8 | * Select the Collector Types node and hit the "Install" or "Update" button in the right panel. This step installs the collector types and their SSIS packages to the target SQL Server instance. 9 | 10 | 11 | **Usage** 12 | 13 | * Create a collection item using one of the collector types provided 14 | * [Using the TSQL Collector type](Using%20the%20TSQL%20Collector%20type.md) 15 | * [Using the XEReader Collector type](Using%20the%20XEReader%20Collector%20type.md) 16 | * Start the collection set from SSMS or from the CollectionSet Manager 17 | * The target table in the MDW database is created automatically whenever possible. 18 | * Review the collected data in the MDW database 19 | 20 | **Troubleshooting** 21 | * A log file can be found at %ProgramFiles%\ExtendedTSQLCollector\Logs. 22 | * Future versions of the CollectionSet Manager will show the logs directly from the UI 23 | 24 | **Need help?** 25 | Twitter @spaghettidba 26 | Email spaghettidba@sqlconsulting.it 27 | 28 | 29 | . -------------------------------------------------------------------------------- /Documentation/Home_CollectionItemEditor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/Documentation/Home_CollectionItemEditor.png -------------------------------------------------------------------------------- /Documentation/Home_CollectionSetEditor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/Documentation/Home_CollectionSetEditor.png -------------------------------------------------------------------------------- /Documentation/Home_CollectionSetManager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/Documentation/Home_CollectionSetManager.png -------------------------------------------------------------------------------- /Documentation/Home_CollectorTypeEditor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/Documentation/Home_CollectorTypeEditor.png -------------------------------------------------------------------------------- /Documentation/Home_Connect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/Documentation/Home_Connect.png -------------------------------------------------------------------------------- /Documentation/Home_ParametersEditor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/Documentation/Home_ParametersEditor.png -------------------------------------------------------------------------------- /Documentation/Home_SQLEditor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/Documentation/Home_SQLEditor.png -------------------------------------------------------------------------------- /Documentation/Home_XEDataForm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/Documentation/Home_XEDataForm.png -------------------------------------------------------------------------------- /Documentation/Home_XEReaderParametersEditor_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/Documentation/Home_XEReaderParametersEditor_1.png -------------------------------------------------------------------------------- /Documentation/Home_XEReaderParametersEditor_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/Documentation/Home_XEReaderParametersEditor_2.png -------------------------------------------------------------------------------- /Documentation/Home_XMLEditor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/Documentation/Home_XMLEditor.png -------------------------------------------------------------------------------- /Documentation/Home_collectionset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/Documentation/Home_collectionset.png -------------------------------------------------------------------------------- /Documentation/Screenshots.md: -------------------------------------------------------------------------------- 1 | Here are some screenshots of the GUI: 2 | 3 | **Connection:** 4 | ![](Home_Connect.png) 5 | 6 | **Collector Type Editor:** 7 | ![](Home_CollectorTypeEditor.png) 8 | 9 | **Collection Set Editor:** 10 | ![](Home_CollectionSetEditor.png) 11 | 12 | **Collection Item Editor:** 13 | ![](Home_CollectionItemEditor.png) 14 | 15 | **TSQL Parameters Editor:** 16 | ![](Home_ParametersEditor.png) 17 | 18 | **XEReader Parameters Editor:** 19 | ![](Home_XEReaderParametersEditor_1.png) 20 | ![](Home_XEReaderParametersEditor_2.png) 21 | 22 | **SQL Editor:** 23 | ![](Home_SQLEditor.png) 24 | 25 | **XML Editor for Collector Type Parameter Schema and Formatter and for Collection Items parameters:** 26 | ![](Home_XMLEditor.png) 27 | 28 | **Browse the collected data:** 29 | ![](Home_XEDataForm.png) -------------------------------------------------------------------------------- /Documentation/Using the TSQL Collector type.md: -------------------------------------------------------------------------------- 1 | # Using the TSQL Collector type 2 | 3 | Here is an example of the usage of the ExtendedTSQLCollcector Collector Type. 4 | The XML schema of the parameters is the same exact schema used by the Generic T-SQL Query Collector Type included in SQL Server. 5 | 6 | ```sql 7 | USE msdb; 8 | GO 9 | ----------------------------------------------------------------------------- 10 | /* 11 | ====== 12 | Create Collection Set 13 | ====== 14 | */ 15 | -- Create the collection set 16 | RAISERROR ('Creating collection set "Single-use Cached Plans"...',0, 1) WITH NOWAIT; 17 | DECLARE @schedule_uid UNIQUEIDENTIFIER; 18 | SELECT @schedule_uid = (select schedule_uid from sysschedules_localserver_view where name=N'CollectorSchedule_Every_6h'); 19 | DECLARE @collection_set_id INT; 20 | EXEC dbo.sp_syscollector_create_collection_set 21 | @name = N'Single Use Cached Plans', 22 | @schedule_uid = @schedule_uid, -- 6 hours 23 | @collection_mode = 0, -- noncached 24 | @days_until_expiration = 30, -- retain stats for 30 days 25 | @description = N'Collects Single Use Cached Plans', 26 | @collection_set_id = @collection_set_id output, 27 | @collection_set_uid = '989413FA-FB42-4B99-A8D1-40C658C8DA6C'; 28 | 29 | 30 | 31 | -- Create a collection item to capture cached plans 32 | DECLARE @parameters xml; 33 | DECLARE @collection_item_id INT; 34 | SELECT @parameters = convert(xml, N' 35 | 36 | 37 | 38 | SELECT TOP(50) T.[text](text) AS [QueryText](QueryText), cp.size_in_bytes, CAST(P.query_plan AS nvarchar(max)) AS query_plan 39 | FROM sys.dm_exec_cached_plans AS cp WITH (NOLOCK) 40 | CROSS APPLY sys.dm_exec_sql_text(plan_handle) AS T 41 | CROSS APPLY sys.dm_exec_query_plan(plan_handle) AS P 42 | WHERE cp.cacheobjtype = N''Compiled Plan'' 43 | AND cp.objtype = N''Adhoc'' 44 | AND cp.usecounts = 1 45 | ORDER BY cp.size_in_bytes DESC OPTION (RECOMPILE); 46 | 47 | cached_plans 48 | 49 | 50 | '); 51 | 52 | RAISERROR ('Creating collection item "Single Use Cached Plans"...',0, 1) WITH NOWAIT; 53 | EXEC dbo.sp_syscollector_create_collection_item 54 | @collection_set_id = @collection_set_id, 55 | @collector_type_uid = N'FD34D746-9A4D-4901-B872-3AF7CDBF7D37', -- Collector Type 56 | @name = 'Single Use Cached Plans Collection Item', 57 | @frequency = 60, 58 | @parameters = @parameters, 59 | @collection_item_id = @collection_item_id OUTPUT; 60 | 61 | GO 62 | ``` 63 | 64 | After running the script, you will find a custom collection set definded like this: 65 | 66 | ![](Using%20the%20TSQL%20Collector%20type_collectionset.png) 67 | 68 | # Warning 69 | 70 | XML columns cannot be added automatically to the target table. If your collection item collects XML columns, create the target table upfront, otherwise cast the XML column to nvarchar(max) in the collection item query. 71 | -------------------------------------------------------------------------------- /Documentation/Using the TSQL Collector type_collectionset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/Documentation/Using the TSQL Collector type_collectionset.png -------------------------------------------------------------------------------- /Documentation/Using the XEReader Collector type.md: -------------------------------------------------------------------------------- 1 | # Using the XEReader Collector type 2 | 3 | Here is an example of how to use the ExtendedXEReader Collector Type. 4 | The parameters found in the XML schema are described below: 5 | 6 | * `` - is the top container describing the interaction between the collector and the XE session 7 | * `` - Name of the Extended Events session to attach to 8 | * `` - Name of the output table to create in MDW 9 | * `` - XE Session definition. Insert here the CREATE SESSION statement 10 | * `` - Filter to apply to the events collected. 11 | * `` - Comma separated list of the columns to collect from the session 12 | * `` - this is the container of the alerts fired by the collector 13 | * Attributes: Enabled="true/false" WriteToERRORLOG="true/false" WriteToWindowsLog="true/false" 14 | * `` - Sender address. In this implementation it is the name of a dbmail profile. 15 | * `` - Target recipient for the alert. 16 | * `` - Subject of the emails 17 | * `` - Email importance 18 | * `` - Comma separated list of the columns to include in the email message 19 | * `` - Filter to apply to the alerts. It can be a different filter, to reduce the number of messages sent 20 | * `` - It can be "Atomic" or "Grouped" - In the first case, alerts are sent as soon as the event is received, in the latter alerts are grouped and sent in a single message with frequency equal to the collection frequency specified in the Delay parameter 21 | * `` - Specifies the number of seconds to wait before grouping and sending alerts in Grouped mode. 22 | 23 | ```sql 24 | -- Enable editing advanced configuration options 25 | EXEC sp_configure 'advanced', 1 26 | RECONFIGURE 27 | GO 28 | 29 | -- Set the blocked process threshold 30 | EXEC sp_configure 'blocked process threshold (s)', 15 31 | RECONFIGURE 32 | GO 33 | 34 | 35 | USE msdb; 36 | GO 37 | IF EXISTS ( 38 | SELECT 1 39 | FROM msdb.dbo.syscollector_collection_sets 40 | WHERE name = N'Blocked Process Reports' 41 | ) 42 | EXEC dbo.sp_syscollector_delete_collection_set 43 | @name = N'Blocked Process Reports'; 44 | 45 | 46 | ----------------------------------------------------------------------------- 47 | /* 48 | ====== 49 | Create Collection Set 50 | ====== 51 | */ 52 | -- Create the collection set 53 | RAISERROR ('Creating collection set "Blocked Process Reports"...',0, 1) WITH NOWAIT; 54 | DECLARE @schedule_uid UNIQUEIDENTIFIER; 55 | SELECT @schedule_uid = (select schedule_uid from sysschedules_localserver_view where name=N'CollectorSchedule_Every_5min'); 56 | DECLARE @collection_set_id INT; 57 | EXEC dbo.sp_syscollector_create_collection_set 58 | @name = N'Blocked Process Reports', 59 | @schedule_uid = @schedule_uid, -- 5 minutes 60 | @collection_mode = 0, -- cached 61 | @days_until_expiration = 30, -- retain stats for 30 days 62 | @description = N'Collects Blocked Process Reports using Extended Events', 63 | @collection_set_id = @collection_set_id output, 64 | @collection_set_uid = '9FD45270-2A37-47ED-BE6E-DEA413095420'; 65 | 66 | 67 | 68 | 69 | -- Create a collection item to capture blocked processes 70 | DECLARE @parameters xml; 71 | DECLARE @collection_item_id INT; 72 | SELECT @parameters = convert(xml, N' 73 | 74 | 75 | blocked_processes 76 | blocked_processes_table 77 | 78 | CREATE EVENT SESSION [blocked_processes](blocked_processes) ON SERVER ADD EVENT sqlserver.blocked_process_report 79 | WITH ( 80 | MAX_MEMORY = 2048 KB 81 | ,EVENT_RETENTION_MODE = ALLOW_SINGLE_EVENT_LOSS 82 | ,MAX_DISPATCH_LATENCY = 30 SECONDS 83 | ,MAX_EVENT_SIZE = 0 KB 84 | ,MEMORY_PARTITION_MODE = NONE 85 | ,TRACK_CAUSALITY = OFF 86 | ,STARTUP_STATE = ON 87 | ) 88 | 89 | duration <= 30000000 90 | blocked_process 91 | 92 | 93 | MailProfile 94 | DbAdmins@mycompany.com 95 | Blocked process detected 96 | High 97 | blocked_process 98 | duration <= 30000000 99 | Atomic 100 | 60 101 | 102 | 103 | '); 104 | 105 | RAISERROR ('Creating collection item "Blocked Process Reports"...',0, 1) WITH NOWAIT; 106 | EXEC dbo.sp_syscollector_create_collection_item 107 | @collection_set_id = @collection_set_id, 108 | @collector_type_uid = N'57AFAFB4-D4BE-4E62-9C6A-D2F2EA5FC5E9', -- Collector Type 109 | @name = 'Test Item', 110 | @frequency = 60, 111 | @parameters = @parameters, 112 | @collection_item_id = @collection_item_id OUTPUT; 113 | 114 | GO 115 | ``` 116 | 117 | The created collection set will resemble this: 118 | 119 | ![](Using%20the%20XEReader%20Collector%20type_XEReaderCollectionSet.png) 120 | 121 | The email messages received will look like this one: 122 | 123 | ![](Using%20the%20XEReader%20Collector%20type_email.png) 124 | 125 | ## Known limitations 126 | 127 | * Database Mail alerts are supported. The other kinds of alerts are not supported yet -------------------------------------------------------------------------------- /Documentation/Using the XEReader Collector type_XEReaderCollectionSet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/Documentation/Using the XEReader Collector type_XEReaderCollectionSet.png -------------------------------------------------------------------------------- /Documentation/Using the XEReader Collector type_email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/Documentation/Using the XEReader Collector type_email.png -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSet/CollectionSet.database: -------------------------------------------------------------------------------- 1 |  2 | CollectionSet 3 | CollectionSet 4 | 0001-01-01T00:00:00Z 5 | 0001-01-01T00:00:00Z 6 | 0001-01-01T00:00:00Z 7 | Unprocessed 8 | 0001-01-01T00:00:00Z 9 | 10 | Default 11 | Unchanged 12 | 13 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSet/CollectionSet.dtproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10.50.4000.0 4 | 9.0.1.0 5 | $base64$PFNvdXJjZUNvbnRyb2xJbmZvIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOmRkbDI9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDAzL2VuZ2luZS8yIiB4bWxuczpkZGwyXzI9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDAzL2VuZ2luZS8yLzIiIHhtbG5zOmRkbDEwMF8xMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDA4L2VuZ2luZS8xMDAvMTAwIiB4bWxuczpkZGwyMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEwL2VuZ2luZS8yMDAiIHhtbG5zOmRkbDIwMF8yMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEwL2VuZ2luZS8yMDAvMjAwIiB4bWxuczpkd2Q9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vRGF0YVdhcmVob3VzZS9EZXNpZ25lci8xLjAiPg0KICA8RW5hYmxlZD5mYWxzZTwvRW5hYmxlZD4NCiAgPFByb2plY3ROYW1lPjwvUHJvamVjdE5hbWU+DQogIDxBdXhQYXRoPjwvQXV4UGF0aD4NCiAgPExvY2FsUGF0aD48L0xvY2FsUGF0aD4NCiAgPFByb3ZpZGVyPjwvUHJvdmlkZXI+DQo8L1NvdXJjZUNvbnRyb2xJbmZvPg== 6 | 7 | CollectionSet.database 8 | CollectionSet.database 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | Development 20 | 21 | bin 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ExtendedTSQLCollect.dtsx 32 | ExtendedTSQLCollect.dtsx 33 | 34 | 35 | 36 | ExtendedTSQLUpload.dtsx 37 | ExtendedTSQLUpload.dtsx 38 | 39 | 40 | 41 | test.dtsx 42 | test.dtsx 43 | 44 | 45 | 46 | ExtendedXEReaderUpload.dtsx 47 | ExtendedXEReaderUpload.dtsx 48 | 49 | 50 | 51 | ExtendedXEReaderCollect.dtsx 52 | ExtendedXEReaderCollect.dtsx 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSet/CollectionSet.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual Studio 2008 4 | Project("{D183A3D8-5FD8-494B-B014-37F57B35E655}") = "CollectionSet", "CollectionSet.dtproj", "{45E6363D-4821-47D8-BBA8-AA94C232A193}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Development|Default = Development|Default 9 | EndGlobalSection 10 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 11 | {45E6363D-4821-47D8-BBA8-AA94C232A193}.Development|Default.ActiveCfg = Development 12 | {45E6363D-4821-47D8-BBA8-AA94C232A193}.Development|Default.Build.0 = Development 13 | EndGlobalSection 14 | GlobalSection(SolutionProperties) = preSolution 15 | HideSolutionNode = FALSE 16 | EndGlobalSection 17 | EndGlobal 18 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSet/CollectionSetSetup.sql: -------------------------------------------------------------------------------- 1 | 2 | ----------------------------------------------------------------------------- 3 | /* 4 | ====== 5 | Create Collection Set 6 | ====== 7 | */ 8 | -- Create the collection set 9 | RAISERROR ('Creating collection set "Single-use Cached Plans"...',0, 1) WITH NOWAIT; 10 | DECLARE @schedule_uid UNIQUEIDENTIFIER; 11 | SELECT @schedule_uid = (select schedule_uid from sysschedules_localserver_view where name=N'CollectorSchedule_Every_6h'); 12 | DECLARE @collection_set_id INT; 13 | EXEC dbo.sp_syscollector_create_collection_set 14 | @name = N'Single Use Cached Plans', 15 | @schedule_uid = @schedule_uid, -- 6 hours 16 | @collection_mode = 0, -- noncached 17 | @days_until_expiration = 30, -- retain stats for 30 days 18 | @description = N'Collects Single Use Cached Plans', 19 | @collection_set_id = @collection_set_id output, 20 | @collection_set_uid = '989413FA-FB42-4B99-A8D1-40C658C8DA6C'; 21 | 22 | 23 | 24 | -- Create a collection item to capture cached plans 25 | DECLARE @parameters xml; 26 | DECLARE @collection_item_id INT; 27 | SELECT @parameters = convert(xml, N' 28 | 29 | 30 | 31 | SELECT TOP(50) T.[text] AS [QueryText], cp.size_in_bytes, CAST(P.query_plan AS nvarchar(max)) AS query_plan 32 | FROM sys.dm_exec_cached_plans AS cp WITH (NOLOCK) 33 | CROSS APPLY sys.dm_exec_sql_text(plan_handle) AS T 34 | CROSS APPLY sys.dm_exec_query_plan(plan_handle) AS P 35 | WHERE cp.cacheobjtype = N''Compiled Plan'' 36 | AND cp.objtype = N''Adhoc'' 37 | AND cp.usecounts = 1 38 | ORDER BY cp.size_in_bytes DESC OPTION (RECOMPILE); 39 | 40 | cached_plans 41 | 42 | 43 | '); 44 | 45 | RAISERROR ('Creating collection item "Single Use Cached Plans"...',0, 1) WITH NOWAIT; 46 | EXEC dbo.sp_syscollector_create_collection_item 47 | @collection_set_id = @collection_set_id, 48 | @collector_type_uid = N'FD34D746-9A4D-4901-B872-3AF7CDBF7D37', -- Collector Type 49 | @name = 'Single Use Cached Plans Collection Item', 50 | @frequency = 60, 51 | @parameters = @parameters, 52 | @collection_item_id = @collection_item_id OUTPUT; 53 | 54 | GO 55 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/1397849464_68701.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/ExtendedTSQLCollector/CollectionSetManager/1397849464_68701.ico -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/1397849640_69471.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/ExtendedTSQLCollector/CollectionSetManager/1397849640_69471.png -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/AboutBox.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Reflection; 7 | using System.Windows.Forms; 8 | 9 | namespace Sqlconsulting.DataCollector.CollectionSetManager 10 | { 11 | partial class AboutBox : Form 12 | { 13 | public AboutBox() 14 | { 15 | InitializeComponent(); 16 | 17 | String DisplayAssemblyTitle = "ExtendedTSQLCollector"; 18 | 19 | this.Text = String.Format("About {0}", DisplayAssemblyTitle); 20 | this.labelProductName.Text = DisplayAssemblyTitle; 21 | this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion); 22 | this.labelCopyright.Text = AssemblyCopyright; 23 | this.labelCompanyName.Text = AssemblyCompany; 24 | this.textBoxDescription.Text = AssemblyDescription; 25 | } 26 | 27 | #region Assembly Attribute Accessors 28 | 29 | public string AssemblyTitle 30 | { 31 | get 32 | { 33 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); 34 | if (attributes.Length > 0) 35 | { 36 | AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0]; 37 | if (titleAttribute.Title != "") 38 | { 39 | return titleAttribute.Title; 40 | } 41 | } 42 | return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase); 43 | } 44 | } 45 | 46 | public string AssemblyVersion 47 | { 48 | get 49 | { 50 | return Assembly.GetExecutingAssembly().GetName().Version.ToString(); 51 | } 52 | } 53 | 54 | public string AssemblyDescription 55 | { 56 | get 57 | { 58 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false); 59 | if (attributes.Length == 0) 60 | { 61 | return ""; 62 | } 63 | return ((AssemblyDescriptionAttribute)attributes[0]).Description; 64 | } 65 | } 66 | 67 | public string AssemblyProduct 68 | { 69 | get 70 | { 71 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false); 72 | if (attributes.Length == 0) 73 | { 74 | return ""; 75 | } 76 | return ((AssemblyProductAttribute)attributes[0]).Product; 77 | } 78 | } 79 | 80 | public string AssemblyCopyright 81 | { 82 | get 83 | { 84 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); 85 | if (attributes.Length == 0) 86 | { 87 | return ""; 88 | } 89 | return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; 90 | } 91 | } 92 | 93 | public string AssemblyCompany 94 | { 95 | get 96 | { 97 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); 98 | if (attributes.Length == 0) 99 | { 100 | return ""; 101 | } 102 | return ((AssemblyCompanyAttribute)attributes[0]).Company; 103 | } 104 | } 105 | #endregion 106 | 107 | private void okButton_Click(object sender, EventArgs e) 108 | { 109 | this.Close(); 110 | } 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/Banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/ExtendedTSQLCollector/CollectionSetManager/Banner.png -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/CollectionItemControl.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/CollectionSetManager.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/ComboboxItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sqlconsulting.DataCollector.CollectionSetManager 7 | { 8 | public class ComboboxItem 9 | { 10 | public string Text { get; set; } 11 | public object Value { get; set; } 12 | 13 | public ComboboxItem(object Value, string Text) 14 | { 15 | this.Text = Text; 16 | this.Value = Value; 17 | } 18 | 19 | public override string ToString() 20 | { 21 | return Text; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/Manager.cs: -------------------------------------------------------------------------------- 1 | using Sqlconsulting.DataCollector.Utils; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Data; 6 | using System.Drawing; 7 | using System.Linq; 8 | using System.Text; 9 | //using System.Threading.Tasks; 10 | using System.Windows.Forms; 11 | 12 | namespace Sqlconsulting.DataCollector.CollectionSetManager 13 | { 14 | public partial class Manager : Form 15 | { 16 | public static String ServerName; 17 | 18 | 19 | public Manager() 20 | { 21 | InitializeComponent(); 22 | } 23 | 24 | private void button1_Click(object sender, EventArgs e) 25 | { 26 | this.Close(); 27 | } 28 | 29 | private void button2_Click(object sender, EventArgs e) 30 | { 31 | openMainForm(); 32 | } 33 | 34 | private void openMainForm() 35 | { 36 | ServerName = textBox1.Text; 37 | try 38 | { 39 | Cursor.Current = Cursors.WaitCursor; 40 | CollectorUtils.CheckConnection(ServerName); 41 | Cursor.Current = Cursors.Default; 42 | (new Main()).Show(); 43 | Hide(); 44 | } 45 | catch (Exception ex) 46 | { 47 | MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 48 | } 49 | } 50 | 51 | 52 | 53 | 54 | 55 | private void textBox1_KeyUp(object sender, KeyEventArgs e) 56 | { 57 | if (e.KeyCode == Keys.Enter) 58 | { 59 | openMainForm(); 60 | } 61 | } 62 | 63 | private void Manager_Shown(object sender, EventArgs e) 64 | { 65 | this.textBox1.SelectAll(); 66 | this.textBox1.Focus(); 67 | this.textBox3.Text = System.Security.Principal.WindowsIdentity.GetCurrent().Name; 68 | } 69 | 70 | private void button3_Click(object sender, EventArgs e) 71 | { 72 | (new AboutBox()).ShowDialog(); 73 | } 74 | 75 | 76 | 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | //using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace Sqlconsulting.DataCollector.CollectionSetManager 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new Manager()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CollectionSetManager")] 9 | [assembly: AssemblyDescription("A generic T-SQL collector type to extend and simplify the features offered by the built-in generic T-SQL collector type in the SQL Server Data Collector. More information can be found at http://extendedtsqlcollector.codeplex.com")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("sqlconsulting.it")] 12 | [assembly: AssemblyProduct("CollectionSetManager")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("6e95eacb-619d-4a67-9582-a921f26c95ab")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.6.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18444 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CollectionSetManager.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | public class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | public static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CollectionSetManager.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | public static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). 65 | /// 66 | public static System.Drawing.Icon DataCollection { 67 | get { 68 | object obj = ResourceManager.GetObject("DataCollection", resourceCulture); 69 | return ((System.Drawing.Icon)(obj)); 70 | } 71 | } 72 | 73 | /// 74 | /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). 75 | /// 76 | public static System.Drawing.Icon folder { 77 | get { 78 | object obj = ResourceManager.GetObject("folder", resourceCulture); 79 | return ((System.Drawing.Icon)(obj)); 80 | } 81 | } 82 | 83 | /// 84 | /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). 85 | /// 86 | public static System.Drawing.Icon jobs { 87 | get { 88 | object obj = ResourceManager.GetObject("jobs", resourceCulture); 89 | return ((System.Drawing.Icon)(obj)); 90 | } 91 | } 92 | 93 | /// 94 | /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). 95 | /// 96 | public static System.Drawing.Icon package { 97 | get { 98 | object obj = ResourceManager.GetObject("package", resourceCulture); 99 | return ((System.Drawing.Icon)(obj)); 100 | } 101 | } 102 | 103 | /// 104 | /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). 105 | /// 106 | public static System.Drawing.Icon server { 107 | get { 108 | object obj = ResourceManager.GetObject("server", resourceCulture); 109 | return ((System.Drawing.Icon)(obj)); 110 | } 111 | } 112 | 113 | /// 114 | /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). 115 | /// 116 | public static System.Drawing.Icon steps { 117 | get { 118 | object obj = ResourceManager.GetObject("steps", resourceCulture); 119 | return ((System.Drawing.Icon)(obj)); 120 | } 121 | } 122 | 123 | /// 124 | /// Looks up a localized resource of type System.Drawing.Bitmap. 125 | /// 126 | public static System.Drawing.Bitmap text3835 { 127 | get { 128 | object obj = ResourceManager.GetObject("text3835", resourceCulture); 129 | return ((System.Drawing.Bitmap)(obj)); 130 | } 131 | } 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.34014 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CollectionSetManager.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/Resources/1397849640_69471.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/ExtendedTSQLCollector/CollectionSetManager/Resources/1397849640_69471.ico -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/Resources/DataCollection.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/ExtendedTSQLCollector/CollectionSetManager/Resources/DataCollection.ico -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/Resources/folder.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/ExtendedTSQLCollector/CollectionSetManager/Resources/folder.ico -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/Resources/jobs.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/ExtendedTSQLCollector/CollectionSetManager/Resources/jobs.ico -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/Resources/package.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/ExtendedTSQLCollector/CollectionSetManager/Resources/package.ico -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/Resources/server.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/ExtendedTSQLCollector/CollectionSetManager/Resources/server.ico -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/Resources/steps.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/ExtendedTSQLCollector/CollectionSetManager/Resources/steps.ico -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/Resources/text3835.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/ExtendedTSQLCollector/CollectionSetManager/Resources/text3835.png -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/SelectPackageDialog.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Sqlconsulting.DataCollector.CollectionSetManager 2 | { 3 | partial class SelectPackageDialog 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SelectPackageDialog)); 32 | this.treeView1 = new System.Windows.Forms.TreeView(); 33 | this.panel1 = new System.Windows.Forms.Panel(); 34 | this.button2 = new System.Windows.Forms.Button(); 35 | this.button1 = new System.Windows.Forms.Button(); 36 | this.panel1.SuspendLayout(); 37 | this.SuspendLayout(); 38 | // 39 | // treeView1 40 | // 41 | this.treeView1.Location = new System.Drawing.Point(3, 3); 42 | this.treeView1.Name = "treeView1"; 43 | this.treeView1.Size = new System.Drawing.Size(334, 289); 44 | this.treeView1.TabIndex = 0; 45 | this.treeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterSelect); 46 | // 47 | // panel1 48 | // 49 | this.panel1.Controls.Add(this.button2); 50 | this.panel1.Controls.Add(this.button1); 51 | this.panel1.Controls.Add(this.treeView1); 52 | this.panel1.Location = new System.Drawing.Point(12, 12); 53 | this.panel1.Name = "panel1"; 54 | this.panel1.Size = new System.Drawing.Size(340, 325); 55 | this.panel1.TabIndex = 1; 56 | // 57 | // button2 58 | // 59 | this.button2.Location = new System.Drawing.Point(181, 298); 60 | this.button2.Name = "button2"; 61 | this.button2.Size = new System.Drawing.Size(75, 23); 62 | this.button2.TabIndex = 3; 63 | this.button2.Text = "Cancel"; 64 | this.button2.UseVisualStyleBackColor = true; 65 | this.button2.Click += new System.EventHandler(this.button2_Click); 66 | // 67 | // button1 68 | // 69 | this.button1.Location = new System.Drawing.Point(262, 298); 70 | this.button1.Name = "button1"; 71 | this.button1.Size = new System.Drawing.Size(75, 23); 72 | this.button1.TabIndex = 3; 73 | this.button1.Text = "OK"; 74 | this.button1.UseVisualStyleBackColor = true; 75 | this.button1.Click += new System.EventHandler(this.button1_Click); 76 | // 77 | // SelectPackageDialog 78 | // 79 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 80 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 81 | this.ClientSize = new System.Drawing.Size(364, 349); 82 | this.Controls.Add(this.panel1); 83 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 84 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 85 | this.MaximizeBox = false; 86 | this.MinimizeBox = false; 87 | this.Name = "SelectPackageDialog"; 88 | this.ShowInTaskbar = false; 89 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 90 | this.Text = "Select Package"; 91 | this.panel1.ResumeLayout(false); 92 | this.ResumeLayout(false); 93 | 94 | } 95 | 96 | #endregion 97 | 98 | private System.Windows.Forms.TreeView treeView1; 99 | private System.Windows.Forms.Panel panel1; 100 | private System.Windows.Forms.Button button2; 101 | private System.Windows.Forms.Button button1; 102 | } 103 | } -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/SelectPackageDialog.cs: -------------------------------------------------------------------------------- 1 | using CollectionSetManager.Properties; 2 | using Sqlconsulting.DataCollector.Utils; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.ComponentModel; 6 | using System.Data; 7 | using System.Drawing; 8 | using System.Linq; 9 | using System.Text; 10 | using System.Windows.Forms; 11 | 12 | namespace Sqlconsulting.DataCollector.CollectionSetManager 13 | { 14 | public partial class SelectPackageDialog : Form 15 | { 16 | 17 | static ImageList _imageList; 18 | public static ImageList ImageList 19 | { 20 | get 21 | { 22 | if (_imageList == null) 23 | { 24 | _imageList = new ImageList(); 25 | _imageList.Images.Add("package", Resources.package); 26 | _imageList.Images.Add("folder", Resources.folder); 27 | _imageList.Images.Add("server", Resources.server); 28 | } 29 | return _imageList; 30 | } 31 | } 32 | 33 | 34 | private TreeNode tnRoot = null; 35 | public Guid SelectedPackage { get; set; } 36 | public String SelectedPackagePath { get; set; } 37 | 38 | public SelectPackageDialog() 39 | { 40 | InitializeComponent(); 41 | PopulateTreeView(); 42 | } 43 | 44 | 45 | 46 | private void PopulateTreeView() 47 | { 48 | treeView1.ImageList = ImageList; 49 | 50 | // 51 | TreeNode[] subnodes = PopulateFolder(new Guid("00000000-0000-0000-0000-000000000000")); 52 | tnRoot = new TreeNode(Manager.ServerName, subnodes); 53 | tnRoot.ImageKey = "server"; 54 | tnRoot.SelectedImageKey = "server"; 55 | treeView1.Nodes.Add(tnRoot); 56 | treeView1.ExpandAll(); 57 | 58 | 59 | } 60 | 61 | private TreeNode[] PopulateFolder(Guid folderid) 62 | { 63 | String sql = @" 64 | SELECT 'Package' AS Type, P.id, P.name 65 | FROM msdb.dbo.sysssispackages AS P 66 | WHERE P.folderid = '{0}' 67 | 68 | UNION ALL 69 | 70 | SELECT 'Folder' AS Type, F.folderid, F.foldername 71 | FROM msdb.dbo.sysssispackagefolders AS F 72 | WHERE F.parentfolderid = '{0}' 73 | 74 | "; 75 | 76 | sql = String.Format(sql, folderid); 77 | 78 | DataTable dt = CollectorUtils.GetDataTable(Manager.ServerName, "msdb", sql); 79 | List nodes = new List(); 80 | foreach (DataRow dr in dt.Rows) 81 | { 82 | if (dr["Type"].ToString().Equals("Folder")) 83 | { 84 | TreeNode tn = null; 85 | TreeNode[] children = PopulateFolder((Guid)dr["id"]); 86 | if (children.Length > 0) 87 | { 88 | tn = new TreeNode(dr["name"].ToString(), children); 89 | } 90 | else 91 | { 92 | tn = new TreeNode(dr["name"].ToString()); 93 | } 94 | tn.ImageKey = "folder"; 95 | tn.SelectedImageKey = "folder"; 96 | nodes.Add(tn); 97 | } 98 | else 99 | { 100 | TreeNode tn = new TreeNode(dr["name"].ToString()); 101 | tn.ImageKey = "package"; 102 | tn.SelectedImageKey = "package"; 103 | tn.Tag = dr["id"]; 104 | nodes.Add(tn); 105 | } 106 | 107 | } 108 | return nodes.ToArray(); 109 | } 110 | 111 | private void button2_Click(object sender, EventArgs e) 112 | { 113 | DialogResult = System.Windows.Forms.DialogResult.Cancel; 114 | Close(); 115 | } 116 | 117 | private void button1_Click(object sender, EventArgs e) 118 | { 119 | SelectedPackage = new Guid(treeView1.SelectedNode.Tag.ToString()); 120 | SelectedPackagePath = BuildPath(treeView1.SelectedNode); 121 | DialogResult = System.Windows.Forms.DialogResult.OK; 122 | Close(); 123 | } 124 | 125 | private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) 126 | { 127 | button1.Enabled = (treeView1.SelectedNode.Tag != null); 128 | } 129 | 130 | private String BuildPath(TreeNode tn) 131 | { 132 | String results = ""; 133 | while (tn != tnRoot) 134 | { 135 | results = "\\\\" + tn.Text + results; 136 | tn = tn.Parent; 137 | } 138 | return results; 139 | } 140 | 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/TSQLParametersEditor.cs: -------------------------------------------------------------------------------- 1 | using Sqlconsulting.DataCollector.CollectionSetManager; 2 | using Sqlconsulting.DataCollector.Utils; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.ComponentModel; 6 | using System.Data; 7 | using System.Data.SqlClient; 8 | using System.Drawing; 9 | using System.Linq; 10 | using System.Text; 11 | using System.Windows.Forms; 12 | using System.Xml; 13 | using System.Xml.Linq; 14 | 15 | namespace Sqlconsulting.DataCollector.CollectionSetManager 16 | { 17 | public partial class TSQLParametersEditor : Form 18 | { 19 | 20 | public string ReturnValue { get; set; } 21 | 22 | public TSQLParametersEditor(string text) 23 | { 24 | InitializeComponent(); 25 | 26 | ReturnValue = text; 27 | 28 | initDataGrid(text); 29 | } 30 | 31 | private void initDataGrid(string text) 32 | { 33 | try 34 | { 35 | TSQLCollectionItemConfig[] items = parse(text); 36 | for(int i=0;i\r\n"; 112 | ReturnValue += "\r\n"; 113 | 114 | foreach(DataGridViewRow row in dataGridView1.Rows) 115 | { 116 | if (!String.IsNullOrEmpty((String)row.Cells[0].Value) || !String.IsNullOrEmpty((String)row.Cells[1].Value)) 117 | ReturnValue += new XElement("Query", 118 | new XElement("Value", row.Cells[1].Value), 119 | new XElement("OutputTable", row.Cells[0].Value)); 120 | } 121 | 122 | ReturnValue += ""; 123 | 124 | this.Close(); 125 | } 126 | 127 | private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) 128 | { 129 | 130 | } 131 | 132 | private void dataGridView1_CellEnter(object sender, DataGridViewCellEventArgs e) 133 | { 134 | if (e.ColumnIndex == 1) 135 | { 136 | 137 | DataGridViewCell cell = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex]; 138 | Object value = cell.Value; 139 | String text = value == null ? "" : value.ToString(); 140 | XMLEditor dialog = new XMLEditor(text, "SQL"); 141 | dialog.ShowDialog(this); 142 | cell.Value = dialog.ReturnValue; 143 | } 144 | } 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/TablessControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | class TablessControl : TabControl 5 | { 6 | protected override void WndProc(ref Message m) 7 | { 8 | // Hide tabs by trapping the TCM_ADJUSTRECT message 9 | if (m.Msg == 0x1328 && !DesignMode) m.Result = (IntPtr)1; 10 | else base.WndProc(ref m); 11 | } 12 | } -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/XMLEditor.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Sqlconsulting.DataCollector.CollectionSetManager 2 | { 3 | partial class XMLEditor 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.SuspendLayout(); 32 | // 33 | // XMLEditor 34 | // 35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 37 | this.ClientSize = new System.Drawing.Size(1026, 632); 38 | this.Name = "XMLEditor"; 39 | this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; 40 | this.Text = "XMLEditor"; 41 | this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.XMLEditor_Close); 42 | this.Load += new System.EventHandler(this.XMLEditor_Load); 43 | this.ResumeLayout(false); 44 | 45 | } 46 | 47 | #endregion 48 | } 49 | } -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/XMLEditor.cs: -------------------------------------------------------------------------------- 1 | using ICSharpCode.TextEditor.Document; 2 | using Sqlconsulting.DataCollector.Utils; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.ComponentModel; 6 | using System.Data; 7 | using System.Drawing; 8 | using System.IO; 9 | using System.Linq; 10 | using System.Text; 11 | using System.Windows.Forms; 12 | using System.Xml; 13 | 14 | namespace Sqlconsulting.DataCollector.CollectionSetManager 15 | { 16 | public partial class XMLEditor : Form 17 | { 18 | public String ReturnValue { get; set; } 19 | 20 | private ICSharpCode.TextEditor.TextEditorControl _textControl; 21 | 22 | 23 | public XMLEditor(String text, String type) 24 | { 25 | InitializeComponent(); 26 | _textControl = new ICSharpCode.TextEditor.TextEditorControl(); 27 | this.Controls.Add(_textControl); 28 | _textControl.Dock = DockStyle.Fill; 29 | 30 | _textControl.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy(type); 31 | 32 | this.Text = type + " Editor"; 33 | 34 | if(type.Equals("XML")) 35 | _textControl.Text = CollectorUtils.FormatXMLDocument(text); 36 | else 37 | _textControl.Text = text; 38 | } 39 | 40 | 41 | public XMLEditor(String text) 42 | : this(text, "XML") 43 | { 44 | 45 | } 46 | 47 | private void XMLEditor_Close(object sender, FormClosedEventArgs e) 48 | { 49 | ReturnValue = _textControl.Text; 50 | } 51 | 52 | private void XMLEditor_Load(object sender, EventArgs e) 53 | { 54 | this.Icon = Owner.Icon; 55 | 56 | Rectangle screen = Screen.PrimaryScreen.WorkingArea; 57 | int w = Width >= screen.Width ? screen.Width : (screen.Width + Width) / 2; 58 | int h = Height >= screen.Height ? screen.Height : (screen.Height + Height) / 2; 59 | this.Location = new Point((screen.Width - w) / 2, (screen.Height - h) / 2); 60 | this.Size = new Size(w, h); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/XMLEditor.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/get_tv_items.sql: -------------------------------------------------------------------------------- 1 | SELECT 'collection_sets' AS item_type, collection_set_uid, name, is_system 2 | FROM msdb.dbo.syscollector_collection_sets 3 | 4 | UNION ALL 5 | 6 | SELECT 'collector_types' AS item_type, collector_type_uid, name, is_system 7 | FROM msdb.dbo.syscollector_collector_types 8 | 9 | ORDER BY item_type DESC, is_system DESC, name ASC 10 | 11 | 12 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/CollectionSetManager/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/Common/AlertConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sqlconsulting.DataCollector.Utils 7 | { 8 | 9 | 10 | 11 | public class AlertConfig 12 | { 13 | 14 | public String Sender { get; set; } 15 | public String Recipient { get; set; } 16 | public int Delay { get; set; } 17 | public Boolean WriteToWindowsLog { get; set; } 18 | public Boolean WriteToErrorLog { get; set; } 19 | public Boolean Enabled { get; set; } 20 | public String Subject { get; set; } 21 | public String Filter { get; set; } 22 | public List Columns = new List(); 23 | public AlertMode Mode { get; set; } 24 | public ImportanceLevel Importance { get; set; } 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/Common/AlertDispatcher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Sqlconsulting.DataCollector.Utils 8 | { 9 | public abstract class AlertDispatcher 10 | { 11 | protected AlertConfig _config; 12 | protected DataRow _row; 13 | protected String _serverName; 14 | 15 | public AlertDispatcher(String serverName, AlertConfig cfg, DataRow row) 16 | { 17 | _serverName = serverName; 18 | _config = cfg; 19 | _row = row; 20 | } 21 | 22 | public abstract void dispatch(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/Common/CollectionItemConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | 7 | namespace Sqlconsulting.DataCollector.Utils 8 | { 9 | public abstract class CollectionItemConfig 10 | { 11 | 12 | public static Guid CollectorTypeUid; 13 | 14 | public String OutputTable { get; set; } 15 | public int Frequency { get; set; } 16 | public int Index { get; set; } 17 | public Boolean Enabled { get; set; } 18 | 19 | } 20 | 21 | 22 | } 23 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/Common/CollectorConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | 8 | namespace Sqlconsulting.DataCollector.Utils 9 | { 10 | public abstract class CollectorConfig 11 | { 12 | public String CacheDirectory { get; set; } 13 | public int CacheWindow { get; set; } 14 | public Boolean CollectorEnabled { get; set; } 15 | public String MDWDatabase { get; set; } 16 | public String MDWInstance { get; set; } 17 | public int DaysUntilExpiration { get; set; } 18 | public List Databases = new List(); 19 | public List collectionItems = new List(); 20 | public String MachineName { get; set; } 21 | public String InstanceName { get; set; } 22 | 23 | public virtual void readFromDatabase(String ServerInstance) 24 | { 25 | String qry = @" 26 | SELECT * 27 | FROM [msdb].[dbo].[syscollector_config_store] 28 | PIVOT( 29 | MAX(parameter_value) 30 | FOR parameter_name IN ( 31 | [CacheDirectory] 32 | ,[CacheWindow] 33 | ,[CollectorEnabled] 34 | ,[MDWDatabase] 35 | ,[MDWInstance] 36 | ) 37 | ) AS p 38 | "; 39 | 40 | DataTable data = CollectorUtils.GetDataTable(ServerInstance, "msdb", qry); 41 | DataRow row = data.Rows[0]; 42 | 43 | CacheDirectory = row["CacheDirectory"].ToString(); 44 | CacheWindow = Convert.ToInt32(row["CacheWindow"]); 45 | CollectorEnabled = Convert.ToBoolean(row["CollectorEnabled"]); 46 | MDWDatabase = row["MDWDatabase"].ToString(); 47 | MDWInstance = row["MDWInstance"].ToString(); 48 | 49 | if (String.IsNullOrEmpty(CacheDirectory)) 50 | { 51 | CacheDirectory = System.Environment.GetEnvironmentVariable("temp"); 52 | } 53 | 54 | qry = @" 55 | SELECT CAST(SERVERPROPERTY('MachineName') AS NVARCHAR(128)) AS MachineName 56 | ,ISNULL(CAST(SERVERPROPERTY('InstanceName') AS NVARCHAR(128)),'') AS InstanceName 57 | "; 58 | 59 | data = CollectorUtils.GetDataTable(ServerInstance, "msdb", qry); 60 | row = data.Rows[0]; 61 | 62 | MachineName = row["MachineName"].ToString(); 63 | InstanceName = row["InstanceName"].ToString(); 64 | 65 | } 66 | 67 | public abstract void readFromDatabase( 68 | String ServerInstance, 69 | Guid CollectionSetUid, 70 | int ItemId 71 | ); 72 | 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/Common/CollectorLogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Sqlconsulting.DataCollector.Utils 8 | { 9 | public class CollectorLogger 10 | { 11 | 12 | private String outputFolder; 13 | private String outputFile; 14 | private String prefix; 15 | 16 | public CollectorLogger(string SourceServerInstance, Guid CollectionSetUid, int ItemId) 17 | { 18 | prefix = CollectorUtils.getCacheFilePrefix(SourceServerInstance, CollectionSetUid, ItemId); 19 | prefix += "_" + DateTime.Now.ToString("yyyyMMdd"); 20 | outputFolder = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); 21 | outputFolder = Path.Combine(outputFolder, "Logs"); 22 | outputFile = Path.Combine(outputFolder, prefix + "_Collector.log"); 23 | 24 | System.IO.DirectoryInfo targetFolder = new System.IO.DirectoryInfo(outputFolder); 25 | 26 | if (!targetFolder.Exists) 27 | { 28 | targetFolder.Create(); 29 | } 30 | } 31 | 32 | 33 | public CollectorLogger(string SourceServerInstance) : this(SourceServerInstance, new Guid("00000000-0000-0000-0000-000000000000"), 0) 34 | { 35 | 36 | } 37 | 38 | 39 | /* 40 | * Log messages 41 | */ 42 | public void logMessage(String message) 43 | { 44 | 45 | FileInfo fi = new FileInfo(outputFile); 46 | if(!fi.Directory.Exists) 47 | { 48 | fi.Directory.Create(); 49 | } 50 | 51 | 52 | using (System.IO.StreamWriter file = new System.IO.StreamWriter(outputFile, true)) 53 | { 54 | file.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " - " + message); 55 | } 56 | 57 | 58 | } 59 | 60 | 61 | public void cleanupLogFiles(Int32 days) 62 | { 63 | // Cleanup old log entries 64 | DateTime border = DateTime.Now.AddDays(days * -1); 65 | 66 | foreach (String fileName in System.IO.Directory.GetFiles(outputFolder)) 67 | { 68 | System.IO.FileInfo currentFile = new System.IO.FileInfo(fileName); 69 | if (currentFile.LastWriteTime <= border) 70 | { 71 | currentFile.Delete(); 72 | } 73 | } 74 | } 75 | 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/Common/Common.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {B9F55A86-B918-416D-8020-181A5728AAA6} 8 | Library 9 | Properties 10 | Common 11 | Common 12 | v3.5 13 | 512 14 | 15 | SAK 16 | SAK 17 | SAK 18 | SAK 19 | 20 | 21 | true 22 | full 23 | false 24 | bin\Debug\ 25 | DEBUG;TRACE 26 | prompt 27 | 4 28 | 29 | 30 | pdbonly 31 | true 32 | bin\Release\ 33 | TRACE 34 | prompt 35 | 4 36 | 37 | 38 | bin\Release x64\ 39 | TRACE 40 | true 41 | pdbonly 42 | AnyCPU 43 | prompt 44 | MinimumRecommendedRules.ruleset 45 | 46 | 47 | 48 | False 49 | C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.ConnectionInfo.dll 50 | 51 | 52 | False 53 | C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Management.Sdk.Sfc.dll 54 | 55 | 56 | False 57 | C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Smo.dll 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | True 79 | True 80 | Resources.resx 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | PublicResXFileCodeGenerator 91 | Resources.Designer.cs 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 106 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/Common/Common.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/Common/EmailAlertDispatcher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Xml; 8 | using System.Xml.Linq; 9 | using System.Xml.Xsl; 10 | using System.Reflection; 11 | using System.Data.SqlClient; 12 | 13 | namespace Sqlconsulting.DataCollector.Utils 14 | { 15 | public class EmailAlertDispatcher : AlertDispatcher 16 | { 17 | public String Sender { get; set; } 18 | public String Recipient { get; set; } 19 | public String Subject { get; set; } 20 | 21 | public Sqlconsulting.DataCollector.Utils.ImportanceLevel Importance { get; set; } 22 | 23 | public EmailAlertDispatcher(String serverName, AlertConfig cfg, DataRow row) : base(serverName, cfg, row) 24 | { 25 | Sender = cfg.Sender; 26 | Recipient = cfg.Recipient; 27 | Subject = cfg.Subject; 28 | } 29 | 30 | 31 | public override void dispatch() 32 | { 33 | // Create empty DataTable and add the row to process 34 | DataTable table = _row.Table.Clone(); 35 | table.Rows.Add(_row.ItemArray); 36 | 37 | // Remove the columns not included in the output 38 | List columnsToRemove = new List(); 39 | foreach (DataColumn dc in table.Columns) 40 | { 41 | if (!_config.Columns.Contains(dc.ColumnName)) 42 | { 43 | columnsToRemove.Add(dc.ColumnName); 44 | } 45 | } 46 | foreach (String colName in columnsToRemove) 47 | { 48 | table.Columns.Remove(colName); 49 | } 50 | 51 | 52 | // Transform the DataTable to HTML 53 | string xmlString = string.Empty; 54 | using (TextWriter writer = new StringWriter()) 55 | { 56 | table.WriteXml(writer); 57 | xmlString = writer.ToString(); 58 | } 59 | 60 | XDocument result = new XDocument(); 61 | using (XmlWriter writer = result.CreateWriter()) 62 | { 63 | XslCompiledTransform xslt = new XslCompiledTransform(); 64 | String xsltString = Common.Properties.Resources.DataTableHtmlXslt; 65 | xslt.Load(XmlReader.Create(new StringReader(xsltString))); 66 | xslt.Transform(XDocument.Parse(xmlString).CreateReader(), writer); 67 | } 68 | 69 | string htmlDocument = 70 | "" 73 | + result.ToString(); 74 | 75 | 76 | int ConnectionTimeout = 15; 77 | int QueryTimeout = 600; 78 | String ConnectionString = String.Format("Server={0};Database={1};Integrated Security=True;Connect Timeout={2}", _serverName, "msdb", ConnectionTimeout); 79 | String sql = @"msdb.dbo.sp_send_dbmail"; 80 | 81 | using(SqlConnection conn = new SqlConnection()) { 82 | conn.ConnectionString = ConnectionString; 83 | 84 | try 85 | { 86 | conn.Open(); 87 | 88 | SqlCommand cmd = new SqlCommand(sql, conn); 89 | cmd.CommandType = CommandType.StoredProcedure; 90 | cmd.CommandTimeout = QueryTimeout; 91 | SqlCommandBuilder.DeriveParameters(cmd); 92 | 93 | cmd.Parameters["@profile_name"].Value = Sender; 94 | cmd.Parameters["@recipients"].Value = Recipient; 95 | cmd.Parameters["@subject"].Value = Subject; 96 | cmd.Parameters["@body"].Value = htmlDocument; 97 | cmd.Parameters["@body_format"].Value = "HTML"; 98 | 99 | cmd.ExecuteNonQuery(); 100 | } 101 | finally 102 | { 103 | conn.Close(); 104 | } 105 | 106 | } 107 | 108 | return; 109 | } 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/Common/Enum.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sqlconsulting.DataCollector.Utils 7 | { 8 | 9 | public enum ImportanceLevel 10 | { 11 | Low, 12 | Normal, 13 | High 14 | }; 15 | 16 | public enum AlertMode 17 | { 18 | Grouped, 19 | Atomic 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/Common/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Common")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Common")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("15fcb70e-9a51-4d36-a2bc-51541204eebe")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/Common/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18444 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Common.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | public class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | public static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Common.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | public static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?> 65 | ///<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 66 | /// xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"> 67 | /// <xsl:output method="html" omit-xml-declaration="yes" indent="yes"/> 68 | /// <xsl:template match="@* | node()"> 69 | /// <table cellspacing="0" cellpadding="0"> 70 | /// <tr> 71 | /// <xsl:for-each select="/*/node()"> 72 | /// <xsl:if test="position()=1"> 73 | /// <xsl:for-each select="*"> 74 | /// <th> 75 | /// [rest of string was truncated]";. 76 | /// 77 | public static string DataTableHtmlXslt { 78 | get { 79 | return ResourceManager.GetString("DataTableHtmlXslt", resourceCulture); 80 | } 81 | } 82 | 83 | /// 84 | /// Looks up a localized string similar to td { 85 | /// border: solid black 1px; 86 | /// padding-left:5px; 87 | /// padding-right:5px; 88 | /// padding-top:1px; 89 | /// padding-bottom:1px; 90 | /// font-size:11pt; 91 | /// font-family:calibri; 92 | ///} 93 | ///th { 94 | /// border: solid black 1px; 95 | /// padding-left:5px; 96 | /// padding-right:5px; 97 | /// padding-top:1px; 98 | /// padding-bottom:1px; 99 | /// font-size:11pt; 100 | /// font-family:calibri; 101 | /// font-weight:bold; 102 | /// color:white; 103 | /// background-color:#0080FF; 104 | ///} 105 | /// 106 | ///. 107 | /// 108 | public static string HtmlTableStyle { 109 | get { 110 | return ResourceManager.GetString("HtmlTableStyle", resourceCulture); 111 | } 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/Common/Resources/DataTableHtmlXslt.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 24 | 25 | 26 | 27 |
12 | 13 |
22 | 23 |
28 |
29 |
-------------------------------------------------------------------------------- /ExtendedTSQLCollector/Common/Resources/HtmlTableStyle.css: -------------------------------------------------------------------------------- 1 | td { 2 | border: solid black 1px; 3 | padding-left:5px; 4 | padding-right:5px; 5 | padding-top:1px; 6 | padding-bottom:1px; 7 | font-size:11pt; 8 | font-family:calibri; 9 | } 10 | th { 11 | border: solid black 1px; 12 | padding-left:5px; 13 | padding-right:5px; 14 | padding-top:1px; 15 | padding-bottom:1px; 16 | font-size:11pt; 17 | font-family:calibri; 18 | font-weight:bold; 19 | color:white; 20 | background-color:#0080FF; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/Common/TSQLCollectionItemConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Sqlconsulting.DataCollector.Utils 8 | { 9 | public class TSQLCollectionItemConfig : CollectionItemConfig 10 | { 11 | 12 | 13 | public new static readonly Guid CollectorTypeUid = new Guid("FD34D746-9A4D-4901-B872-3AF7CDBF7D37"); 14 | 15 | 16 | public String Query { get; set; } 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/Common/TSQLCollectorConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Sqlconsulting.DataCollector.Utils 8 | { 9 | public class TSQLCollectorConfig : CollectorConfig 10 | { 11 | 12 | public static readonly Guid CollectorPackageId = new Guid("77D28C8D-A529-445B-B5F6-31861D099594"); 13 | public static readonly Guid CollectorVersionId = new Guid("89C719FC-DDBD-45CA-BB27-5833E89962A9"); 14 | 15 | public static readonly Guid UploaderPackageId = new Guid("F0A974DF-4553-4ACF-AAC3-719246DBF5CF"); 16 | public static readonly Guid UploaderVersionId = new Guid("A7450869-7C6E-427E-8278-F00D79172E38"); 17 | 18 | 19 | public override void readFromDatabase( 20 | String ServerInstance, 21 | Guid CollectionSetUid, 22 | int ItemId 23 | ) 24 | { 25 | readFromDatabase(ServerInstance); 26 | 27 | String qry = @" 28 | DECLARE @x xml; 29 | DECLARE @fre int; 30 | 31 | SELECT @x = parameters, 32 | @fre = frequency 33 | FROM msdb.dbo.syscollector_collection_items 34 | WHERE collection_set_id = ( 35 | SELECT collection_set_id 36 | FROM msdb.dbo.syscollector_collection_sets 37 | WHERE collection_set_uid = '{0}' 38 | ) 39 | AND collection_item_id = {1} 40 | AND collector_type_uid = '{2}'; 41 | 42 | ;WITH XMLNAMESPACES('DataCollectorType' AS ns) 43 | SELECT x.value('Value[1]','varchar(max)') AS query, 44 | x.value('OutputTable[1]', 'varchar(max)') AS outputTable, 45 | @fre AS frequency 46 | FROM @x.nodes('/ns:TSQLQueryCollector/Query') Q(x) 47 | ORDER BY outputTable; 48 | "; 49 | 50 | qry = String.Format(qry, CollectionSetUid, ItemId, TSQLCollectionItemConfig.CollectorTypeUid); 51 | 52 | DataTable data = CollectorUtils.GetDataTable(ServerInstance, "msdb", qry); 53 | 54 | int i = 1; 55 | 56 | 57 | foreach (DataRow currentRow in data.Rows) 58 | { 59 | TSQLCollectionItemConfig cic = new TSQLCollectionItemConfig(); 60 | cic.Query = currentRow["query"].ToString(); 61 | cic.OutputTable = currentRow["outputTable"].ToString(); 62 | cic.Frequency = Int32.Parse(currentRow["frequency"].ToString()); 63 | cic.Index = i; 64 | i++; 65 | collectionItems.Add(cic); 66 | } 67 | 68 | 69 | 70 | qry = @" 71 | 72 | DECLARE @x xml; 73 | 74 | SELECT @x = parameters 75 | FROM msdb.dbo.syscollector_collection_items 76 | WHERE collection_set_id = ( 77 | SELECT collection_set_id 78 | FROM msdb.dbo.syscollector_collection_sets 79 | WHERE collection_set_uid = '{0}' 80 | ) 81 | AND collection_item_id = {1} 82 | 83 | DECLARE @selectedDatabases TABLE ( 84 | name sysname 85 | ) 86 | 87 | ;WITH XMLNAMESPACES('DataCollectorType' AS ns) 88 | INSERT INTO @selectedDatabases 89 | SELECT x.value('.','varchar(max)') AS database_name 90 | FROM @x.nodes('/ns:TSQLQueryCollector/Databases/Database') Q(x) 91 | 92 | DECLARE @useSystemDB bit 93 | DECLARE @UseUserDB bit 94 | 95 | ;WITH XMLNAMESPACES('DataCollectorType' AS ns) 96 | SELECT @useSystemDB = 97 | CASE LOWER(@x.value('(/ns:TSQLQueryCollector/Databases/@UseSystemDatabases)[1]','varchar(5)')) 98 | WHEN 'true' THEN 1 WHEN 'false' THEN 0 ELSE NULL 99 | END, 100 | @useUserDB = 101 | CASE LOWER(@x.value('(/ns:TSQLQueryCollector/Databases/@UseUserDatabases)[1]','varchar(5)')) 102 | WHEN 'true' THEN 1 WHEN 'false' THEN 0 ELSE NULL 103 | END 104 | 105 | -- delete non-existing databases 106 | DELETE t 107 | FROM @selectedDatabases AS t 108 | WHERE name NOT IN ( 109 | SELECT name 110 | FROM sys.databases 111 | ) 112 | 113 | INSERT INTO @selectedDatabases 114 | SELECT name 115 | FROM sys.databases 116 | WHERE 1 = 117 | CASE 118 | WHEN @useSystemDB = 1 AND name IN ('master','model','msdb','distribution') THEN 1 119 | WHEN @UseUserDB = 1 AND name NOT IN ('master','model','msdb','distribution') THEN 1 120 | END 121 | AND NOT EXISTS ( 122 | SELECT * 123 | FROM @selectedDatabases 124 | ) 125 | 126 | INSERT INTO @selectedDatabases 127 | SELECT 'master' 128 | WHERE NOT EXISTS ( 129 | SELECT * 130 | FROM @selectedDatabases 131 | ) 132 | 133 | SELECT * 134 | FROM @selectedDatabases 135 | "; 136 | 137 | qry = String.Format(qry, CollectionSetUid, ItemId); 138 | 139 | data = CollectorUtils.GetDataTable(ServerInstance, "msdb", qry); 140 | 141 | i = 1; 142 | 143 | foreach (DataRow currentRow in data.Rows) 144 | { 145 | Databases.Add(currentRow["name"].ToString()); 146 | } 147 | 148 | 149 | qry = @" 150 | SELECT days_until_expiration 151 | FROM msdb.dbo.syscollector_collection_sets 152 | WHERE collection_set_uid = '{0}' 153 | "; 154 | 155 | qry = String.Format(qry, CollectionSetUid); 156 | 157 | data = CollectorUtils.GetDataTable(ServerInstance, "msdb", qry); 158 | 159 | DaysUntilExpiration = Convert.ToInt32(data.Rows[0]["days_until_expiration"]); 160 | 161 | } 162 | 163 | } 164 | } 165 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/Common/XEReaderCollectionItemConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Sqlconsulting.DataCollector.Utils 7 | { 8 | public class XEReaderCollectionItemConfig : CollectionItemConfig 9 | { 10 | 11 | public new static readonly Guid CollectorTypeUid = new Guid("57AFAFB4-D4BE-4E62-9C6A-D2F2EA5FC5E9"); 12 | 13 | 14 | public String SessionName { get; set; } 15 | public String SessionDefinition { get; set; } 16 | public String Filter { get; set; } 17 | public List Columns = new List(); 18 | 19 | public List Alerts = new List(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedTSQLCollector.vssscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT" 10 | } 11 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedTSQLCollector/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedTSQLCollector/Collector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Linq; 5 | using System.Text; 6 | using Sqlconsulting.DataCollector.Utils; 7 | using System.IO; 8 | 9 | namespace Sqlconsulting.DataCollector.ExtendedTSQLCollector 10 | { 11 | public class Collector 12 | { 13 | public Boolean verbose { get; set; } 14 | 15 | 16 | public void CollectData( 17 | String SourceServerInstance, 18 | Guid CollectionSetUid, 19 | int ItemId 20 | ) 21 | { 22 | 23 | CollectorLogger logger = new CollectorLogger(SourceServerInstance, CollectionSetUid, ItemId); 24 | 25 | DataTable collectedData = null; 26 | 27 | if (verbose) logger.logMessage("--------------------------------"); 28 | if (verbose) logger.logMessage(" ExtendedTSQLCollector "); 29 | if (verbose) logger.logMessage("--------------------------------"); 30 | if (verbose) logger.logMessage("Copyright© sqlconsulting.it 2014"); 31 | if (verbose) logger.logMessage("-"); 32 | 33 | if (verbose) logger.logMessage("Loading configuration"); 34 | // 35 | // Load Configuration 36 | // 37 | TSQLCollectorConfig cfg = new TSQLCollectorConfig(); 38 | cfg.readFromDatabase(SourceServerInstance, CollectionSetUid, ItemId); 39 | 40 | 41 | if (verbose) logger.logMessage("Entering collection items loop"); 42 | foreach (CollectionItemConfig item in cfg.collectionItems) 43 | { 44 | TSQLCollectionItemConfig itm = (TSQLCollectionItemConfig)item; 45 | if (verbose) logger.logMessage("Processing item n. " + itm.Index); 46 | if (verbose) logger.logMessage("Processing query " + itm.Query); 47 | 48 | collectedData = null; 49 | 50 | String ts = DateTime.Now.ToString("yyyyMMddHHmmss"); 51 | String collectorId = CollectorUtils.getCacheFilePrefix(SourceServerInstance, CollectionSetUid, ItemId) + "_" + itm.Index; 52 | 53 | String destFile = Path.Combine(cfg.CacheDirectory, collectorId + "_" + ts + ".cache"); 54 | 55 | // 56 | // Iterate through the enabled databases 57 | // 58 | if (verbose) logger.logMessage("Entering databases loop"); 59 | foreach (String currentDatabase in cfg.Databases) 60 | { 61 | 62 | if (verbose) logger.logMessage("Processing database " + currentDatabase); 63 | // 64 | // Execute the query in the collection item 65 | // 66 | 67 | DataTable dt = CollectorUtils.GetDataTable(SourceServerInstance, currentDatabase, itm.Query); 68 | 69 | // 70 | // Add computed columns 71 | // 72 | if (dt.Columns.Contains("database_name")) 73 | { 74 | dt.Columns["database_name"].ColumnName = "__database_name"; 75 | } 76 | DataColumn cl_db = new DataColumn("database_name", typeof(String)); 77 | cl_db.DefaultValue = currentDatabase; 78 | dt.Columns.Add(cl_db); 79 | 80 | 81 | if (dt.Columns.Contains("collection_time")) 82 | { 83 | dt.Columns["collection_time"].ColumnName = "__collection_time"; 84 | } 85 | DataColumn cl_dt = new DataColumn("collection_time", typeof(DateTime)); 86 | cl_dt.DefaultValue = DateTime.Now; 87 | dt.Columns.Add(cl_dt); 88 | 89 | 90 | // 91 | // Merge collected data in a single DataTable 92 | // 93 | if (collectedData != null) 94 | { 95 | collectedData.Merge(dt); 96 | } 97 | else 98 | { 99 | collectedData = dt; 100 | collectedData.DataSet.RemotingFormat = System.Data.SerializationFormat.Binary; 101 | collectedData.RemotingFormat = System.Data.SerializationFormat.Binary; 102 | } 103 | 104 | } 105 | 106 | if (verbose) logger.logMessage("Saving to cache file " + destFile); 107 | // 108 | // Save data to a binary cache file 109 | // 110 | if (File.Exists(destFile)) 111 | { 112 | File.Delete(destFile); 113 | } 114 | 115 | 116 | 117 | System.Runtime.Serialization.Formatters.Binary.BinaryFormatter fm = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); 118 | 119 | using (FileStream fs = new FileStream(destFile, FileMode.CreateNew)) 120 | { 121 | fm.Serialize(fs, collectedData); 122 | fs.Close(); 123 | } 124 | if (verbose) logger.logMessage("File saved successfully"); 125 | 126 | } 127 | 128 | 129 | logger.cleanupLogFiles(cfg.DaysUntilExpiration); 130 | 131 | } 132 | 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedTSQLCollector/ExtendedTSQLCollector.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {3E45DCA1-18E6-4C73-83B2-C5729BAA8719} 8 | Exe 9 | Properties 10 | ExtendedTSQLCollector 11 | ExtendedTSQLCollector 12 | v3.5 13 | 512 14 | SAK 15 | SAK 16 | SAK 17 | SAK 18 | 19 | 20 | AnyCPU 21 | true 22 | full 23 | false 24 | bin\Debug\ 25 | DEBUG;TRACE 26 | prompt 27 | 4 28 | 29 | 30 | AnyCPU 31 | pdbonly 32 | true 33 | bin\Release\ 34 | TRACE 35 | prompt 36 | 4 37 | 38 | 39 | bin\Release x64\ 40 | TRACE 41 | true 42 | pdbonly 43 | AnyCPU 44 | prompt 45 | MinimumRecommendedRules.ruleset 46 | 47 | 48 | 49 | ..\packages\CommandLineParser.1.9.71\lib\net35\CommandLine.dll 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | {b9f55a86-b918-416d-8020-181a5728aaa6} 70 | Common 71 | 72 | 73 | 74 | 81 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedTSQLCollector/ExtendedTSQLCollector.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedTSQLCollector/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | 7 | using System.Data; 8 | using System.Data.SqlClient; 9 | using System.Collections.Specialized; 10 | using System.IO; 11 | using Sqlconsulting.DataCollector.Utils; 12 | using Sqlconsulting.DataCollector.ExtendedTSQLCollector; 13 | using CommandLine.Text; 14 | using CommandLine; 15 | 16 | 17 | 18 | 19 | namespace Sqlconsulting.DataCollector.ExtendedTSQLCollector 20 | { 21 | class Program 22 | { 23 | 24 | static void Main(string[] args) 25 | { 26 | var options = new Options(); 27 | if (!CommandLine.Parser.Default.ParseArguments(args, options)) 28 | { 29 | return; 30 | } 31 | 32 | bool verbose = options.Verbose; 33 | CollectorLogger logger = null; 34 | 35 | try 36 | { 37 | String SourceServerInstance = options.ServerInstance; 38 | Guid CollectionSetUid = new Guid(options.CollectionSetUID); 39 | int ItemId = options.CollectionItemID; 40 | int LogId = options.LogId; 41 | 42 | logger = new CollectorLogger(SourceServerInstance, CollectionSetUid, ItemId); 43 | 44 | if (verbose) logger.logMessage("Starting"); 45 | 46 | Collector collector = new Collector(); 47 | collector.verbose = verbose; 48 | collector.CollectData(SourceServerInstance, CollectionSetUid, ItemId); 49 | 50 | 51 | if (verbose) logger.logMessage("Ending with success"); 52 | } 53 | catch (Exception e) 54 | { 55 | Console.WriteLine(e); 56 | if (verbose) logger.logMessage("Ending with failure"); 57 | if (verbose) logger.logMessage(e.Message); 58 | if (verbose) logger.logMessage(e.StackTrace.ToString()); 59 | } 60 | } 61 | 62 | 63 | 64 | 65 | } 66 | 67 | 68 | // Define a class to receive parsed values 69 | class Options 70 | { 71 | [Option('S', "ServerInstance", DefaultValue = "(local)", HelpText = "SQL Server Instance.")] 72 | public string ServerInstance { get; set; } 73 | 74 | [Option('c', "CollectionSetUID", Required = true , HelpText = "Collection set UID.")] 75 | public String CollectionSetUID { get; set; } 76 | 77 | [Option('i', "ItemID", Required = true, HelpText = "Collection item UID.")] 78 | public Int32 CollectionItemID { get; set; } 79 | 80 | [Option('l', "LogId", Required = true, HelpText = "Log Id in the DCEXEC logging tables.")] 81 | public Int32 LogId { get; set; } 82 | 83 | [Option('v', "Verbose", DefaultValue = false, HelpText = "Enable logging to an output file.")] 84 | public bool Verbose { get; set; } 85 | 86 | [ParserState] 87 | public IParserState LastParserState { get; set; } 88 | 89 | [HelpOption] 90 | public string GetUsage() 91 | { 92 | return HelpText.AutoBuild(this, 93 | (HelpText current) => HelpText.DefaultParsingErrorsHandler(this, current)); 94 | } 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedTSQLCollector/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ExtendedTSQLCollector")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ExtendedTSQLCollector")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("09e354ec-63c2-47d1-bb49-84c8908fbe94")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedTSQLCollector/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedTSQLUploader/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedTSQLUploader/ExtendedTSQLUploader.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {C37400D5-C60B-4BE1-B748-D220CC2361A7} 8 | Exe 9 | Properties 10 | ExtendedTSQLUploader 11 | ExtendedTSQLUploader 12 | v3.5 13 | 512 14 | SAK 15 | SAK 16 | SAK 17 | SAK 18 | 19 | 20 | AnyCPU 21 | true 22 | full 23 | false 24 | bin\Debug\ 25 | DEBUG;TRACE 26 | prompt 27 | 4 28 | 29 | 30 | AnyCPU 31 | pdbonly 32 | true 33 | bin\Release\ 34 | TRACE 35 | prompt 36 | 4 37 | 38 | 39 | bin\Release x64\ 40 | TRACE 41 | true 42 | pdbonly 43 | AnyCPU 44 | prompt 45 | MinimumRecommendedRules.ruleset 46 | 47 | 48 | 49 | ..\packages\CommandLineParser.1.9.71\lib\net35\CommandLine.dll 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | {b9f55a86-b918-416d-8020-181a5728aaa6} 70 | Common 71 | 72 | 73 | 74 | 81 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedTSQLUploader/ExtendedTSQLUploader.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedTSQLUploader/Program.cs: -------------------------------------------------------------------------------- 1 | using CommandLine; 2 | using CommandLine.Text; 3 | using Sqlconsulting.DataCollector.Utils; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | 9 | 10 | namespace Sqlconsulting.DataCollector.ExtendedTSQLUploader 11 | { 12 | class Program 13 | { 14 | static void Main(string[] args) 15 | { 16 | 17 | 18 | var options = new Options(); 19 | if (!CommandLine.Parser.Default.ParseArguments(args, options)) 20 | { 21 | return; 22 | } 23 | 24 | bool verbose = options.Verbose; 25 | CollectorLogger logger = null; 26 | 27 | 28 | try 29 | { 30 | String SourceServerInstance = options.ServerInstance; 31 | Guid CollectionSetUid = new Guid(options.CollectionSetUID); 32 | int ItemId = options.CollectionItemID; 33 | int LogId = options.LogId; 34 | 35 | logger = new CollectorLogger(SourceServerInstance, CollectionSetUid, ItemId); 36 | 37 | if (verbose) logger.logMessage("Starting"); 38 | 39 | Uploader uploader = new Uploader(SourceServerInstance, CollectionSetUid, ItemId, LogId); 40 | uploader.verbose = verbose; 41 | uploader.UploadData(); 42 | 43 | if (verbose) logger.logMessage("Ending with success"); 44 | } 45 | catch (Exception e) 46 | { 47 | Console.WriteLine(e.ToString()); 48 | if (verbose) logger.logMessage("Ending with failure"); 49 | if (verbose) logger.logMessage(e.Message); 50 | if (verbose) logger.logMessage(e.StackTrace.ToString()); 51 | } 52 | 53 | 54 | } 55 | } 56 | 57 | // Define a class to receive parsed values 58 | class Options 59 | { 60 | [Option('S', "ServerInstance", DefaultValue = "(local)", HelpText = "SQL Server Instance.")] 61 | public string ServerInstance { get; set; } 62 | 63 | [Option('c', "CollectionSetUID", Required = true, HelpText = "Collection set UID.")] 64 | public String CollectionSetUID { get; set; } 65 | 66 | [Option('i', "ItemID", Required = true, HelpText = "Collection item UID.")] 67 | public Int32 CollectionItemID { get; set; } 68 | 69 | [Option('l', "LogId", Required = true, HelpText = "Log Id in the DCEXEC logging tables.")] 70 | public Int32 LogId { get; set; } 71 | 72 | [Option('v', "Verbose", DefaultValue = false, HelpText = "Enable logging to an output file.")] 73 | public bool Verbose { get; set; } 74 | 75 | [ParserState] 76 | public IParserState LastParserState { get; set; } 77 | 78 | [HelpOption] 79 | public string GetUsage() 80 | { 81 | return HelpText.AutoBuild(this, 82 | (HelpText current) => HelpText.DefaultParsingErrorsHandler(this, current)); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedTSQLUploader/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ExtendedTSQLUploader")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ExtendedTSQLUploader")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("b9572e03-1330-4467-a39c-a18cba234773")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedTSQLUploader/Uploader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Linq; 5 | using System.Text; 6 | using Sqlconsulting.DataCollector.Utils; 7 | 8 | namespace Sqlconsulting.DataCollector.ExtendedTSQLUploader 9 | { 10 | class Uploader : Sqlconsulting.DataCollector.Utils.Uploader 11 | { 12 | 13 | 14 | public Uploader( 15 | String SourceServerInstance, 16 | Guid CollectionSetUid, 17 | int ItemId, 18 | int LogId 19 | ) : base(SourceServerInstance, CollectionSetUid, ItemId, LogId) 20 | { 21 | 22 | } 23 | 24 | 25 | /* 26 | * Creates the target table from the 27 | * output definition of the query 28 | */ 29 | protected override String createTargetTable( 30 | CollectorConfig cfg, 31 | CollectionItemConfig itm 32 | ) 33 | { 34 | String TableName = itm.OutputTable; 35 | TSQLCollectionItemConfig itemCfg = (TSQLCollectionItemConfig)itm; 36 | 37 | String CollectorId = CollectorUtils.getCacheFilePrefix(SourceServerInstance, CollectionSetUid, ItemId) + "_" + itm.Index; 38 | 39 | // 40 | // checks if the table exists and which schema it belongs 41 | // 42 | String checkedTableName = checkTable(cfg, itm); 43 | if (checkedTableName != null) 44 | { 45 | return checkedTableName; 46 | } 47 | 48 | String statement = @" 49 | 50 | IF NOT EXISTS ( 51 | SELECT * 52 | FROM sys.servers 53 | WHERE NAME = 'LOOPBACK' 54 | ) 55 | BEGIN 56 | 57 | DECLARE @srv nvarchar(4000); 58 | SET @srv = @@SERVERNAME; -- gather this server name 59 | 60 | -- Create the linked server 61 | EXEC master.dbo.sp_addlinkedserver 62 | @server = N'LOOPBACK', 63 | @srvproduct = N'SQLServ', -- it's not a typo: it can't be 'SQLServer' 64 | @provider = N'SQLNCLI', -- change to SQLOLEDB for SQLServer 2000 65 | @datasrc = @srv; 66 | 67 | -- Set the authentication to 'current security context' 68 | EXEC master.dbo.sp_addlinkedsrvlogin 69 | @rmtsrvname = N'LOOPBACK', 70 | @useself = N'True', 71 | @locallogin = NULL, 72 | @rmtuser = NULL, 73 | @rmtpassword = NULL; 74 | 75 | END 76 | 77 | USE tempdb; 78 | GO 79 | 80 | IF OBJECT_ID('{0}') IS NOT NULL 81 | DROP PROCEDURE [{0}] 82 | GO 83 | 84 | CREATE PROCEDURE [{0}] 85 | AS 86 | BEGIN 87 | SET NOCOUNT ON; 88 | 89 | {1} 90 | END 91 | GO 92 | 93 | IF SCHEMA_ID('custom_snapshots') IS NULL 94 | EXEC('CREATE SCHEMA [custom_snapshots]') 95 | 96 | IF OBJECT_ID('custom_snapshots.{2}') IS NOT NULL 97 | DROP TABLE [custom_snapshots].[{2}] 98 | GO 99 | 100 | SELECT TOP 0 *, 101 | CAST(NULL AS sysname) AS _database_name, 102 | CAST(NULL AS datetimeoffset(7)) AS _collection_time, 103 | CAST(NULL AS int) AS _snapshot_id 104 | INTO tempdb.[custom_snapshots].[{2}] 105 | FROM OPENQUERY(LOOPBACK, 'SET FMTONLY OFF; EXEC tempdb.dbo.[{0}]'); 106 | 107 | DROP PROCEDURE [{0}]; 108 | GO 109 | 110 | IF EXISTS( 111 | SELECT 1 112 | FROM sys.columns 113 | WHERE name = 'database_name' 114 | AND object_id = OBJECT_ID('[custom_snapshots].[{2}]') 115 | ) 116 | BEGIN 117 | EXEC sp_rename '[custom_snapshots].[{2}].[database_name]', '__database_name', 'COLUMN'; 118 | END 119 | EXEC sp_rename '[custom_snapshots].[{2}].[_database_name]', 'database_name', 'COLUMN'; 120 | 121 | 122 | IF EXISTS( 123 | SELECT 1 124 | FROM sys.columns 125 | WHERE name = 'collection_time' 126 | AND object_id = OBJECT_ID('[custom_snapshots].[{2}]') 127 | ) 128 | BEGIN 129 | EXEC sp_rename '[custom_snapshots].[{2}].[collection_time]', '__collection_time', 'COLUMN'; 130 | END 131 | EXEC sp_rename '[custom_snapshots].[{2}].[_collection_time]', 'collection_time', 'COLUMN'; 132 | 133 | 134 | IF EXISTS( 135 | SELECT 1 136 | FROM sys.columns 137 | WHERE name = 'snapshot_id' 138 | AND object_id = OBJECT_ID('[custom_snapshots].[{2}]') 139 | ) 140 | BEGIN 141 | EXEC sp_rename '[custom_snapshots].[{2}].[snapshot_id]', '__snapshot_id', 'COLUMN'; 142 | END 143 | EXEC sp_rename '[custom_snapshots].[{2}].[_snapshot_id]', 'snapshot_id', 'COLUMN'; 144 | 145 | "; 146 | 147 | statement = String.Format(statement, CollectorId, itemCfg.Query, itm.OutputTable); 148 | 149 | CollectorUtils.InvokeSqlBatch(SourceServerInstance, "tempdb", statement); 150 | 151 | String scriptText = CollectorUtils.ScriptTable(SourceServerInstance, "tempdb", TableName); 152 | 153 | CollectorUtils.InvokeSqlCmd(cfg.MDWInstance, cfg.MDWDatabase, scriptText); 154 | 155 | return "[custom_snapshots].[" + TableName + "]"; 156 | } 157 | 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedTSQLUploader/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedXEReaderCollector/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ExtendedXEReaderCollector")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ExtendedXEReaderCollector")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("e3a330cb-df86-4f83-aa83-70c8da9f4d2b")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedXEReaderCollector/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedXEReaderCollector/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedXEReaderCollectorTrigger/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedXEReaderCollectorTrigger/ExtendedXEReaderCollectorTrigger.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {824E8B20-4375-457F-84FC-24AB884D8D18} 8 | Exe 9 | Properties 10 | ExtendedXEReaderCollectorTrigger 11 | ExtendedXEReaderCollectorTrigger 12 | v3.5 13 | 512 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | bin\Release x64\ 36 | TRACE 37 | true 38 | pdbonly 39 | AnyCPU 40 | prompt 41 | MinimumRecommendedRules.ruleset 42 | 43 | 44 | 45 | ..\packages\CommandLineParser.1.9.71\lib\net35\CommandLine.dll 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | {b9f55a86-b918-416d-8020-181a5728aaa6} 65 | Common 66 | 67 | 68 | 69 | 76 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedXEReaderCollectorTrigger/Program.cs: -------------------------------------------------------------------------------- 1 | using CommandLine; 2 | using CommandLine.Text; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.IO; 7 | using System.Linq; 8 | using System.Reflection; 9 | using System.Text; 10 | using Sqlconsulting.DataCollector.Utils; 11 | 12 | namespace Sqlconsulting.DataCollector.ExtendedXEReaderCollectorTrigger 13 | { 14 | class Program 15 | { 16 | static void Main(string[] args) 17 | { 18 | var options = new Options(); 19 | if (!CommandLine.Parser.Default.ParseArguments(args, options)) 20 | { 21 | return; 22 | } 23 | 24 | CollectorLogger logger = new CollectorLogger(options.ServerInstance); 25 | 26 | try 27 | { 28 | 29 | string codeBase = Assembly.GetExecutingAssembly().CodeBase; 30 | UriBuilder uri = new UriBuilder(codeBase); 31 | string path = Uri.UnescapeDataString(uri.Path); 32 | 33 | String targetProcess = Path.Combine(Path.GetDirectoryName(path), "ExtendedXEReaderCollector.exe"); 34 | String arguments = "-S " + options.ServerInstance + " -v " + options.Verbose; 35 | 36 | Process.Start(targetProcess, arguments); 37 | } 38 | catch(Exception e) 39 | { 40 | logger.logMessage(e.StackTrace); 41 | } 42 | } 43 | } 44 | 45 | 46 | // Define a class to receive parsed values 47 | class Options 48 | { 49 | [Option('S', "ServerInstance", DefaultValue = "(local)", HelpText = "SQL Server Instance.")] 50 | public string ServerInstance { get; set; } 51 | 52 | [Option('v', "Verbose", DefaultValue = false, HelpText = "Enable logging to an output file.")] 53 | public bool Verbose { get; set; } 54 | 55 | [ParserState] 56 | public IParserState LastParserState { get; set; } 57 | 58 | [HelpOption] 59 | public string GetUsage() 60 | { 61 | return HelpText.AutoBuild(this, 62 | (HelpText current) => HelpText.DefaultParsingErrorsHandler(this, current)); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedXEReaderCollectorTrigger/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ExtendedXEReaderCollectorTrigger")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ExtendedXEReaderCollectorTrigger")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("713cd765-c7c7-4f7a-895e-52c771899055")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedXEReaderCollectorTrigger/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedXEReaderUploader/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedXEReaderUploader/ExtendedXEReaderUploader.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {D2829F3D-562C-4C0F-916F-80A98D4872A7} 8 | Exe 9 | Properties 10 | ExtendedXEReaderUploader 11 | ExtendedXEReaderUploader 12 | v3.5 13 | 512 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | bin\Release x64\ 36 | TRACE 37 | true 38 | pdbonly 39 | AnyCPU 40 | prompt 41 | MinimumRecommendedRules.ruleset 42 | 43 | 44 | 45 | ..\packages\CommandLineParser.1.9.71\lib\net35\CommandLine.dll 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | Designer 62 | 63 | 64 | 65 | 66 | 67 | {b9f55a86-b918-416d-8020-181a5728aaa6} 68 | Common 69 | 70 | 71 | 72 | 79 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedXEReaderUploader/Program.cs: -------------------------------------------------------------------------------- 1 | using CommandLine; 2 | using CommandLine.Text; 3 | using Sqlconsulting.DataCollector.Utils; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | 9 | 10 | namespace Sqlconsulting.DataCollector.ExtendedXEReaderUploader 11 | { 12 | class Program 13 | { 14 | static void Main(string[] args) 15 | { 16 | 17 | 18 | var options = new Options(); 19 | if (!CommandLine.Parser.Default.ParseArguments(args, options)) 20 | { 21 | return; 22 | } 23 | 24 | bool verbose = options.Verbose; 25 | CollectorLogger logger = null; 26 | 27 | 28 | try 29 | { 30 | String SourceServerInstance = options.ServerInstance; 31 | Guid CollectionSetUid = new Guid(options.CollectionSetUID); 32 | int ItemId = options.CollectionItemID; 33 | int LogId = options.LogId; 34 | 35 | logger = new CollectorLogger(SourceServerInstance, CollectionSetUid, ItemId); 36 | 37 | if (verbose) logger.logMessage("Starting"); 38 | 39 | Uploader uploader = new Uploader(SourceServerInstance, CollectionSetUid, ItemId, LogId); 40 | uploader.verbose = verbose; 41 | uploader.UploadData(); 42 | 43 | if (verbose) logger.logMessage("Ending with success"); 44 | } 45 | catch (Exception e) 46 | { 47 | Console.WriteLine(e.ToString()); 48 | if (verbose) logger.logMessage("Ending with failure"); 49 | if (verbose) logger.logMessage(e.Message); 50 | if (verbose) logger.logMessage(e.StackTrace.ToString()); 51 | } 52 | 53 | 54 | } 55 | } 56 | 57 | // Define a class to receive parsed values 58 | class Options 59 | { 60 | [Option('S', "ServerInstance", DefaultValue = "(local)", HelpText = "SQL Server Instance.")] 61 | public string ServerInstance { get; set; } 62 | 63 | [Option('c', "CollectionSetUID", Required = true, HelpText = "Collection set UID.")] 64 | public String CollectionSetUID { get; set; } 65 | 66 | [Option('i', "ItemID", Required = true, HelpText = "Collection item UID.")] 67 | public Int32 CollectionItemID { get; set; } 68 | 69 | [Option('l', "LogId", Required = true, HelpText = "Log Id in the DCEXEC logging tables.")] 70 | public Int32 LogId { get; set; } 71 | 72 | [Option('v', "Verbose", DefaultValue = false, HelpText = "Enable logging to an output file.")] 73 | public bool Verbose { get; set; } 74 | 75 | [ParserState] 76 | public IParserState LastParserState { get; set; } 77 | 78 | [HelpOption] 79 | public string GetUsage() 80 | { 81 | return HelpText.AutoBuild(this, 82 | (HelpText current) => HelpText.DefaultParsingErrorsHandler(this, current)); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedXEReaderUploader/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ExtendedXEReaderUploader")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("ExtendedXEReaderUploader")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("b68cf0cc-e5d4-4e83-a9f9-2ef31b50116e")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedXEReaderUploader/Uploader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Linq; 5 | using System.Text; 6 | using Sqlconsulting.DataCollector.Utils; 7 | 8 | namespace Sqlconsulting.DataCollector.ExtendedXEReaderUploader 9 | { 10 | public class Uploader : Sqlconsulting.DataCollector.Utils.Uploader 11 | { 12 | 13 | 14 | public Uploader( 15 | String SourceServerInstance, 16 | Guid CollectionSetUid, 17 | int ItemId, 18 | int LogId 19 | ): base(SourceServerInstance, CollectionSetUid, ItemId, LogId) 20 | { 21 | 22 | } 23 | 24 | 25 | 26 | /* 27 | * Creates the target table from the 28 | * output definition of the query 29 | */ 30 | protected override String createTargetTable( 31 | CollectorConfig cfg, 32 | CollectionItemConfig itm 33 | ) 34 | { 35 | return checkTable(cfg,itm); 36 | } 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/ExtendedXEReaderUploader/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/InstallCollectorType/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/InstallCollectorType/InstallCollectorType.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {E56AF20F-59B8-46CB-A108-84F2781D834E} 8 | Exe 9 | Properties 10 | Sqlconsulting.DataCollector.InstallCollectorType 11 | InstallCollectorType 12 | v3.5 13 | 512 14 | 15 | SAK 16 | SAK 17 | SAK 18 | SAK 19 | 20 | 21 | AnyCPU 22 | true 23 | full 24 | false 25 | bin\Debug\ 26 | DEBUG;TRACE 27 | prompt 28 | 4 29 | 30 | 31 | AnyCPU 32 | pdbonly 33 | true 34 | bin\Release\ 35 | TRACE 36 | prompt 37 | 4 38 | 39 | 40 | bin\Release x64\ 41 | TRACE 42 | true 43 | pdbonly 44 | AnyCPU 45 | prompt 46 | MinimumRecommendedRules.ruleset 47 | 48 | 49 | 50 | False 51 | ..\packages\CommandLineParser.1.9.71\lib\net35\CommandLine.dll 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | True 66 | True 67 | Resources.resx 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | {b9f55a86-b918-416d-8020-181a5728aaa6} 77 | Common 78 | 79 | 80 | 81 | 82 | PublicResXFileCodeGenerator 83 | Resources.Designer.cs 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 100 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/InstallCollectorType/InstallCollectorType.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/InstallCollectorType/Program.cs: -------------------------------------------------------------------------------- 1 | using CommandLine; 2 | using CommandLine.Text; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | //using System.Threading.Tasks; 8 | 9 | namespace Sqlconsulting.DataCollector.InstallCollectorType 10 | { 11 | class Program 12 | { 13 | static void Main(string[] args) 14 | { 15 | 16 | var options = new Options(); 17 | if (!CommandLine.Parser.Default.ParseArguments(args, options)) 18 | { 19 | return; 20 | } 21 | 22 | try 23 | { 24 | String SourceServerInstance = options.ServerInstance; 25 | CollectorTypeInstaller inst = new CollectorTypeInstaller(SourceServerInstance); 26 | inst.install(); 27 | } 28 | finally 29 | { 30 | //print something to std err 31 | } 32 | } 33 | } 34 | 35 | 36 | // Define a class to receive parsed values 37 | class Options 38 | { 39 | [Option('S', "ServerInstance", DefaultValue = "(local)", HelpText = "SQL Server Instance.")] 40 | public string ServerInstance { get; set; } 41 | 42 | [ParserState] 43 | public IParserState LastParserState { get; set; } 44 | 45 | [HelpOption] 46 | public string GetUsage() 47 | { 48 | return HelpText.AutoBuild(this, 49 | (HelpText current) => HelpText.DefaultParsingErrorsHandler(this, current)); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/InstallCollectorType/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("InstallCollectorType")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("InstallCollectorType")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("3815034f-c8da-4f41-9a14-9d92b15df63d")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/InstallCollectorType/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18444 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Sqlconsulting.DataCollector.InstallCollectorType.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | public class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | public static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Sqlconsulting.DataCollector.InstallCollectorType.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | public static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized string similar to <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:z="#RowsetSchema" version="1.0"> 65 | /// <xsl:template match="/ExtendedXEReaderCollector"> 66 | /// <HTML> 67 | /// <HEAD> 68 | /// <TITLE /> 69 | /// </HEAD> 70 | /// <BODY> 71 | /// <xsl:apply-templates select="Session" /> 72 | /// <HR /> 73 | /// <xsl:apply-templates select="Alert" /> 74 | /// </BODY> 75 | /// </HTML> 76 | /// </xsl:template> 77 | /// <xsl:template match="Session"> 78 | /// <H2>Session</H2> 79 | /// <BR /> 80 | /// <B>Output Table:</B> 81 | /// <BR /> 82 | /// <I> 83 | /// <xsl [rest of string was truncated]";. 84 | /// 85 | public static string XEReaderParamFormatter { 86 | get { 87 | return ResourceManager.GetString("XEReaderParamFormatter", resourceCulture); 88 | } 89 | } 90 | 91 | /// 92 | /// Looks up a localized string similar to <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="DataCollectorType"> 93 | /// <xs:element name="ExtendedXEReaderCollector"> 94 | /// <xs:complexType> 95 | /// <xs:sequence> 96 | /// <xs:element name="Session" minOccurs="1" maxOccurs="1"> 97 | /// <xs:complexType> 98 | /// <xs:sequence> 99 | /// <xs:element name="Name" type="xs:string" /> 100 | /// <xs:element name="OutputTable" type="xs:string" /> 101 | /// <xs:element name="Definition" type="xs:string" /> 102 | /// <xs [rest of string was truncated]";. 103 | /// 104 | public static string XEReaderParamSchema { 105 | get { 106 | return ResourceManager.GetString("XEReaderParamSchema", resourceCulture); 107 | } 108 | } 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/InstallCollectorType/Resources/XEReaderParamFormatter.xslt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | </HEAD> 7 | <BODY> 8 | <xsl:apply-templates select="Session" /> 9 | <HR /> 10 | <xsl:apply-templates select="Alert" /> 11 | </BODY> 12 | </HTML> 13 | </xsl:template> 14 | <xsl:template match="Session"> 15 | <H2>Session</H2> 16 | <BR /> 17 | <B>Output Table:</B> 18 | <BR /> 19 | <I> 20 | <xsl:value-of select="OutputTable" /> 21 | </I> 22 | <BR /> 23 | <B>Definition:</B> 24 | <BR /> 25 | <PRE> 26 | <xsl:value-of select="Definition" /> 27 | </PRE> 28 | <BR /> 29 | <B>Filter:</B> 30 | <BR /> 31 | <CODE> 32 | <xsl:value-of select="Filter" /> 33 | </CODE> 34 | <BR /> 35 | <B>Columns:</B> 36 | <BR /> 37 | <CODE> 38 | <xsl:value-of select="ColumnsList" /> 39 | </CODE> 40 | </xsl:template> 41 | <xsl:template match="Alert"> 42 | <H2>Alert</H2> 43 | <BR /> 44 | <B>Enabled:</B> 45 | <BR /> 46 | <I> 47 | <xsl:value-of select="@Enabled" /> 48 | </I> 49 | <BR /> 50 | <B>Recipient:</B> 51 | <BR /> 52 | <CODE> 53 | <xsl:value-of select="Recipient" /> 54 | </CODE> 55 | <BR /> 56 | <B>Subject:</B> 57 | <BR /> 58 | <CODE> 59 | <xsl:value-of select="Subject" /> 60 | </CODE> 61 | <BR /> 62 | <B>Importance:</B> 63 | <BR /> 64 | <CODE> 65 | <xsl:value-of select="Importance" /> 66 | </CODE> 67 | <BR /> 68 | <B>Filter:</B> 69 | <BR /> 70 | <CODE> 71 | <xsl:value-of select="Filter" /> 72 | </CODE> 73 | <BR /> 74 | <B>Delay:</B> 75 | <BR /> 76 | <CODE> 77 | <xsl:value-of select="Delay" /> 78 | </CODE> 79 | <BR /> 80 | <B>Write to ERRORLOG:</B> 81 | <BR /> 82 | <CODE> 83 | <xsl:value-of select="@WriteToERRORLOG" /> 84 | </CODE> 85 | <BR /> 86 | <B>Write to Windows Log:</B> 87 | <BR /> 88 | <CODE> 89 | <xsl:value-of select="@WriteToWindowsLog" /> 90 | </CODE> 91 | <BR /> 92 | <B>Columns:</B> 93 | <BR /> 94 | <CODE> 95 | <xsl:value-of select="ColumnsList" /> 96 | </CODE> 97 | <BR /> 98 | <B>Mode:</B> 99 | <BR /> 100 | <CODE> 101 | <xsl:value-of select="Mode" /> 102 | </CODE> 103 | </xsl:template> 104 | </xsl:stylesheet> -------------------------------------------------------------------------------- /ExtendedTSQLCollector/InstallCollectorType/Resources/XEReaderParamSchema.xml: -------------------------------------------------------------------------------- 1 | <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="DataCollectorType"> 2 | <xs:element name="ExtendedXEReaderCollector"> 3 | <xs:complexType> 4 | <xs:sequence> 5 | <xs:element name="Session" minOccurs="1" maxOccurs="1"> 6 | <xs:complexType> 7 | <xs:sequence> 8 | <xs:element name="Name" type="xs:string" /> 9 | <xs:element name="OutputTable" type="xs:string" /> 10 | <xs:element name="Definition" type="xs:string" /> 11 | <xs:element name="Filter" minOccurs="0" maxOccurs="1" type="xs:string" /> 12 | <xs:element name="ColumnsList" type="xs:string"/> 13 | </xs:sequence> 14 | </xs:complexType> 15 | </xs:element> 16 | <xs:element name="Alert" minOccurs="0" maxOccurs="unbounded"> 17 | <xs:complexType> 18 | <xs:sequence> 19 | <xs:element name="Sender" minOccurs="0" maxOccurs="1" type="xs:string" /> 20 | <xs:element name="Recipient" minOccurs="1" maxOccurs="unbounded" type="xs:string" /> 21 | <xs:element name="Subject" minOccurs="1" maxOccurs="1" type="xs:string" /> 22 | <xs:element name="Importance" minOccurs="0" maxOccurs="1" type="xs:string" /> 23 | <xs:element name="ColumnsList" minOccurs="0" maxOccurs="1" type="xs:string" /> 24 | <xs:element name="Filter" minOccurs="0" maxOccurs="1" type="xs:string" /> 25 | <xs:element name="Mode" minOccurs="0" maxOccurs="1" type="xs:string" /><!-- GROUPED|ATOMIC --> 26 | <xs:element name="Delay" minOccurs="0" maxOccurs="1" type="xs:int"/> 27 | </xs:sequence> 28 | <xs:attribute name="Enabled" type="xs:boolean" use="required" /> 29 | <xs:attribute name="WriteToWindowsLog" type="xs:boolean" use="optional" /> 30 | <xs:attribute name="WriteToERRORLOG" type="xs:boolean" use="optional" /> 31 | </xs:complexType> 32 | </xs:element> 33 | </xs:sequence> 34 | </xs:complexType> 35 | </xs:element> 36 | </xs:schema> -------------------------------------------------------------------------------- /ExtendedTSQLCollector/InstallCollectorType/packages.config: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <packages> 3 | <package id="CommandLineParser" version="1.9.71" targetFramework="net35" /> 4 | </packages> -------------------------------------------------------------------------------- /ExtendedTSQLCollector/Packages.dgml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <DirectedGraph GraphDirection="LeftToRight" xmlns="http://schemas.microsoft.com/vs/2009/dgml"> 3 | <Nodes> 4 | <Node Id="ExtendedTSQLUploader" Label="ExtendedTSQLUploader" Category="Project" /> 5 | <Node Id="CommandLineParser 1.9.71" Label="CommandLineParser 1.9.71" Category="Package" /> 6 | <Node Id="ExtendedTSQLCollector" Label="ExtendedTSQLCollector" Category="Project" /> 7 | <Node Id="CommandLineParser 1.9.71" Label="CommandLineParser 1.9.71" Category="Package" /> 8 | </Nodes> 9 | <Links> 10 | <Link Source="ExtendedTSQLUploader" Target="CommandLineParser 1.9.71" Category="Installed Package" /> 11 | <Link Source="ExtendedTSQLCollector" Target="CommandLineParser 1.9.71" Category="Installed Package" /> 12 | </Links> 13 | <Categories> 14 | <Category Id="Project" /> 15 | <Category Id="Package" /> 16 | </Categories> 17 | <Styles> 18 | <Style TargetType="Node" GroupLabel="Project" ValueLabel="True"> 19 | <Condition Expression="HasCategory('Project')" /> 20 | <Setter Property="Background" Value="Blue" /> 21 | </Style> 22 | </Styles> 23 | </DirectedGraph> -------------------------------------------------------------------------------- /ExtendedTSQLCollector/Setup/Setup.wixproj: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 3 | <PropertyGroup> 4 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 5 | <Platform Condition=" '$(Platform)' == '' ">x86</Platform> 6 | <ProductVersion>3.8</ProductVersion> 7 | <ProjectGuid>a561568d-234f-4a4d-b0e8-1edbf09ca709</ProjectGuid> 8 | <SchemaVersion>2.0</SchemaVersion> 9 | <OutputName>Setup</OutputName> 10 | <OutputType>Package</OutputType> 11 | <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath> 12 | <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath> 13 | <SccProjectName>SAK</SccProjectName> 14 | <SccProvider>SAK</SccProvider> 15 | <SccAuxPath>SAK</SccAuxPath> 16 | <SccLocalPath>SAK</SccLocalPath> 17 | </PropertyGroup> 18 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> 19 | <OutputPath>bin\$(Configuration)\</OutputPath> 20 | <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath> 21 | <DefineConstants>Debug</DefineConstants> 22 | </PropertyGroup> 23 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> 24 | <OutputPath>bin\$(Configuration)\</OutputPath> 25 | <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath> 26 | </PropertyGroup> 27 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release x64|x64' "> 28 | <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath> 29 | <IntermediateOutputPath>obj\$(Platform)\$(Configuration)\</IntermediateOutputPath> 30 | </PropertyGroup> 31 | <ItemGroup> 32 | <Compile Include="Product.wxs" /> 33 | </ItemGroup> 34 | <ItemGroup> 35 | <WixExtension Include="WixUtilExtension"> 36 | <HintPath>$(WixExtDir)\WixUtilExtension.dll</HintPath> 37 | <Name>WixUtilExtension</Name> 38 | </WixExtension> 39 | </ItemGroup> 40 | <Import Project="$(WixTargetsPath)" /> 41 | <PropertyGroup> 42 | <PostBuildEvent>move /Y "!(TargetPath)" "$(TargetDir)$(SolutionName)_$(PlatformName)$(TargetExt)"</PostBuildEvent> 43 | </PropertyGroup> 44 | <!-- 45 | To modify your build process, add your task inside one of the targets below and uncomment it. 46 | Other similar extension points exist, see Wix.targets. 47 | <Target Name="BeforeBuild"> 48 | </Target> 49 | <Target Name="AfterBuild"> 50 | </Target> 51 | --> 52 | </Project> -------------------------------------------------------------------------------- /ExtendedTSQLCollector/Setup/Setup.wixproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/UpgradeLog.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spaghettidba/ExtendedTSQLCollector/c415fe5932ac0e656497354c55896017d2a6b781/ExtendedTSQLCollector/UpgradeLog.htm -------------------------------------------------------------------------------- /ExtendedTSQLCollector/UserControlLibrary/Converters/DateTimeDoubleConverter.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 3 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 4 | * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 5 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 6 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 7 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 8 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 9 | */ 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Linq; 14 | using System.Text; 15 | using System.Windows.Data; 16 | 17 | namespace Andora.UserControlLibrary.Converters 18 | { 19 | [ValueConversion(typeof(DateTime), typeof(double))] 20 | public class DateTimeDoubleConverter : IValueConverter 21 | { 22 | /// <summary> 23 | /// Converts a DateTime Value to a Double Value using the Ticks of the DateTime instance. 24 | /// </summary> 25 | /// <param name="value">Instance of the DateTime class.</param> 26 | /// <param name="targetType">Target Type, which should be a Double.</param> 27 | /// <param name="parameter">Parameter used in the conversion.</param> 28 | /// <param name="culture">Globalization culture instance.</param> 29 | /// <returns></returns> 30 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 31 | { 32 | DateTime dt = DateTime.Parse(value.ToString()); 33 | return dt.Ticks; 34 | } 35 | 36 | /// <summary> 37 | /// Converts a Double Value to a DateTime Value assuming the Double represents the amount of Ticks for a DateTime instance. 38 | /// </summary> 39 | /// <param name="value">Instance of the Double Class.</param> 40 | /// <param name="targetType">Target Type, which should be a DateTime</param> 41 | /// <param name="parameter">Parameter used in the conversion.</param> 42 | /// <param name="culture">Globalization culture instance.</param> 43 | /// <returns></returns> 44 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 45 | { 46 | double d = double.Parse(value.ToString()); 47 | return new DateTime((long)d); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/UserControlLibrary/Converters/TimeSpanConverter.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 3 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 4 | * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 5 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 6 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 7 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 8 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 9 | */ 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Linq; 14 | using System.Text; 15 | using System.Windows.Data; 16 | 17 | namespace Andora.UserControlLibrary.Converters 18 | { 19 | [ValueConversion(typeof(TimeSpan), typeof(double))] 20 | public class TimeSpanToDoubleConverter : IValueConverter 21 | { 22 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 23 | { 24 | TimeSpan givenValue = (TimeSpan)value; 25 | return givenValue.Ticks; 26 | } 27 | 28 | public object ConvertBack(object value, Type targetType, 29 | object parameter, System.Globalization.CultureInfo culture) 30 | { 31 | return new TimeSpan(((long)value)); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/UserControlLibrary/DateRangeSlider/DateRangeSlider.xaml: -------------------------------------------------------------------------------- 1 | <UserControl x:Class="Andora.UserControlLibrary.DateRangeSlider" 2 | xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 3 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 4 | xmlns:local="clr-namespace:Andora.UserControlLibrary" 5 | xmlns:converters="clr-namespace:Andora.UserControlLibrary.Converters" 6 | x:Name="root"> 7 | <!-- 8 | /* 9 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 10 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 11 | * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 12 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 13 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 14 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 15 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 | */ 17 | 18 | Sample Usage: 19 | 20 | <userControls:DateRangeSlider x:Name="dateRangeSlider1" 21 | LowerValue="02/01/2011 8:00 AM" 22 | UpperValue="10/31/2011 8:30 PM" 23 | Minimum="01/01/2011 12:00 AM" 24 | Maximum="12/31/2011 11:59:59 PM" 25 | Grid.ColumnSpan="2" Grid.Column="0" 26 | Grid.Row="0" 27 | IsUpperSliderEnabled="{Binding ElementName=chkDisableUpperSlider, Path=IsChecked, Converter={StaticResource ResourceKey=negationConverter}, Mode=TwoWay}" 28 | IsLowerSliderEnabled="{Binding ElementName=chkDisableLowerSlider, Path=IsChecked, Converter={StaticResource ResourceKey=negationConverter}, Mode=TwoWay}" 29 | IsUpperValueLockedToMax="{Binding ElementName=chkLockUpperSliderToMax, Path=IsChecked, Mode=TwoWay}" 30 | IsLowerValueLockedToMin="{Binding ElementName=chkLockLowerSliderToMin, Path=IsChecked, Mode=TwoWay}" 31 | SmallChange="0:0:30:0.000" 32 | LargeChange="0:1:0:0.000"/> 33 | --> 34 | <UserControl.Resources> 35 | <ResourceDictionary> 36 | <converters:DateTimeDoubleConverter x:Key="dtdConverter" /> 37 | <converters:TimeSpanToDoubleConverter x:Key="timespanToDoubleConverter" /> 38 | 39 | <ControlTemplate x:Key="simpleSlider" TargetType="{x:Type Slider}"> 40 | <Border SnapsToDevicePixels="true" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"> 41 | <Grid> 42 | <Grid.RowDefinitions> 43 | <RowDefinition Height="Auto"/> 44 | <RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}"/> 45 | <RowDefinition Height="Auto"/> 46 | </Grid.RowDefinitions> 47 | 48 | <Rectangle x:Name="PART_SelectionRange"/> 49 | 50 | <Track x:Name="PART_Track" Grid.Row="1"> 51 | <Track.Thumb> 52 | <Thumb x:Name="Thumb" Style="{StaticResource ResourceKey=HorizontalSliderThumbStyle}" /> 53 | </Track.Thumb> 54 | </Track> 55 | </Grid> 56 | </Border> 57 | </ControlTemplate> 58 | <ResourceDictionary.MergedDictionaries> 59 | <ResourceDictionary Source="SliderResources.xaml" /> 60 | </ResourceDictionary.MergedDictionaries> 61 | </ResourceDictionary> 62 | </UserControl.Resources> 63 | <Grid VerticalAlignment="Center" Background="Transparent"> 64 | <Border BorderThickness="0,1,0,0" BorderBrush="DarkGray" VerticalAlignment="Bottom" Height="1" HorizontalAlignment="Stretch" 65 | Margin="0,0,0,10"/> 66 | 67 | <Slider x:Name="LowerSlider" VerticalAlignment="Top" IsEnabled="{Binding ElementName=root, Path=IsLowerSliderEnabled, Mode=TwoWay}" 68 | Minimum="{Binding ElementName=root, Path=Minimum, Converter={StaticResource ResourceKey=dtdConverter}}" 69 | Maximum="{Binding ElementName=root, Path=Maximum, Converter={StaticResource ResourceKey=dtdConverter}}" 70 | Value="{Binding ElementName=root, Path=LowerValue, Mode=OneWay, Converter={StaticResource ResourceKey=dtdConverter}}" 71 | Template="{StaticResource simpleSlider}" 72 | Margin="0,0,10,0" 73 | SmallChange="{Binding ElementName=root, Path=SmallChange, Converter={StaticResource ResourceKey=timespanToDoubleConverter}}" 74 | LargeChange="{Binding ElementName=root, Path=LargeChange, Converter={StaticResource ResourceKey=timespanToDoubleConverter}}" 75 | /> 76 | 77 | <Slider x:Name="UpperSlider" IsEnabled="{Binding ElementName=root, Path=IsUpperSliderEnabled, Mode=TwoWay}" 78 | Minimum="{Binding ElementName=root, Path=Minimum, Converter={StaticResource ResourceKey=dtdConverter}}" 79 | Maximum="{Binding ElementName=root, Path=Maximum, Converter={StaticResource ResourceKey=dtdConverter}}" 80 | Value="{Binding ElementName=root, Path=UpperValue, Mode=OneWay, Converter={StaticResource ResourceKey=dtdConverter}}" 81 | Template="{StaticResource simpleSlider}" 82 | Margin="10,0,0,0" 83 | SmallChange="{Binding ElementName=root, Path=SmallChange, Converter={StaticResource ResourceKey=timespanToDoubleConverter}}" 84 | LargeChange="{Binding ElementName=root, Path=LargeChange, Converter={StaticResource ResourceKey=timespanToDoubleConverter}}" 85 | /> 86 | </Grid> 87 | </UserControl> 88 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/UserControlLibrary/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("UserControlLibrary")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("Microsoft")] 14 | [assembly: AssemblyProduct("UserControlLibrary")] 15 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [assembly: ComVisible(false)] 23 | 24 | //In order to begin building localizable applications, set 25 | //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file 26 | //inside a <PropertyGroup>. For example, if you are using US english 27 | //in your source files, set the <UICulture> to en-US. Then uncomment 28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 29 | //the line below to match the UICulture setting in the project file. 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 36 | //(used if a resource is not found in the page, 37 | // or application resource dictionaries) 38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 39 | //(used if a resource is not found in the page, 40 | // app, or any theme specific resource dictionaries) 41 | )] 42 | 43 | 44 | // Version information for an assembly consists of the following four values: 45 | // 46 | // Major Version 47 | // Minor Version 48 | // Build Number 49 | // Revision 50 | // 51 | // You can specify all the values or you can default the Build and Revision Numbers 52 | // by using the '*' as shown below: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("1.0.0.0")] 55 | [assembly: AssemblyFileVersion("1.0.0.0")] 56 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/UserControlLibrary/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // <auto-generated> 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.34014 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // </auto-generated> 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Andora.UserControlLibrary.Properties { 12 | using System; 13 | 14 | 15 | /// <summary> 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// </summary> 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// <summary> 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// </summary> 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Andora.UserControlLibrary.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// <summary> 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// </summary> 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/UserControlLibrary/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <root> 3 | <!-- 4 | Microsoft ResX Schema 5 | 6 | Version 2.0 7 | 8 | The primary goals of this format is to allow a simple XML format 9 | that is mostly human readable. The generation and parsing of the 10 | various data types are done through the TypeConverter classes 11 | associated with the data types. 12 | 13 | Example: 14 | 15 | ... ado.net/XML headers & schema ... 16 | <resheader name="resmimetype">text/microsoft-resx</resheader> 17 | <resheader name="version">2.0</resheader> 18 | <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> 19 | <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> 20 | <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> 21 | <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> 22 | <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> 23 | <value>[base64 mime encoded serialized .NET Framework object]</value> 24 | </data> 25 | <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> 26 | <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> 27 | <comment>This is a comment</comment> 28 | </data> 29 | 30 | There are any number of "resheader" rows that contain simple 31 | name/value pairs. 32 | 33 | Each data row contains a name, and value. The row also contains a 34 | type or mimetype. Type corresponds to a .NET class that support 35 | text/value conversion through the TypeConverter architecture. 36 | Classes that don't support this are serialized and stored with the 37 | mimetype set. 38 | 39 | The mimetype is used for serialized objects, and tells the 40 | ResXResourceReader how to depersist the object. This is currently not 41 | extensible. For a given mimetype the value must be set accordingly: 42 | 43 | Note - application/x-microsoft.net.object.binary.base64 is the format 44 | that the ResXResourceWriter will generate, however the reader can 45 | read any of the formats listed below. 46 | 47 | mimetype: application/x-microsoft.net.object.binary.base64 48 | value : The object must be serialized with 49 | : System.Serialization.Formatters.Binary.BinaryFormatter 50 | : and then encoded with base64 encoding. 51 | 52 | mimetype: application/x-microsoft.net.object.soap.base64 53 | value : The object must be serialized with 54 | : System.Runtime.Serialization.Formatters.Soap.SoapFormatter 55 | : and then encoded with base64 encoding. 56 | 57 | mimetype: application/x-microsoft.net.object.bytearray.base64 58 | value : The object must be serialized into a byte array 59 | : using a System.ComponentModel.TypeConverter 60 | : and then encoded with base64 encoding. 61 | --> 62 | <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> 63 | <xsd:element name="root" msdata:IsDataSet="true"> 64 | <xsd:complexType> 65 | <xsd:choice maxOccurs="unbounded"> 66 | <xsd:element name="metadata"> 67 | <xsd:complexType> 68 | <xsd:sequence> 69 | <xsd:element name="value" type="xsd:string" minOccurs="0" /> 70 | </xsd:sequence> 71 | <xsd:attribute name="name" type="xsd:string" /> 72 | <xsd:attribute name="type" type="xsd:string" /> 73 | <xsd:attribute name="mimetype" type="xsd:string" /> 74 | </xsd:complexType> 75 | </xsd:element> 76 | <xsd:element name="assembly"> 77 | <xsd:complexType> 78 | <xsd:attribute name="alias" type="xsd:string" /> 79 | <xsd:attribute name="name" type="xsd:string" /> 80 | </xsd:complexType> 81 | </xsd:element> 82 | <xsd:element name="data"> 83 | <xsd:complexType> 84 | <xsd:sequence> 85 | <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> 86 | <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> 87 | </xsd:sequence> 88 | <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> 89 | <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> 90 | <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> 91 | </xsd:complexType> 92 | </xsd:element> 93 | <xsd:element name="resheader"> 94 | <xsd:complexType> 95 | <xsd:sequence> 96 | <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> 97 | </xsd:sequence> 98 | <xsd:attribute name="name" type="xsd:string" use="required" /> 99 | </xsd:complexType> 100 | </xsd:element> 101 | </xsd:choice> 102 | </xsd:complexType> 103 | </xsd:element> 104 | </xsd:schema> 105 | <resheader name="resmimetype"> 106 | <value>text/microsoft-resx</value> 107 | </resheader> 108 | <resheader name="version"> 109 | <value>2.0</value> 110 | </resheader> 111 | <resheader name="reader"> 112 | <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 113 | </resheader> 114 | <resheader name="writer"> 115 | <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 116 | </resheader> 117 | </root> -------------------------------------------------------------------------------- /ExtendedTSQLCollector/UserControlLibrary/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // <auto-generated> 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.34014 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // </auto-generated> 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Andora.UserControlLibrary.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ExtendedTSQLCollector/UserControlLibrary/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | <?xml version='1.0' encoding='utf-8'?> 2 | <SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> 3 | <Profiles> 4 | <Profile Name="(Default)" /> 5 | </Profiles> 6 | <Settings /> 7 | </SettingsFile> -------------------------------------------------------------------------------- /ExtendedTSQLCollector/UserControlLibrary/UserControlLibrary.csproj: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 3 | <PropertyGroup> 4 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 5 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 6 | <ProductVersion>8.0.30703</ProductVersion> 7 | <SchemaVersion>2.0</SchemaVersion> 8 | <ProjectGuid>{4B91CA32-97D6-4220-8913-AE67A0AB52CD}</ProjectGuid> 9 | <OutputType>library</OutputType> 10 | <AppDesignerFolder>Properties</AppDesignerFolder> 11 | <RootNamespace>Andora.UserControlLibrary</RootNamespace> 12 | <AssemblyName>Andora.UserControlLibrary</AssemblyName> 13 | <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> 14 | <TargetFrameworkProfile>Client</TargetFrameworkProfile> 15 | <FileAlignment>512</FileAlignment> 16 | <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> 17 | <WarningLevel>4</WarningLevel> 18 | </PropertyGroup> 19 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> 20 | <DebugSymbols>true</DebugSymbols> 21 | <DebugType>full</DebugType> 22 | <Optimize>false</Optimize> 23 | <OutputPath>bin\Debug\</OutputPath> 24 | <DefineConstants>DEBUG;TRACE</DefineConstants> 25 | <ErrorReport>prompt</ErrorReport> 26 | <WarningLevel>4</WarningLevel> 27 | </PropertyGroup> 28 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 29 | <DebugType>pdbonly</DebugType> 30 | <Optimize>true</Optimize> 31 | <OutputPath>bin\Release\</OutputPath> 32 | <DefineConstants>TRACE</DefineConstants> 33 | <ErrorReport>prompt</ErrorReport> 34 | <WarningLevel>4</WarningLevel> 35 | </PropertyGroup> 36 | <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release x64|AnyCPU'"> 37 | <OutputPath>bin\Release x64\</OutputPath> 38 | <DefineConstants>TRACE</DefineConstants> 39 | <Optimize>true</Optimize> 40 | <DebugType>pdbonly</DebugType> 41 | <PlatformTarget>AnyCPU</PlatformTarget> 42 | <ErrorReport>prompt</ErrorReport> 43 | <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> 44 | </PropertyGroup> 45 | <ItemGroup> 46 | <Reference Include="System" /> 47 | <Reference Include="System.Data" /> 48 | <Reference Include="System.Xml" /> 49 | <Reference Include="Microsoft.CSharp" /> 50 | <Reference Include="System.Core" /> 51 | <Reference Include="System.Xml.Linq" /> 52 | <Reference Include="System.Data.DataSetExtensions" /> 53 | <Reference Include="System.Xaml"> 54 | <RequiredTargetFramework>4.0</RequiredTargetFramework> 55 | </Reference> 56 | <Reference Include="WindowsBase" /> 57 | <Reference Include="PresentationCore" /> 58 | <Reference Include="PresentationFramework" /> 59 | </ItemGroup> 60 | <ItemGroup> 61 | <Compile Include="Converters\DateTimeDoubleConverter.cs" /> 62 | <Compile Include="Converters\TimeSpanConverter.cs" /> 63 | <Compile Include="DateRangeSlider\DateRangeSlider.xaml.cs"> 64 | <DependentUpon>DateRangeSlider.xaml</DependentUpon> 65 | </Compile> 66 | <Compile Include="Properties\AssemblyInfo.cs"> 67 | <SubType>Code</SubType> 68 | </Compile> 69 | <Compile Include="Properties\Resources.Designer.cs"> 70 | <AutoGen>True</AutoGen> 71 | <DesignTime>True</DesignTime> 72 | <DependentUpon>Resources.resx</DependentUpon> 73 | </Compile> 74 | <Compile Include="Properties\Settings.Designer.cs"> 75 | <AutoGen>True</AutoGen> 76 | <DependentUpon>Settings.settings</DependentUpon> 77 | <DesignTimeSharedInput>True</DesignTimeSharedInput> 78 | </Compile> 79 | <EmbeddedResource Include="Properties\Resources.resx"> 80 | <Generator>ResXFileCodeGenerator</Generator> 81 | <LastGenOutput>Resources.Designer.cs</LastGenOutput> 82 | </EmbeddedResource> 83 | <None Include="Properties\Settings.settings"> 84 | <Generator>SettingsSingleFileGenerator</Generator> 85 | <LastGenOutput>Settings.Designer.cs</LastGenOutput> 86 | </None> 87 | <AppDesigner Include="Properties\" /> 88 | </ItemGroup> 89 | <ItemGroup> 90 | <Page Include="DateRangeSlider\DateRangeSlider.xaml"> 91 | <Generator>MSBuild:Compile</Generator> 92 | <SubType>Designer</SubType> 93 | </Page> 94 | <Page Include="DateRangeSlider\SliderResources.xaml"> 95 | <Generator>MSBuild:Compile</Generator> 96 | <SubType>Designer</SubType> 97 | </Page> 98 | </ItemGroup> 99 | <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 100 | <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 101 | Other similar extension points exist, see Microsoft.Common.targets. 102 | <Target Name="BeforeBuild"> 103 | </Target> 104 | <Target Name="AfterBuild"> 105 | </Target> 106 | --> 107 | </Project> -------------------------------------------------------------------------------- /ExtendedTSQLCollector/packages/repositories.config: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <repositories> 3 | <repository path="..\CollectionSetManager\packages.config" /> 4 | <repository path="..\ExtendedTSQLCollector\packages.config" /> 5 | <repository path="..\ExtendedTSQLUploader\packages.config" /> 6 | <repository path="..\ExtendedXEReaderCollector\packages.config" /> 7 | <repository path="..\ExtendedXEReaderCollectorTrigger\packages.config" /> 8 | <repository path="..\ExtendedXEReaderUploader\packages.config" /> 9 | <repository path="..\GenericTSQLCollector\packages.config" /> 10 | <repository path="..\GenericTSQLUploader\packages.config" /> 11 | <repository path="..\InstallCollectorType\packages.config" /> 12 | </repositories> -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # Extended T-SQL Collector 2 | _Custom collector types to extend and simplify the features offered by the built-in SQL Server Data Collector and read data from Extended Events and/or queries._ 3 | 4 | **Extended T-SQL Collector = Extended Events + Data Collector** 5 | 6 | **Extended T-SQL Collector** includes a XEReader collector type that lets you collect data from Extended Events sessions. This is the easiest way around to save Extended Events to a table. 7 | 8 | SQL Server ships with a built-in T-SQL Collector Type that lets you collect data based on an custom T-SQL statement. However, it doesn't let you collect data in **any** fomat: you are limited to the data types accepted by the intermediate format used to store the cache files (SSIS Raw Files, which do not allow BLOB data). 9 | 10 | To overcome this limitation, **Extended T-SQL Collector** offers a T-SQL query collector type that uses a different cache format and lets you collect XML and varchar(max)/nvarchar(max) columns. 11 | 12 | When it comes to performance tuning and troubleshooting, the most interesting data is available in SQL Server as XML. With this collector type, you can easily collect and upload XML data to your MDW instance. 13 | 14 | The Collection Set Manager utility lets you manage: 15 | * installation of the collector type to the target SQL Server instance 16 | * edit collection sets 17 | * edit collection items 18 | * edit collector types 19 | 20 | Collection sets and collection items can also be created via script. You can find examples in the [documentation](Documentation/Documentation.md). 21 | 22 | # Screenshots 23 | 24 | You can see what the GUI looks like by visiting the [Screenshots](Documentation/Screenshots.md) page 25 | 26 | # Features 27 | 28 | * ExtendedTSQLCollector - a Collector Type that lets you collect BLOB data from a T-SQL query 29 | * ExtendedXEReaderCollector - a Collector Type to collect data directly from an Extended Events session 30 | * ConnectionSetManager - a GUI utility to manage the components of data collection on a target instance 31 | 32 | # Requirements 33 | 34 | * SSIS - the target machine must have SSIS installed, as some collection packages require tasks not included in the Database Engine installation 35 | 36 | 37 | # Documentation 38 | 39 | The complete description of the collector types and sample code to create custom collection sets can be found in the [documentation](Documentation/Documentation.md) --------------------------------------------------------------------------------