2 发现CPU和CPU核心

与发现文件系统的方式相似,如此也可以发现CPUs和CPU核心。

键值

发现规则中的键值应用是:

  1. system.cpu.discovery

此监控项从Zabbix 2.4开始支持。

支持宏

此发现键值反馈两个宏——{#CPU.NUMBER} 和 {#CPU.STATUS},分别识别CPU编号和状态。请注意,在实际的,物理的处理器,内核和超线程之间无法做出明确的区分。Linux,UNIX和BSD系统上的{#CPU.STATUS}可以反馈处理器的状态,“在线状态”或“离线状态”。在Windows系统中,这个相同的宏可能代表第三个值——“未知状态”——代表已检测到处理器,但尚未收集任何信息。

CPU发现依赖于代理的收集器进程来保持与收集器提供的数据一致,并节省获取数据的资源。这样会产生有此键值无法使用代理二进制文件的test(-t)命令行标志的效果,从而反馈一个NOT_SUPPORTED状态以及一条伴随的信息表示收集器进程尚未启动。

可以基于CPU发现创建监控项原型包括,例如:

  • “system.cpu.util[{#CPU.NUMBER}, , ]”

  • “system.hw.cpu[{#CPU.NUMBER}, ]”.

2 Discovery of CPUs and CPU cores

In a similar way as file systems are discovered, it is possible to also discover CPUs and CPU cores.

Item key

The item key to use in the discovery rule is

  1. system.cpu.discovery

This item is supported since Zabbix agent 2.4.

Supported macros

This discovery key returns two macros - {#CPU.NUMBER} and {#CPU.STATUS} identifying the CPU order number and status respectively. Note that a clear distinction cannot be made between actual, physical processors, cores and hyperthreads. {#CPU.STATUS} on Linux, UNIX and BSD systems returns the status of the processor, which can be either “online” or “offline”. On Windows systems, this same macro may represent a third value - “unknown” - which indicates that a processor has been detected, but no information has been collected for it yet.

CPU discovery relies on the agent’s collector process to remain consistent with the data provided by the collector and save resources on obtaining the data. This has the effect of this item key not working with the test (-t) command line flag of the agent binary, which will return a NOT_SUPPORTED status and an accompanying message indicating that the collector process has not been started.

Item prototypes that can be created based on CPU discovery include, for example:

  • “system.cpu.util[{#CPU.NUMBER}, , ]”

  • “system.hw.cpu[{#CPU.NUMBER}, ]”.