Search code examples
windowspowershellperformancecounterzabbix

Access Windows Performance Counters in a locale independent way


I have a mixed set of servers, some running Windows in English, some others running Windows in Italian.

Is there a way to read the value of a performance counter without using locale dependent strings?

I read on the Zabbix documentation that it should be possible to use a numeric format like \2\6 but it does not work for me, neither in Zabbix nor Powershell.

I'd like to monitor the CPU utilization (\Processore(_Total)\% Tempo processore).

Any suggestion is welcome.


Solution

  • The solution is simple: the only problem is to put together all the infos.

    First of all, open regedit and go to the following key:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib
    

    You will find entries named with three digits (e.g. 009, 010, ...). These three digits are a language id: 009 is English, 010 is Italian, and so on.

    In each of these entries you will find a key named Counter. Open it (double click) and copy the content of your preferred language in a text editor. You will have something similar to the following:

    1
    1847
    2
    System
    4
    Memory
    6
    % Processor Time
    10
    File Read Operations/sec
    12
    File Write Operations/sec
    14
    File Control Operations/sec
    16
    ...
    

    As you can see, there is a number below each label: that is index to use. For example, the index of % Processor Time is 10.

    If you have a composite expression (e.g., \Processore(_Total)\% Tempo processore), you have to use \238(_Total)\6 (I used the Italian labels).

    In Zabbix, the expression to use for monitoring the average CPU utilization over the last 15 minutes is:

    perf_counter[\238(_Total)\6, 900]
    

    I hope to have said all: if there is something not clear, please, leave a comment.