promql

PromQL query to find the duration of each firing alert

佐手、 提交于 2020-12-15 06:09:27
问题 I am creating a Grafana dashboard to see the total alert count for each firing alert and the duration ( means it should capture how long alerts have been firing state). PromQL query used to capture the total alert count is as follows, count by (alertname,customerName) (changes(customer_ALERTS[24h])) Idea is to add two more column in the Grafana table panel having the alert count and the duration Now i need to get the query to capture the duration for each alerts. Can somebody please share

Prometheus queries to get CPU and Memory usage in kubernetes pods

♀尐吖头ヾ 提交于 2020-12-12 04:03:05
问题 I need to get CPU and Memory usage in kubernetes pods with prometheus queries. Can someone plz help? 回答1: Do you use prometheus-operator to collect data from kubernetes? If yes, you can use something like this: sum(container_memory_usage_bytes) sum(container_cpu_usage_seconds_total) Just for example. 回答2: For CPU percentage avg((sum (rate (container_cpu_usage_seconds_total {container_name!="" ,pod="<Pod name>" } [5m])) by (namespace , pod, container ) / on (container , pod , namespace) ((kube

Prometheus queries to get CPU and Memory usage in kubernetes pods

坚强是说给别人听的谎言 提交于 2020-12-12 04:02:46
问题 I need to get CPU and Memory usage in kubernetes pods with prometheus queries. Can someone plz help? 回答1: Do you use prometheus-operator to collect data from kubernetes? If yes, you can use something like this: sum(container_memory_usage_bytes) sum(container_cpu_usage_seconds_total) Just for example. 回答2: For CPU percentage avg((sum (rate (container_cpu_usage_seconds_total {container_name!="" ,pod="<Pod name>" } [5m])) by (namespace , pod, container ) / on (container , pod , namespace) ((kube

Prometheus queries to get CPU and Memory usage in kubernetes pods

六眼飞鱼酱① 提交于 2020-12-12 04:01:03
问题 I need to get CPU and Memory usage in kubernetes pods with prometheus queries. Can someone plz help? 回答1: Do you use prometheus-operator to collect data from kubernetes? If yes, you can use something like this: sum(container_memory_usage_bytes) sum(container_cpu_usage_seconds_total) Just for example. 回答2: For CPU percentage avg((sum (rate (container_cpu_usage_seconds_total {container_name!="" ,pod="<Pod name>" } [5m])) by (namespace , pod, container ) / on (container , pod , namespace) ((kube

PromQL to graph number of Kubernetes PODs created per Hour

﹥>﹥吖頭↗ 提交于 2020-08-24 10:21:07
问题 I'm using Kubernetes with kube-state-metrics and Prometheus/grafana to graph various metrics of the Kubernetes Cluster. Now I'd like to Graph how many new PODs have been created per Hour over Time. The Metric kube_pod_created contains the Creation-Timestamp as Value but since there is a Value in each Time-Slot, the following Query also returns Results >0 for Time-Slots where no new PODs have been created: count(rate(kube_pod_created[1h])) by(namespace) Can I use the Value in some sort of

PromQL to graph number of Kubernetes PODs created per Hour

倾然丶 夕夏残阳落幕 提交于 2020-08-24 10:21:03
问题 I'm using Kubernetes with kube-state-metrics and Prometheus/grafana to graph various metrics of the Kubernetes Cluster. Now I'd like to Graph how many new PODs have been created per Hour over Time. The Metric kube_pod_created contains the Creation-Timestamp as Value but since there is a Value in each Time-Slot, the following Query also returns Results >0 for Time-Slots where no new PODs have been created: count(rate(kube_pod_created[1h])) by(namespace) Can I use the Value in some sort of

PromQL to graph number of Kubernetes PODs created per Hour

限于喜欢 提交于 2020-08-24 10:20:54
问题 I'm using Kubernetes with kube-state-metrics and Prometheus/grafana to graph various metrics of the Kubernetes Cluster. Now I'd like to Graph how many new PODs have been created per Hour over Time. The Metric kube_pod_created contains the Creation-Timestamp as Value but since there is a Value in each Time-Slot, the following Query also returns Results >0 for Time-Slots where no new PODs have been created: count(rate(kube_pod_created[1h])) by(namespace) Can I use the Value in some sort of

Prometheus - Aggregate and relabel by regex

天涯浪子 提交于 2020-04-10 04:09:31
问题 I currently have the following Promql query which allow me to query the memory used by each of my K8S pods: sum(container_memory_working_set_bytes{image!="",name=~"^k8s_.*"}) by (pod_name) The pod's name is followed by a hash defined by K8S: weave-net-kxpxc weave-net-jjkki weave-net-asdkk Which all belongs to the same app: weave-net What I would like is to aggregate the memory of all pods which belongs to the same app. So, the query would sum the memory of all weave-net pods and place the

Label replace over a range vector in Prometheus

一个人想着一个人 提交于 2020-03-25 16:11:20
问题 I want to find the sum number of alerts for all the pods starting with "sendsms" over 10minutes. I am able to do use label_replace() to do this on the instant vector. But when i want to do this for over 10 minutes data, it cannot work as label_replace only works on instant vector. Explaining the problem with an example: ALERTS{alertname="CPUThrottlingHigh",pod="sendsms-dbed"} 10 ALERTS{alertname="CPUThrottlingHigh",pod="sendsms-ebed"} 20 ALERTS{alertname="CPUThrottlingHigh",pod="sendsms-fbed"