Share via

Manipulating Perfmon data for easy combining and relogging for multiple device comparison.

Jose Perez 21 Reputation points
2022-08-03T14:45:01.507+00:00

What I'm trying to do:
Perfmon is collecting data from multiple servers. I pulled the .blg files, and then combine them into one file for performance review of multiple servers.
I combine the .blg files using the following script:

Relog *servernames*.blg -f bon -o combined.blg  

Then I change them to .csv using:

Relog combined.blg -f csv -o combined.csv  

My problem is that perfmon is collecting at different times: For example, server1, the time 12:05:02 while server 2 has time of 12:05:05. This causes two instances to appear when combining, rather than just one for 12:05.
How can I manipulate the data so that both servers are collecting at the same time (i.e. 12:05:00) and still be able to combine the data for comparison?

Windows for business | Windows Server | User experience | PowerShell
Sysinternals
Sysinternals

Advanced system utilities to manage, troubleshoot, and diagnose Windows and Linux systems and applications.

Windows for business | Windows Server | User experience | Other

1 answer

Sort by: Most helpful
  1. Rich Matheisen 48,116 Reputation points
    2022-08-05T22:50:14.89+00:00

    Try this:

    $time = ""  
    $oneshot = $true  
    $rec = [ordered]@{  
        Date = ""  
        Server1 = "."  
        Server2 = "."  
    }  
      
    Import-CSV C:\junk\Combine.csv -delimiter "|"  |  
        ForEach-Object{  
            $d = get-date $_."Date "                    # Note that all property names contain a trailing space!  
            $d = $d.AddSeconds(-($d.Second))            # convert textual time into a DateTime object and set seconds to zero  
            if ($oneshot){  
                $oneshot = $false  
                $time = $d  
            }  
            if ($d -ne $time){                          # time isn't the same, dump a new record  
                $rec.Date = $time  
                [PSCustomObject]$rec  
                $time = $d  
                $rec.Server1 = "."  
                $rec.Server2 = "."  
            }  
            if (($_."Server 1 ").Trim() -ne "."){  
                $rec.Server1 = ($_."Server 1 ").Trim()  
            }  
            if (($_."Server 2 ").Trim() -ne "."){  
                $rec.Server2 = ($_."Server 2 ").Trim()  
            }  
        } | Export-Csv c:\Junk\Combine_NoSec.csv -NoTypeInformation  
    # Dump the pending record  
    [PSCustomObject]$rec | Export-Csv c:\Junk\Combine_NoSec.csv -Append -NoTypeInformation  
    

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.