基於prometheus的監控解決方案

1、前言

    鄙人就任於某安全公司,團隊的定位是研發安全產品雲匯聚平臺,爲用戶提供彈性伸縮的雲安全能力。前段時間產品組提出了一個監控需求,大體要求:平臺對vm實行動態實時監控,輸出相應圖表界面,並提供警報(資源不足等問題而產生)等功能。前端

 

2、方案調研

    通過團隊調研,目前業界流行的監控方案大體有這麼幾種:基於 zabbix 的、基於 prometheus 的、基於 influxdb 等時序數據庫的。結合當前咱們的業務場景來說,zabbix對咱們來講有點重,而 influxdb 方案靈活可是投入的研發時間多是比較多的,prometheus就成了咱們的不二之選擇。mysql

 

 

3、prometheus介紹

    

         1. What is prometheus ?  下面是官網的一段原話:

    Prometheus is an open-source systems monitoring and alerting toolkit originally built at SoundCloud. Since its inception in 2012, many companies and organizations have  adopted Prometheus, and the project has a very active developer and user community. It is now a standalone open source project and maintained independently of any company.To emphasize this, and to clarify the project's governance structure, Prometheus joined the Cloud Native Computing Foundation in 2016 as the second hosted project,after Kubernetes.nginx

    大體就是說  prometheus是一個開源的監控,警報系統,最初呢是構建在SoundCloud之上的。。。而後不少公司組織都在用,活躍的開發者不少,社區也不少,反正很牛逼。。。這樣。git

   

    2.Components

     prometheus大體有這麼幾個組件組成:github

       1). Prometheus server: 用於抓取數據,並存儲到時序數據庫

       2). client librabries:用於一些應用的定製化監控

       3). push gateway:用於短生存週期的job推送

       4). exporter:安裝在監控目標的機子上,爲server提供數據抓取的接口,須要定製化。。固然官網也提供了不少經常使用的exporter ,用於mysql,redis,nginx,宿主機等等等等,有需求的能夠去這裏https://prometheus.io/docs/instrumenting/exporters/看看。

                     5). alertmanager:用於處理警報。

     

    3.架構圖

 

      

        

            應該不須要怎麼介紹了吧,我相信你們均可以看得懂。redis

      

 

 

4、結合業務使用

    有了prometheus這個強大的監控開源系統以後,咱們所須要投入的工做就是查詢api的封裝和配置文件的下發。查詢api的封裝沒什麼好說的,無非就是前端調用咱們本身的server,咱們的   server呢經過http協議去調用prometheus的api接口查詢到原始數據,而後進行組裝,最後返回給前端。 配置文件的話包含三部分吧,警報的定義,alertmanager的配置,以及prometheus的配置,這裏也很差展開講,有興趣的能夠去官網看看,最後給出一張咱們的物理結構示意圖,供你們參考。    sql

相關文章
相關標籤/搜索