Partager via


Translating Windows Server Performance Counter Results from French to English Using a VB Script

Earlier this year, I was delivering an operational assessment for an OpsMgr implementation in which I was looking at a number of performance counters from various Windows Servers as they relate to the overall OpsMgr environment health and configuration. One of the interesting challenges I faced was that the environment had Windows Servers installed in various languages, notably a mix of English and French.

Not a big deal as I’m bilingual, but for consistency, I wanted the collective results to be in one language--English. 

I collected data from the various OpsMgr servers that were part of a particular Management Group (RMS, MS, DBs, etc.) and then saved the binaries (.blg) and then copied them to a central location. I used Perfmon to export the data as CSV files, which I was then planning on consolidating for my analysis and report.

After collecting the data, I found myself needing to translate a number of column headers from French to English (for example “Disque Physique” to “Physical Disk”).

How did I resolve this? Using a script of course! Let’s go through the steps.


Once the data collector set has been created and the data has been collecting for a certain length of time in a binary (.blg) file then…

  1. Copy the .blg file somewhere where you’ll make your modifications (e.g., c:\temp\myperfcollections)
  2. Open the .blg file with Perfmon; right click on the data diagram and select Save Data As
  3. Save the data as “Text File (Comma delimited) (*.csv) ” (see below)
  1.  

image

image

 

Next, create a VB Script that will create an instance of Excel and do a programmatic “find and replace”.

 

    1:  On Error Resume Next
    2:   
    3:  Set objExcel = CreateObject("Excel.Application")
    4:   
    5:  objExcel.Visible = True
    6:   
    7:  Set objWorkbook = objExcel.Workbooks.Open("C:\temp\mgr.csv")
    8:   
    9:  Set objWorksheet = objWorkbook.Worksheets(1)
   10:   
   11:  Set objRange = objWorksheet.UsedRange
   12:   
   13:  objRange.Replace "Disque physique", "PhysicalDisk"
   14:   
   15:  objRange.Replace "Taille de file d'attente du disque actuelle", "Current Disk Queue Length"
   16:   
   17:  objRange.Replace "Processus", "Process"
   18:   
   19:  objRange.Replace "% Temps processeur", "% Processor Time"
   20:   
   21:  objRange.Replace "Plage de travail", "Working Set"
   22:   
   23:  objRange.Replace "Fichier d'échange", "Paging File"
   24:   
   25:  objRange.Replace "Pourcentage d'utilisation", "% Usage"
   26:   
   27:  objRange.Replace "Disque logique", "LogicalDisk"
   28:   
   29:  objRange.Replace "Usage maximal", "% Usage Peak"
   30:   
   31:  objRange.Replace "Moy. disque s/écriture", "Avg. Disk sec/Write"
   32:   
   33:  objRange.Replace "Moy. disque s/lecture", "Avg. Disk sec/Read"
   34:   
   35:  objRange.Replace "% Durée d'inactivité", "% Idle Time"
   36:   
   37:  objRange.Replace "Mégaoctets libres", "Free Megabytes"
   38:   
   39:  objRange.Replace "Transferts disque/s", "Disk Transfers/sec"
   40:   
   41:  objRange.Replace "Mémoire", "Memory"
   42:   
   43:  objRange.Replace "Entrées libres en table des pages système", "Free System Page Table Entries"
   44:   
   45:  objRange.Replace "Mégaoctets disponibles", "Available MBytes"
   46:   
   47:  objRange.Replace "Système", "System"
   48:   
   49:  objRange.Replace "Octets de réserve paginée", "Pool Paged Bytes"
   50:   
   51:  objRange.Replace "Octets de réserve non paginée", "Pool Nonpaged Bytes"
   52:   
   53:  objRange.Replace "Changements de contexte/s", "Context Switches/sec"
   54:   
   55:  objRange.Replace "Longueur de la file du processeur", "Processor Queue Length"
   56:   
   57:  objRange.Replace "Temps d'activité système", "System Up Time"
   58:   
   59:  objRange.Replace "Interface réseau", "Network Interface"
   60:   
   61:  objRange.Replace "Bande passante actuelle", "Current Bandwidth"
   62:   
   63:  objRange.Replace "Total des octets/s", "Bytes Total/sec"
   64:   
   65:  objRange.Replace "Longueur de la file d'attente de sortie", "Output Queue Length"
   66:   
   67:  objRange.Replace "% Temps privilégié", "% Privileged Time"
   68:   
   69:  objRange.Replace "% Temps d'interruption", "% Interrupt Time"
   70:   
   71:  objRange.Replace "Nombre de handles", "Handle Count"
   72:   
   73:  objRange.Replace "Temps d'activité System", "System Up Time"
   74:   
   75:  objRange.Replace "Processeur", "Processor"

The script is straight forward--just match the objects/counters in one language for another. Feel free to create a translation between any two languages by replacing the text in the script.

Remember to replace the location of the CSV file in the script with your own (this one is “c:\temp\mgr.csv” – line 7) and run from an elevated command prompt.

I could have done this work manually, but where’s the fun in that?! Now I have another “tool” ready to go for the next occurrence and I can easily create the reverse-–flip the terms around and the script will translate from English to French.

QED! (Quite Easily Done!)

Comments

  • Anonymous
    January 01, 2003
    The comment has been removed