Kubernetes運維生態-cAdvisor分析


Kubernetes的生態中,cAdvisor是作為容器監控數據采集的Agent,其部署在每個節點上,內部代碼結構大致如下:代碼結構很良好,collector和storage部分基本可做到增量擴展開發。

關於cAdvisor支持自定義指標方式能力,其自身是通過容器部署的時候設置lable標簽項:io.cadvisor.metric.開頭的lable,而value則為自定義指標的配置文件,形如下:

{
  "endpoint" : {
    "protocol": "https",
    "port": 8000,
    "path": "/nginx_status"
  },
  "metrics_config"  : [
    { "name" : "activeConnections",
      "metric_type" : "gauge",
      "units" : "number of active connections",
      "data_type" : "int",
      "polling_frequency" : 10,
      "regex" : "Active connections: ([0-9]+)"
    },
    { "name" : "reading",
      "metric_type" : "gauge",
      "units" : "number of reading connections",
      "data_type" : "int",
      "polling_frequency" : 10,
      "regex" : "Reading: ([0-9]+) .*"
    },
    { "name" : "writing",
      "metric_type" : "gauge",
      "data_type" : "int",
      "units" : "number of writing connections",
      "polling_frequency" : 10,
      "regex" : ".*Writing: ([0-9]+).*"
    },
    { "name" : "waiting",
      "metric_type" : "gauge",
      "units" : "number of waiting connections",
      "data_type" : "int",
      "polling_frequency" : 10,
      "regex" : ".*Waiting: ([0-9]+)"
    }
  ]

}

當前cAdvisor只支持http接口方式,也就是被監控容器應用必須提供http接口,所以能力較弱,如果我們在collector這一層做擴展增強,提供數據庫,mq等等標准應用的監控模式是很有價值的。在此之前的另一種方案就是如上圖所示搭配promethuese(其內置有非常豐富的標准應用的插件涵蓋了APM所需的采集大部分插件),但是這往往會導致系統更復雜(如果應用層並非想使用promethuse)

在Kubernetes監控生態中,一般是如下的搭配使用:

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM