我正在监控 kube-state-metrics pod 指标。我想过滤其中一些,而不是上传到我的Grafana,因为它们太多了。
我的remote_write配置(遵循几个指南,例如this):
remote_write:
- url: https://grafana-host:12345/api/prom/push
basic_auth:
username: myself
password: somePassword
metric_relabel_configs:
- source_labels: [__name__,reason]
regex: "kube_pod_container_status_last_terminated_reason;OOMKilled"
action: keep
当使用 promethues 查询 pod 内的
/metrics
端点时,我可以看到 kube_pod_container_status_last_terminated_reason
及其所有原因,例如:
curl localhost:8080/metrics | grep kube_pod_container_status_last_terminated_reason
产量:
HELP kube_pod_container_status_last_terminated_reason Describes the last reason the container was in terminated state.
# TYPE kube_pod_container_status_last_terminated_reason gauge
kube_pod_container_status_last_terminated_reason{...some other labels...,reason="OOMKilled"} 1
kube_pod_container_status_last_terminated_reason{...some other labels...,reason="Completed"} 1
但是看看我的 Grafana,我仍然看到 both 的指标被报告并且是可查询的,这是我不期望的。
另外一个问题,如果可以的话,有没有办法有逆?在原因标签中保留所有不是“OOMKilled”的东西?
你有行动保持。如果您想删除该时间序列,请使用 action drop。