Creating Custom Collectors

At times, you need to create you own custom collectors for use.  Here are a couple of walk-thrus that allow you to create your own custom collectors.

Creating a TSQL Script collector.

  1. Create a TSQL Script for things you want to collect and save the file called myscript.sql.    You can put any TSQL script in the file.
  2. Go to c:\Program Files\Microsoft\Pssdiag\CustomDiagnostics  or c:\Program Files(x86)\Microsoft\Pssdiag\CustomDiagnostics 
  3. Copy _MyCollectors and rename it MyCollector (still in Customdiagnostics directory)
    • myscript.sql to the new folder.
    • Open CustomDiag.XML. Leave just one entry of customtask node and delete all other nodes.
    • Open the readme.rtf and change the content to suit your need for this custom collector.  this usually provides explanation or instruction.
  4. Launch Diag Config Manager program
    • Right click "MyCollector" and choose "details". 
    • Add one entry by starting to type in the last row
    • Name -- "My Script" 
    • Type -- choose "TSQL_Script" 
    • Collection Point -- choose "Startup"
    • Wait -- choose "OnlyOnShutdown"
    • Command:  enter "Myscript.sql"
    • Click OK.  this will save your configuration to customdiagl.xml
  5. Test by selecting your collector to create a package to run. Pssdiag should  a file <machine>_<sql_instance>_mycollector_myscript.out.

 

Creating a collector that would run your own utility

  1. Go to c:\Program Files\Microsoft\Pssdiag\CustomDiagnostics  or c:\Program Files(x86)\Microsoft\Pssdiag\CustomDiagnostics 
  2. Copy _MyCollectors and rename it MyCollector (still in Customdiagnostics directory)
    • copy your utility (example myutility.exe)  to the new folder.
    • Open CustomDiag.XML. Leave just one entry of customtask node and delete all other nodes.
    • Open the readme.rtf and change the content to suit your need for this custom collector.  this usually provides explanation or instruction.
  3. Launch Diag Config Manager program
    • Right click "MyCollector" and choose "details". 
    • Add one entry by starting to type in the last row
    • Name -- "MyUtility" 
    • Type -- choose "Utility" 
    • Collection Point -- choose "Startup"
    • Wait -- choose "OnlyOnShutdown"
    • Command:  enter MyUtility.exe "%output_name%.TXT" 2>&1
    • Click OK.  this will save your configuration to customdiagl.xml
  4. Test by selecting your collector to create a package to run. Pssdiag should  a file <machine>_<sql_instance>_mycollector_myutility.txt

 

  How to add a custom TSQL task to an existing group

  1. Launch Diag Manager
  2. right click on the custom group under "Custom Diagnositcs" and click on Details
  3. At the end of table start entering your information.
    • Name:  enter your task name
    • Type: chose "TSQL_Script"
    • "Collection Point": choose "Startup" or your own choice
    • "Wait": select No
    • under command: enter your script name
  4. Then put your script in the folder under %ProgramFiles%\Microsoft\PSSDiag\CustomDiagnostics\<your custom diagnostics group>.  In CustomerDiagnostics folder, there are many subdirctories.  These will show up under "Custom Diagnostics" in Diag Manager. 
  5. You are ready to use it. 
     

 

Last edited Feb 25, 2011 at 6:20 PM by jackli, version 7

Comments

lorrinferdinand Jan 29, 2015 at 2:21 PM 
Is it possible to add a custom trace definition xml?
For existing trace templates, is it possible to exclude columns or setup filters on the trace?