PAL collector script – PalCollector.ps1


One of the top questions I get with the PAL tool is what data to collect. As many of you know, the PAL tool only analyze existing counter logs. It is up to you to create the counter log. To help with this problem, I created a PowerShell script called PalCollector.ps1. This script will query your local computer’s performance counters and will find a PAL threshold file that best matches your computer, then it creates a data collector set called, “PalCollector” using the counter paths from the best matching threshold file. It creates the data collector as a 200 MB binary circular log which means that it will continuously collect data every 15 seconds and will never get over 200 MB in size – roughly 24 hours of data. Once you are done collecting data, analyze the counter log (*.blg) using the PAL tool as you normally would.

Instructions

  1. Download PalCollector.zip from http://sdrv.ms/10dZBNb.
  2. Extract the zip file to a folder such as your Desktop or somewhere under your “My Documents” folder.
  3. In Windows Explorer, find PalCollector.ps1, go to Properties of the file and click the Unblock button. This will allow the script to run on your system.
  4. With administrator rights (required) open an elevated PowerShell session.
  5. If your execution policy is not set to RemoteSigned or Unrestricted, then do so now by running:
    Get-ExecutionPolicy
    Set-ExecutionPolicy RemoteSigned
  6. Change directory to the location where you extracted the zip file.
  7. Run “.\PalCollector.ps1”

Please let me know your thoughts on how it is working for you and any recommendations on improvement.


Comments (14)

  1. Anonymous says:

    Sorry for my delay in responses. I’ve been heads down working on my book.
    I just uploaded the PalCollector.ps1 scripts to the PAL tool web site at
    http://pal.codeplex.com. I’ll ship the script with the PAL tool as well starting with PAL 2.5.

  2. Anonymous says:

    Oops. I also had to change:

    “`
    $aCounters.CounterPath | Out-File -FilePath "$UserTempDirectorycounterlist.txt"
    “`

    to:

    “`
    $aCounters | select CounterPath | Out-File -FilePath "$UserTempDirectorycounterlist.txt"
    “`

  3. Anonymous says:

    I couldn’t upgrade to PS3 so I changed this:

    “`
    #// DATASOURCE
    ForEach ($XmlCounter in $XmlPalAnalysisInstance.SelectNodes(‘./DATASOURCE’))
    {
    $sCounterDataSourceCategory = GetCounterObject $XmlCounter.NAME

    ForEach ($sCounterObjectOnComputer in $oCounterObjects.CounterSetName)
    {
    If ($sCounterDataSourceCategory -eq $sCounterObjectOnComputer)
    {
    #//Write-host $sCounterDataSourceCategory
    If ($global:alCounterList.Contains($XmlCounter.NAME) -eq $False)
    “`

    to:

    “`
    #// DATASOURCE
    ForEach ($XmlCounter in $XmlPalAnalysisInstance.SelectNodes(‘./DATASOURCE’))
    {
    $sCounterDataSourceCategory = GetCounterObject $XmlCounter.NAME

    ForEach ($sCounterObjectOnComputer in $oCounterObjects)
    {
    If ($sCounterDataSourceCategory -eq $sCounterObjectOnComputer.CounterSetName)
    {
    #//Write-host $sCounterDataSourceCategory
    If ($global:alCounterList.Contains($XmlCounter.NAME) -eq $False)
    “`

    I also changed:

    “`
    If ($bMatch = $True)
    “`

    to:

    “`
    If ($bMatch -eq $True)
    “`

    Works now.

  4. Nesh says:

    The download link doesn't work. Is there any other location where we can download this file?

    Thanks,

    Nesh

  5. JCline says:

    Is the download link going to get corrected?

    Thanks,

    Jesse

  6. Luge says:

    Thanks Clint!

  7. The download link works for me. Please let me know if you still can't get to it. Please keep in mind that it is on my personal SkyDrive and many corporations block access to SkyDrive.

  8. kevin.mohi@247365.net.au says:

    have used the pal tool before and setting up again. found you site and tried this. was excited until this ;). any ideas ? happy to be a guinea pig. thanks Kevin followed the steps and got this message. windows 7 ultimate sp1 e.t.c VMWare.xml Matches: 74
    Best threshold match: BizTalkServer2006.xml Number of matches: 170 Error: The data is invalid. Error: Data Collector Set was not found. A Performance Monitor data collector called "PalCollector" has been created. Go to Start, Run, "Perfmon", , then navigate
    User Defined data collector sets to see the data collector. Done!

  9. @chuckboycejr says:

    Hi Clint,

    Awesome stuff as always. Is there any way to pass it a specific threshold choice and override the threshold selection logic of the script? If not, could you conisder adding that?

  10. Argiz says:

    I get the same error:

    Error: The data is invalid. Error: Data Collector Set was not found. A Performance Monitor data collector called "PalCollector" has been created.

    No collector is created.

  11. Argiz says:

    I get the same error:

    Error: The data is invalid. Error: Data Collector Set was not found. A Performance Monitor data collector called "PalCollector" has been created.

    No collector is created.

  12. FastFngrz says:

    I too had the "error: the data is invalid" and it was apparently due to Powershell 2.0. I installed PS3.0 and it worked like a charm. (Warning: it needed a reboot!)

  13. Deeden says:

    could you please update the download link? It seems broken and I’d like to try this script… 🙂
    Thanks for all your work!

  14. Deeden says:

    Oh – silly me, I didn’t see your comment above, that the script is included in the PAL download. I found it, thank you!