第 7 章 PrometheusRule [monitoring.coreos.com/v1]


描述
PrometheusRule 为 Prometheus 实例定义记录和警报规则
类型
object
必填
  • spec

7.1. 规格

Expand
属性类型描述

apiVersion

string

APIVersion 定义对象的这个表示法的版本化的 schema。服务器应该将识别的模式转换为最新的内部值,并可拒绝未识别的值。更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources

kind

string

kind 是一个字符串值,代表此对象所代表的 REST 资源。服务器可以从客户端向其提交请求的端点推断。无法更新。采用驼峰拼写法 (CamelCase)。更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds

metadata

ObjectMeta

标准对象元数据。更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata

spec

对象

Prometheus 所需的警报规则定义的规格。

7.1.1. .spec

描述
Prometheus 所需的警报规则定义的规格。
类型
object
Expand
属性类型描述

groups

array

Prometheus 规则文件的内容

groups[]

对象

RuleGroup 是按顺序评估的记录和警报规则的列表。

7.1.2. .spec.groups

描述
Prometheus 规则文件的内容
类型
array

7.1.3. .spec.groups[]

描述
RuleGroup 是按顺序评估的记录和警报规则的列表。
类型
object
必填
  • name
  • rules
Expand
属性类型描述

interval

string

间隔决定了组中规则的频率。

name

string

规则组的名称。

partial_response_strategy

string

PartialResponseStrategy 仅供 ThanosRuler 使用,Prometheus 实例会忽略它。更多信息: https://github.com/thanos-io/thanos/blob/main/docs/components/rule.md#partial-response

rules

数组

警报和记录规则列表。

rules[]

对象

规则描述了警报或记录规则,请参阅 Prometheus 文档: [alerting](https://www.prometheus.io/docs/prometheus/latest/configuration/alerting_rules/)或 [recording](https://www.prometheus.io/docs/prometheus/latest/configuration/recording_rules/#recording-rules)规则

7.1.4. .spec.groups[].rules

描述
警报和记录规则列表。
类型
array

7.1.5. .spec.groups[].rules[]

描述
规则描述了警报或记录规则,请参阅 Prometheus 文档: [alerting](https://www.prometheus.io/docs/prometheus/latest/configuration/alerting_rules/)或 [recording](https://www.prometheus.io/docs/prometheus/latest/configuration/recording_rules/#recording-rules)规则
类型
object
必填
  • Expr
Expand
属性类型描述

alert

string

警报的名称。必须是有效的标签值。只能设置其中一个 记录 和警报

annotations

对象(字符串)

要添加到每个警报的注解。仅对警报规则有效。

Expr

integer-or-string

要评估的 PromQL 表达式。

对于

string

当警报在此长时间返回后,会被视为触发。

labels

对象(字符串)

要添加或覆盖的标签。

记录

string

要输出的时间序列名称。必须是有效的指标名称。只能设置其中一个 记录 和警报

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部