这是原厂英文文档的翻译页面. 欢迎帮助我们 完善文档.
2022 Zabbix中国峰会
2022 Zabbix中国峰会

2 按位运算函数

此处列出的所有功能均受支持:

关于函数参数的一些一般说明:

  • · 函数参数用逗号分隔
  • · 接受表达式作为参数
  • · 可选的函数参数(或参数部分)由 · < > 表示
函数
Description 函数特定参数 注释
bitand (值,掩码)
监控项值和掩码的“按位与”值。 - 要检查的值
掩码(强制)- 64 位无符号整数 (0 - 18446744073709551615)
支持的值类型 : int

虽然比较是以位方式完成的,但必须提供所有值并以十进制形式返回。 例如,检查第 3 位是通过与 4 比较而不是 100 来完成的。

示例:
=> bitand(last(/host/key),12 )=8 或 bitand(last(/host/key),12)=4 → 第 3 位或第 4 位设置,但不能同时设置
=> bitand (last(/host/key),20)=16 → 第 3 位未设置,第 5 位已设置。
bitlshift(值,要移动的位)
监控项值向左移位。 - 要检查的值
要移位的位数(强制)- 要移位的位数
支持的值类型:整数

尽管比较是以按位方式完成的,但必须提供所有值并以十进制形式返回。 例如,检查第 3 位是通过与 4 而不是 100 进行比较来完成的。
bitnot(值)
项目值的“按位非”值。 - 要检查的值
支持的值类型:int

虽然比较是以按位方式完成的,但所有值 必须提供并以十进制形式返回。 例如,检查第 3 位是通过与 4 比较而不是 100 来完成的。
bitor(值,掩码)
项目值和掩码的“按位或”值。 - 要检查的值
掩码(强制)- 64 位无符号整数 (0 - 18446744073709551615)
支持的值类型 : int

虽然比较是以位方式完成的,但必须提供所有值并以十进制形式返回。 例如,检查第 3 位是通过与 4 而不是 100 进行比较来完成的。
bitrshift(值,要移动的位)
项目值的按位右移。 - 要检查的值
要移位的位数(强制性)- 要移位的位数
支持的值类型:整数

尽管比较是以按位方式完成的,但必须提供所有值并以十进制形式返回。 例如,检查第 3 位是通过与 4 比较而不是 100 来完成的。
bitxor(值,掩码)
项目值和掩码的“按位异或”值。 - 要检查的值
掩码(强制)- 64 位无符号整数 (0 - 18446744073709551615)
支持的值 types: int

虽然比较是按位方式进行的,但必须提供所有值并以十进制形式返回。 例如,检查第 3 位是通过与 4 而不是 100 进行比较来完成的。

Function details

Some general notes on function parameters:

  • Function parameters are separated by a comma
  • Expressions are accepted as parameters
  • Optional function parameters (or parameter parts) are indicated by < >
bitand(value,mask)

The value of "bitwise AND" of an item value and mask.
Supported value types: Integer.

Parameter:

  • value - the value to check;
  • mask (mandatory) - a 64-bit unsigned integer (0 - 18446744073709551615).

Although the comparison is done in a bitwise manner, all the values must be supplied and are returned in decimal. For example, checking for the 3rd bit is done by comparing to 4, not 100.

Examples:

bitand(last(/host/key),12)=8 or bitand(last(/host/key),12)=4 #3rd or 4th bit set, but not both at the same time
       bitand(last(/host/key),20)=16 #3rd bit not set and 5th bit set
bitlshift(value,bits to shift)

The bitwise shift left of an item value.
Supported value types: Integer.

Parameter:

  • value - the value to check;
  • bits to shift (mandatory) - the number of bits to shift.

Although the comparison is done in a bitwise manner, all the values must be supplied and are returned in decimal. For example, checking for the 3rd bit is done by comparing to 4, not 100.

bitnot(value)

The value of "bitwise NOT" of an item value.
Supported value types: Integer.

Parameter:

  • value - the value to check.

Although the comparison is done in a bitwise manner, all the values must be supplied and are returned in decimal. For example, checking for the 3rd bit is done by comparing to 4, not 100.

bitor(value,mask)

The value of "bitwise OR" of an item value and mask.
Supported value types: Integer.

Parameter:

  • value - the value to check;
  • mask (mandatory) - a 64-bit unsigned integer (0 - 18446744073709551615).

Although the comparison is done in a bitwise manner, all the values must be supplied and are returned in decimal. For example, checking for the 3rd bit is done by comparing to 4, not 100.

bitrshift(value,bits to shift)

The bitwise shift right of an item value.
Supported value types: Integer.

Parameter:

  • value - the value to check;
  • bits to shift (mandatory) - the number of bits to shift.

Although the comparison is done in a bitwise manner, all the values must be supplied and are returned in decimal. For example, checking for the 3rd bit is done by comparing to 4, not 100.

bitxor(value,mask)

The value of "bitwise exclusive OR" of an item value and mask.
Supported value types: Integer.

Parameter:

  • value - the value to check;
  • mask (mandatory) - a 64-bit unsigned integer (0 - 18446744073709551615).

Although the comparison is done in a bitwise manner, all the values must be supplied and are returned in decimal. For example, checking for the 3rd bit is done by comparing to 4, not 100.

See all supported functions.