prometheus - 在普罗米修斯上如何根据特定标签提取指标
问题描述
团队,
我形成了一个查询,也有结果,但无法通过标签过滤它。
我想根据 mountpoint / 和 /raid 进一步过滤我的结果。我该怎么做?询问
(kube_pod_info{namespace="monitoring",node=~"(team|wkr).*"}
*
on(pod) group_right(node)
(
max by(instance, namespace, pod, device, mountpoint) (
(
node_filesystem_size_bytes{fstype=~"ext[234]|btrfs|xfs|zfs"}
-
node_filesystem_avail_bytes{fstype=~"ext[234]|btrfs|xfs|zfs"}
)
/
node_filesystem_size_bytes{fstype=~"ext[234]|btrfs|xfs|zfs"}
)
))
输出
{device="/dev/sdb1",instance="101.1.1.1:1401",mountpoint="/raid",namespace="monitoring",node="team11",pod="prometheus-node-exporter-dcp-173-4l2dr"}
{device="/dev/sdb1",instance="101.1.1.1:1401",mountpoint="/",namespace="monitoring",node="team11",pod="prometheus-node-exporter-dcp-173-4l2dr"}
我正在使用的工作如下
yes want to see based on either of those two [/ or /raid] like using grep on results obtained..but i figure out a work around by setting them in expression itself like below
```node_filesystem_size_bytes{fstype=~"ext[234]|btrfs|xfs|zfs", mountpoint="/raid"`
如此完整的表达将是
(kube_pod_info{namespace="monitoring",node=~"(team|wkr).*"}
*
on(pod) group_right(node)
(
max by(instance, namespace, pod, device, mountpoint) (
(
node_filesystem_size_bytes{fstype=~"ext[234]|btrfs|xfs|zfs",mountpoint="/raid"}
-
node_filesystem_avail_bytes{fstype=~"ext[234]|btrfs|xfs|zfs",mountpoint="/raid"}
)
/
node_filesystem_size_bytes{fstype=~"ext[234]|btrfs|xfs|zfs",mountpoint="/raid"}
)
))
解决方案
推荐阅读
- debezium - 是否可以为每个 postgres 表定义不同的 Reroute.key.field.name ?
- apache-kafka - 由于在 JAAS 或 Kafka 配置中未定义服务名称,因此无法使用 kafka 镜像制造商
- python - 无缓冲的 Socat
- python - Python编程,Zybooks意想不到的人物传奇
- assembly - 你可以在 MIPS 中使用多个 BEQ 语句吗?
- php - PHP 使用 Guzzle 获取 JSON Web Token
- sql - 使用 T-SQL 将多行转换为不聚合的多列
- linux-kernel - Fusion F07A-0114-01 触摸屏重置控制器未在 i.MX6 SoC 4.14.98 内核中正确初始化?
- python - 拟合模型时 keras 列表索引超出范围
- linux - ALSA dsnoop 导致 GStreamer 视频出现问题