no data as zero And to solve this, you just need to add OR on() vector(0) to the end of your expression. It will return 0 if the metric expression does not return anything
vector(1) for : 0m labels : severity : critical annotations : summary : prometheus alertmanager e2e dead man switch (instance { { $labels.instance } } ) description : "prometheus deadmanswitch is an always-firing alert. it's used as an end-to-end test of prometheus through the ...
Job Active count(kube_job_status_active{cluster="$cluster",namespace="$namespace"}==1)or on() vector(0) kube_job_status_active kube-state-metrics Cron Job Created count(kube_cronjob_created{cluster="$cluster",namespace="$namespace"}) or on() vector(0) kube_cronjob_created kube-state...
max_over_time(kafka_consumer_fetch_manager_records_consumed_total{client_id="client_id",container="app",endpoint="http",instance="instance",job="job",kafka_version="3.7.0",kubernetes_namespace="engineering",kubernetes_pod_name="kubernetes_pod_name",namespace="engineering",pod="kubernetes_pod_n...
expr: (count(redis_instance_info{role="master"}) or vector(0)) < 1 for: 5m labels: severity: critical annotations: summary: Redis missing master (instance {{ $labels.instance }}) description: Redis cluster has no node marked as master.\n VALUE = {{ $value }}\n LABELS: {{ $labels...
目前,Prometheus 支持以下集合运算符:and or unless vector1 and vector2 会产生一个由 vector1 的元素组成的新的向量。该向量包含 vector1 中完全匹配 vector2 中的元素组成。 vector1 or vector2 会产生一个新的向量,该向量包含 vector1 中所有的样本数据,以及 vector2 中没有与 vector1 匹配到的样本数据...
or (或者) unless (排除) vector1 and vector2会产生一个由 vector1 的元素组成的新的向量。该向量包含 vector1 中完全匹配 vector2 中的元素组成。 vector1 or vector2会产生一个新的向量,该向量包含 vector1 中所有的样本数据,以及 vector2 中没有与 vector1 匹配到的样本数据。
- alert: PrometheusAlertmanagerE2eDeadManSwitch// 告警规则名称expr:vector(1)// 匹配规则,表达式for:0m// 检测持续时间,表示持续一分钟获取不到信息,则触发报警。0表示不使用持续时间labels:// 定义当前告警规则级别severity: critical// 指定告警级别annotations:// 注释 告警通知// 调用标签具体指附加通知信息su...
瞬时数据(Instant vector):一个时序只有一个点,例如:http_requests_total 区间数据(Range vector):一个时序有多个点,例如:http_requests_total[5m] 纯量数据(Scalar):纯量只有一个数字,没有时序,例如:count(http_requests_total) 2.2 查询语句 1):条件查询:=、!=、=、!,如:http_requests_total{code=~"2...
和Instant vector selectors 相应的,还有一种选择器,叫做 Range vector selectors,它可以查出一段时间内的所有数据: http_requests_total[5m] 这条语句查出 5 分钟内所有抓取的 HTTP 请求数,注意它返回的数据类型是 Range vector,没办法在 Graph 上显示成曲线图,一般情况下,会用在 Counter 类型的指标上,并和 rat...