PromQL指标查询返回了我想要的其他指标

时间:2018-12-12 17:45:33

标签: kubernetes prometheus promql

我一定还不了解PromQL,但是我读到的所有内容都表明此查询应该可以正常工作:

node_cpu

真的很简单吧?指标的名称,并且确实将其添加到结果集中。

  

node_cpu {app =“ prometheus”,chart =“ prometheus-6.2.1”,component =“ node-exporter”,cpu =“ cpu0”,heritage =“ Tiller”,instance =“ 10.85.166.16:9100” ,io_cattle_field_appId =“ prometheus”,job =“ kubernetes-service-endpoints”,kubernetes_name =“ prometheus-node-exporter”,kubernetes_namespace =“ prometheus”,mode =“ guest_nice”,release =“ prometheus”} 0   node_cpu {app =“ prometheus”,图表=“ prometheus-6.2.1”,component =“ node-exporter”,cpu =“ cpu0”,heritage =“ Tiller”,instance =“ 10.85.166.16:9100”,io_cattle_field_appId = “ prometheus”,job =“ kubernetes-service-endpoints”,kubernetes_name =“ prometheus-node-exporter”,kubernetes_namespace =“ prometheus”,mode =“ idle”,release =“ prometheus”} 1784679.96

     

node_cpu {app =“ prometheus”,chart =“ prometheus-6.2.1”,component =“ node-exporter”,cpu =“ cpu0”,heritage =“ Tiller”,instance =“ 10.85.166.16:9100” ,io_cattle_field_appId =“ prometheus”,job =“ kubernetes-service-endpoints”,kubernetes_name =“ prometheus-node-exporter”,kubernetes_namespace =“ prometheus”,mode =“ iowait”,release =“ prometheus”} 2897.73

但是我还有很多其他不需要的指标:

  

kubelet_runtime_operations_latency_microseconds_count {beta_kubernetes_io_arch =“ amd64”,beta_kubernetes_io_os =“ linux”,instance =“ la-1pk8s-w4”,job =“ kubernetes-nodes”,kubernetes_io_hostname =“ la-1pk8_ro_work_node” ,operation_type =“ image_status”}

     

container_start_time_seconds {beta_kubernetes_io_arch =“ amd64”,beta_kubernetes_io_os =“ linux”,id =“ / docker / 8effa9b35affbf17118e7cc83a586d70da9fa960097ab717076c7251bf4eb324”,image =“ rancher / rke-1,sins-pks,8s-pkins,8 job =“ kubernetes-nodes-cadvisor”,kubernetes_io_hostname =“ la-1pk8s-w2”,name =“ rke-log-linker-nginx-proxy”,node_role_kubernetes_io_worker =“ true”}

     

storage_operation_duration_seconds_bucket {beta_kubernetes_io_arch =“ amd64”,beta_kubernetes_io_os =“ linux”,instance =“ la-1pk8s-w4”,job =“ kubernetes-nodes”,kubernetes_io_hostname =“ la-1pk8s-w4”,le =“ 0.1” ,node_role_kubernetes_io_worker =“ true”,operation_name =“ volume_unmount”,volume_plugin =“ kubernetes.io/configmap”}

不确定他们为什么在那里,很奇怪。因此,我认为我将过滤标签component =“ node-exporter”,因为该标签仅存在于我想要的指标中。

node_cpu {component =“ node-exporter”}}产生相同的结果集。

node_cpu {component =〜“ node-exporter”}}产生相同的结果集。

为什么我不能只获取所有的node_cpu指标,为什么过滤不起作用?谢谢。

1 个答案:

答案 0 :(得分:0)

这是2.3.0中已修复的错误,或者您的remote_read返回了不良结果。