搜索

第 13 章 FlowMetric 配置参数

download PDF

FlowMetric 是允许从收集的流日志创建自定义指标的 API。

13.1. FlowMetric [flows.netobserv.io/v1alpha1]

描述
FlowMetric 是允许从收集的流日志创建自定义指标的 API。
类型
object
属性类型描述

apiVersion

字符串

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

kind

字符串

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

metadata

object

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

spec

object

FlowMetricSpec 定义所需的 FlowMetric。提供的 API 允许您根据您的需要自定义这些指标。

在添加新指标或修改现有标签时,您必须仔细监控 Prometheus 工作负载的内存用量,因为这可能会产生重大影响。Cf https://rhobs-handbook.netlify.app/products/openshiftmonitoring/telemetry.md/#what-is-the-cardinality-of-a-metric

要检查所有 Network Observability 指标的基数(cardinality),promql: count({name=~"netobserv.*"}) by (name)

13.1.1. .metadata

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

13.1.2. .spec

描述

FlowMetricSpec 定义所需的 FlowMetric。提供的 API 允许您根据您的需要自定义这些指标。

在添加新指标或修改现有标签时,您必须仔细监控 Prometheus 工作负载的内存用量,因为这可能会产生重大影响。Cf https://rhobs-handbook.netlify.app/products/openshiftmonitoring/telemetry.md/#what-is-the-cardinality-of-a-metric

要检查所有 Network Observability 指标的基数(cardinality),promql: count({name=~"netobserv.*"}) by (name)

类型
object
必填
  • metricName
  • type
属性类型描述

bucket

数组(字符串)

type 为 "Histogram" 时使用的存储桶列表列表必须显示为浮点数。如果没有设置,使用 Prometheus 默认存储桶。

charts

数组

管理员视图中的 OpenShift Container Platform 控制台图表配置 Dashboards 菜单。

direction

string

过滤入口、出口或任何方向流。当设置为 Ingress 时,它等同于在 FlowDirection 中添加正则表达式过滤:0|2。当设置为 Egress 时,它等同于在 FlowDirection 中添加正则表达式过滤:1|2

divider

string

当非零时,缩放因素 (divider) 的值。指标值 = Flow value / Divider。

过滤器

数组

filters 是用于限制考虑哪些流的字段和值列表。通常,需要使用这些过滤消除重复项:Duplicate != "true"FlowDirection = "0"有关可用字段列表,请参阅相关文档 :https://docs.openshift.com/container-platform/latest/observability/network_observability/json-flows-format-reference.html。

labels

数组(字符串)

labels 是一个应该用作 Prometheus 标签的字段列表,也称为维度。从选择标签时,此指标的粒度级别以及查询时可用的聚合结果。它需要小心执行,因为它会影响指标基数 (cf https://rhobs-handbook.netlify.app/products/openshiftmonitoring/telemetry.md/#what-is-the-cardinality-of-a-metric)。通常,避免设置非常高的基数标签,如 IP 或 MAC 地址。"SrcK8S_OwnerName" 或 "DstK8S_OwnerName" 应优先于 "SrcK8S_Name" 或 "DstK8S_Name"。有关可用字段列表,请参阅相关文档 :https://docs.openshift.com/container-platform/latest/observability/network_observability/json-flows-format-reference.html。

metricName

string

指标的名称。在 Prometheus 中,它会自动带有 "netobserv_" 前缀。

type

string

指标类型: "Counter" 或 "Histogram"。使用 "Counter",对随时间增加的任何值以及您可以计算速率(如 Bytes 或 Packets)的任何值。对于需要独立抽样的任何值(如延迟),使用 "Histogram"。

valueField

string

valueField 是流字段,必须用作此指标的值。此字段必须是数字值。如果保留为空,计算流数,而不是每个流的特定值。有关可用字段列表,请参阅相关文档 :https://docs.openshift.com/container-platform/latest/observability/network_observability/json-flows-format-reference.html。

13.1.3. .spec.charts

描述
管理员视图中的 OpenShift Container Platform 控制台图表配置 Dashboards 菜单。
类型
数组

13.1.4. .spec.charts[]

描述
配置与一个指标关联的图表/仪表板的生成
类型
object
必填
  • dashboardName
  • queries
  • title
  • type
属性类型描述

dashboardName

string

包含仪表板的名称。如果此名称没有引用现有仪表板,则会创建一个新仪表板。

queries

数组

要在此图表中显示的查询列表。如果 typeSingleStat,并提供了多个查询,则在多个面板中会自动扩展此图表(每个查询一个)。

sectionName

string

包含仪表板部分的名称。如果此名称没有引用现有部分,则会创建一个新部分。如果省略 sectionName 或为空,则图表被放置在全局 top 部分中。

title

string

图表的标题。

type

string

图表的类型。

unit

string

此图表的单元。目前只支持几个单元。如果保留为空,则使用通用数字。

13.1.5. .spec.charts[].queries

描述
要在此图表中显示的查询列表。如果 typeSingleStat,并提供了多个查询,则在多个面板中会自动扩展此图表(每个查询一个)。
类型
数组

13.1.6. .spec.charts[].queries[]

描述
配置 PromQL 查询
类型
object
必填
  • 图例
  • promQL
  • top
属性类型描述

图例

string

适用于此图表中每个时间序列的查询图例。显示多个时间序列时,您应该设置一个可区分每个时间序列的图例。它可以使用以下格式:{{ Label }}。例如,根据每个标签的 promQL 组时间序列,如 sum(rate($METRIC[2m])) by (Label1, Label2), you might write as the legend: Label1={{ Label1 }}, Label2={{ Label2 }}

promQL

string

要针对 Prometheus 运行 promQL 查询。如果图表 typeSingleStat,则此查询应只返回单个时间序列。对于其他类型,会显示前 7 个。您可以使用 $METRIC 来引用此资源中定义的指标。例如:sum(rate($METRIC[2m]))。如需了解更多有关 promQL 的信息,请参阅 Prometheus 文档 :https://prometheus.io/docs/prometheus/latest/querying/basics/

top

整数

每个时间戳显示的最大 N 系列。不适用于 SingleStat 图表类型。

13.1.7. .spec.filters

描述
filters 是用于限制考虑哪些流的字段和值列表。通常,需要使用这些过滤消除重复项:Duplicate != "true"FlowDirection = "0"有关可用字段列表,请参阅相关文档 :https://docs.openshift.com/container-platform/latest/observability/network_observability/json-flows-format-reference.html。
类型
数组

13.1.8. .spec.filters[]

描述
类型
object
必填
  • field
  • matchType
属性类型描述

field

string

要过滤的字段名称

matchType

string

要应用的匹配类型

value

string

要过滤的值。当 matchTypeEqualNotEqual 时,您可以使用带有 $(SomeField) 的字段注入来引用流的任何其他字段。

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.