<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                一、Exporter概述 &nbsp;&nbsp;&nbsp;&nbsp;1.1 是什么? &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;所有可以向Prometheus提供監控樣本數據的程序都可以被稱為一個Exporter。而Exporter的一個實例稱為target,如下所示Prometheus通過輪詢的方式定期從這些target中獲取樣本數據: ![](https://img.kancloud.cn/a9/fa/a9fa538a1ec3d2860e594479775ba311_465x176.png) 安裝好后的Exporter會暴露一個http服務,通過Prometheus添加配置,就可以采集到這個http服務的所有監控樣本數據 <hr> &nbsp;&nbsp;&nbsp;&nbsp;1.2 有什么用? &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Prometheus 已經成為云原生應用監控行業的標準,在很多流行的監控系統中都已經實現了Prometheus的監控接口,例如etcd、Kubernetes、CoreDNs等,它們可以直接被Prometheus監控,但大多數監控對象都沒辦法直接提供監控接口,主要原因有。很多系統在Prometheus誕生之前的很多年就已經發布了,例如MySQL和Redis等。它們本身不支持HTTP接口,例如對于硬件性能指標,操作系統并沒有原生的HTTP接口可以獲取。 。考慮到安全性,穩定性以及代碼耦合等因素的影響,軟件作者并不愿意將監控代碼加入現有的代碼中。 這些都導致無法通過一個規范解決所有監控問題。在此背景之下,Exporter應運而生Exporter 是一個采集監控數據并通過 Prometheus 監控規范對外提供數據的組件。除了官方實現的Exporter如Node Exporter、HAProxyExporter、MySQLserver Exporter,還有很多第三方實現如Redis Exporter和RabbitMQ Exporter等。 ![](https://img.kancloud.cn/4a/76/4a76cf53094e447c3a43a8685b184906_495x290.png) <hr> 二、Exporter的來源 &nbsp;&nbsp;&nbsp;&nbsp;社區提供的: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.Prometheus社區提供了豐富的Exporter實現,溺蓋了從基礎設施,中間件以及網絡等各個方面的監控功能。例如:Node Exporter,MySQLExporter,Fluentd Exporter2.官方文檔鏈接:https://prometheus,io/docs/instrumenting/exporters/ &nbsp;&nbsp;&nbsp;&nbsp;用戶自定義的: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.除了可以使用社區提供的Exporter程序外,用戶可以基于Prometheus提供的ClientLibrary創建自己的Exporter程序。 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2.這里給出Client Go的鏈接:https://github.com/prometheus/client_golang <hr> 三、Exporter的類型 &nbsp;&nbsp;&nbsp;&nbsp;1.直接采集型T &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;這類Exporter直接內置了相應的應用程序,用于向Prometheus直接提供Target數據支持。這樣設計的好處是,可以更好地監控各自系統的內部運行狀態,同時也適合更多自定義監控指標的項目實施。例如cAdvisor、Kubernetes等,它們均內置了用于向Prometheus提供監控數據的端點。 &nbsp;&nbsp;&nbsp;&nbsp;2.間接采集型 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;原始監控日標并不直接支持Prometheus,需要我們使用Prometheus提供的Client Library編寫該監控目標的監控采集程序,用戶可以將該程序獨立運行,去獲取指定的各類監控數據值。例如,由于Linux操作系統自身并不能直接支持Prometheus,用戶無法從操作系統層面上直接提供對Prometheus的支持,因此單獨安裝Nodeexporter,還有數據庫或網站HTTP應用類等Exporter。 <hr/> 四. Exporter獲取監控數據的方式 &nbsp;&nbsp;&nbsp;&nbsp;1.HTTP/HTTPS方式。例如RabbitMQexporter通過RabbitMQ的HTTPS接囗獲取監控數據。 &nbsp;&nbsp;&nbsp;&nbsp;2.TCP方式,例如Redis exporter通過Redis提供的系統監控相關命令獲取監控指標MvSQLserver exporter誦過MVSQL開發的監控相關的表獲取監控指標。 &nbsp;&nbsp;&nbsp; 3.本地文件方式。例如Node exporter通過讀取proc文件系統下的文件,計算得到整個作系統的狀態。 &nbsp;&nbsp;&nbsp;&nbsp;4.標準協議方式 <hr> 五、Exporter的規范 &nbsp;&nbsp;&nbsp;&nbsp;Prometheus 在面對眾多繁雜的監控對象時并沒有采用逐一適配的方式,而是制定了一套獨特的監控數據規范,符合這套規范的監控數據都可以被Prometheus統一采集、分析和展現。 所有的Exporter程序都需要按照Prometheus的規范,返回監控的樣本數據。以NodeExporter為例,當訪問/metrics地址時會返回以下內容 ![](https://img.kancloud.cn/9f/b3/9fb365a004d527c0f0082c59f38eeb42_450x119.png) &nbsp;&nbsp;&nbsp;&nbsp;Exporter返回的樣本數據,主要由三個部分組成:樣本的一般注釋信息(HELP),樣本的類型注釋信息(TYPE)和樣本。Prometheus會對Exporter響應的內容逐行解析 。如果當前行以# HELP開始,Prometheus將會按照以下規則對內容進行解析,得到當前的指標名稱以及相應的說明信息:#HELP<metrics_name><doc_string> 如果當前行以#TYPE開始,Prometheus會按照以下規則對內容進行解析,得到當前的指標名稱以及指標類型:#TYPE<metrics nammetrics type> 除了# 開頭的所有行都會被視為是監控樣本數據每一行樣本需要滿足以下格式規范: ![](https://img.kancloud.cn/14/e1/14e175852545261dacb43ff6e12a335e_451x73.png) &nbsp;&nbsp;&nbsp;&nbsp;其中merric_name和label_name必須遵循PromQL的格式規范要求。value是一個foat格式的數據,timestamp的類型為int64(從1970-01-0100:00:00以來的毫秒數),timestamp為可選默認為當前時間。具有相同metric_name的樣本必須按照一個組的形式排列,并且每一行必須是唯一的指標名稱和標簽鍵值對組合。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看