以独立于语言环境的方式访问 Windows 性能计数器 [英] Access Windows Performance Counters in a locale independent way

查看:64
本文介绍了以独立于语言环境的方式访问 Windows 性能计数器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组混合服务器,一些运行英语的 Windows,一些运行意大利语的 Windows.

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?

我阅读了 Zabbix 文档 应该可以使用像 \2\6 这样的数字格式,但它对我不起作用,无论是在 Zabbix 还是 Powershell 中.

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.

我想监控 CPU 利用率 (\Processore(_Total)\% Tempo processore).

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

欢迎提出任何建议.

推荐答案

解决方案很简单:唯一的问题是将所有信息放在一起.

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

首先,打开regedit并进入以下键:

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

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

您会找到以三位数命名的条目(例如 009、010、...).这三个数字是语言 ID:009 是英语,010 是意大利语,依此类推.

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.

在每个条目中,您都会找到一个名为 Counter 的键.打开它(双击)并在文本编辑器中复制您首选语言的内容.您将获得类似于以下内容的内容:

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
...

如您所见,每个标签下方都有一个数字:即要使用的索引.例如% Processor Time的索引是10.

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.

如果你有一个复合表达式(例如,\Processore(_Total)\% Tempo processore),你必须使用 \238(_Total)\6(我使用意大利标签).

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

在 Zabbix 中,用于监控过去 15 分钟内平均 CPU 使用率的表达式为:

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.

这篇关于以独立于语言环境的方式访问 Windows 性能计数器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆