<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國際加速解決方案。 廣告
                [TOC] 安裝好grafana并不能直接看到監控數據,需要自行設置dashboard或plugins。 展示 `kubernetes`、`ingress-nginx-controller` 和 `etcd` 三個組件的漂亮的儀表盤。 ## kubernetes 這個使用的是現成的插件(devopsprodigy-kubegraf-app),不需要寫dashboard文件內容。只需要導入證書和填寫服務器信息即可。 > 要求: > 1. Grafana > 5.0.0 > 2. Prometheus + node-exporter + kube-state-metrics (version >= 1.4.0) > 3. Grafana-piechart-panel 1. 安裝插件 - **在線安裝** 登錄容器,下載插件 grafana-cli plugins install devopsprodigy-kubegraf-app - **離線安裝** 在grafana的主機,找到數據目錄($PATH/plugins) kubectl -n kube-mon cp grafana-piechart-panel/ grafana-6dcb54fd8d-2zw9f:/var/lib/grafana/plugins/ kubectl -n kube-mon cp devopsprodigy-kubegraf-app grafana-6dcb54fd8d-2zw9f:/var/lib/grafana/plugins/ > 上面兩種方法安裝,都是需要重啟grafana容器的。 > kubectl -n kube-mon delete pod -l app=grafana 2. 配置插件 Ⅰ 配置數據源 ![](https://img.kancloud.cn/b5/22/b522083056aa53b01fb0c6e092a5d2c3_1299x553.png) ![](https://img.kancloud.cn/d3/af/d3af3fa6217bd2ea4c60ec7873cac7af_1190x455.png) ![](https://img.kancloud.cn/c6/aa/c6aa89b6ce02f3a83449e9402131639f_1234x628.png) ![](https://img.kancloud.cn/ad/f6/adf656973646d31a82414895351c5d4a_1300x789.png) > 注意:如果promtheus有添加上下文的話,URL也需要添加上對應的上下文。 Ⅱ 啟動插件 ![](https://img.kancloud.cn/a7/2c/a72c3474dcdfc57a4ae80b0cd672947a_1299x712.png) ![](https://img.kancloud.cn/7d/77/7d771658fceddaecee904beeced18144_1301x724.png) ![](https://img.kancloud.cn/c2/5f/c25f3303c98a846b11851db04a4f9714_976x607.png) Ⅲ 配置插件 ![](https://img.kancloud.cn/a0/18/a018d66f1f4e3f919ba21a550565d854_1253x668.png) ![](https://img.kancloud.cn/de/d8/ded886595afbf46ba5cdf2bc27004d3b_1283x405.png) ![](https://img.kancloud.cn/cc/9a/cc9a8f14ea16ca91ec9c976134e39d91_1289x554.png) ![](https://img.kancloud.cn/36/0f/360fd95f05a6707b15ab27b5ae12d77d_1215x823.png) ![](https://img.kancloud.cn/8e/53/8e5319a03373f5e2bd0d1324ad3fab1d_1208x575.png) > 獲取上面的數據的方法: > #URL框 > cat /root/.kube/config | grep server | awk '{print $2}' > #CA Cert框 > cat /root/.kube/config | grep certificate-authority-data | awk '{print $2}' | base64 -d > #Client Cert框 > cat /root/.kube/config | grep client-certificate-data | awk '{print $2}' | base64 -d > #Client Key框 > cat /root/.kube/config | grep client-key-data | awk '{print $2}' | base64 -d 保存完后,會跳轉到配置插件頁面。如果沒有出現配置好的集群信息的話,重新刷新一下即可。 Ⅳ 查看儀表盤 ![](https://img.kancloud.cn/1d/ef/1defe553752eb889c61eb2fbceffb219_1920x652.png) ![](https://img.kancloud.cn/84/d5/84d5a42d0858eb5e1ea88d7e82e7607d_1854x699.png) ![](https://img.kancloud.cn/fa/06/fa06ce120aa92301608557b7f3c9fe4c_1920x935.png) ## ingress-nginx-controller 1. 下載官方提供的dashboard文件 下載地址:https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/grafana/dashboards/nginx.json 2. 導入dashboard文件 ![](https://img.kancloud.cn/fc/88/fc888deab9fca8c11e250e7f658e12b5_1920x690.png) ![](https://img.kancloud.cn/3d/cb/3dcb4d1e1fd7f53974685deff9c97b27_1439x829.png) ![](https://img.kancloud.cn/74/85/74854b244a9ae8df2cd8e9cbe4507bde_1297x757.png) 3. 驗證 ![](https://img.kancloud.cn/e5/af/e5af69fa22e7e06fdf794b0edce00615_1840x878.png) ## etcd etcd官網也提供有dashboard文件,不過文件好像有些問題。不能夠直接導入,這里提供一個修改好的文件。請查看附件的章節。 導入方法與 ingress-nginx-controller 的方法一致,這里就不贅述。 ## minio 參考文章:https://docs.min.io/docs/how-to-monitor-minio-using-prometheus.html 1. 將新主機添加到配置文件 ```shell $ mc config host add monitor http://192.168.31.199:9000 admin ak+JLouROYaP Added `monitor` successfully. ``` 2. 查看是否添加成功 ```shell $ mc config host list monitor monitor URL : http://192.168.31.199:9000 AccessKey : admin SecretKey : ak+JLouROYaP API : s3v4 Path : auto ``` 3. 該命令將生成 prometheus.yml 的 scrape_configs 部分 ```shell $ mc admin prometheus generate monitor scrape_configs: - job_name: minio-job bearer_token: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJleHAiOjQ4MDkwNDgyNDksImlzcyI6InByb21ldGhldXMiLCJzdWIiOiJhZG1pbiJ9.oX7aSpbySO8LtHm3PwPQAB1EnHCTfwNY3_LH7B1-YYArCOlbd_4SUY0l2SMIW7_SjpAr_5x3qqEhHNvwOBThuQ metrics_path: /minio/v2/metrics/cluster scheme: http static_configs: - targets: ['192.168.31.199:9000'] ``` > 注意:如果是https協議的話,需要添加取消證書驗證。 4. Prometheus配置添加上面信息 ![](https://img.kancloud.cn/2b/23/2b2320efd0842bc8707d657695451434_1800x176.png) > 重啟加載Prometheus配置文件 `curl -X POST "http://`kubectl -n kube-mon get endpoints prometheus -o jsonpath={.subsets[0].addresses[0].ip}`:9090/prometheus/-/reload"` 5. 驗證 ![](https://img.kancloud.cn/bd/f2/bdf27efdbb9b5f6c00ea7b6c467499b0_1829x206.png) 6. 添加dashboard ![](https://img.kancloud.cn/e0/9d/e09d03ad5beff54bcf760c29bb9e848e_1633x845.png) ![](https://img.kancloud.cn/7d/05/7d0581eb3d8732119808689332bffcea_1745x856.png) > 上圖就是有兩個相同的數據字,提供的json文件有些瑕疵。這里提供一個修改好的文件。請查看附件的章節。 ## ceph 參考文章:https://docs.ceph.com/en/nautilus/mgr/prometheus/ 1. 開通ceph mgr模塊的Prometheus ```shell $ ceph mgr module enable prometheus ``` > 注意:報錯提示 `Error ENOENT: module 'prometheus' reports that it cannot run on the active manager daemon: No module named 'cherrypy' (pass --force to force enablement)`。需要安裝一下cherrypy模塊 `sudo pip3 install cherrypy` 安裝即可 2. 驗證是否開啟成功 ```shell $ ceph mgr module ls | grep -A5 enabled_modules "enabled_modules": [ "iostat", "prometheus", "restful" ], ``` 3. 設置Prometheus暴露地址和端口 ```shell $ ceph config set mgr mgr/prometheus/server_addr 0.0.0.0 $ ceph config set mgr mgr/prometheus/server_port 9283 ``` 4. 驗證設置 ```shell ## ceph config get mgr.主機名 $ ceph config get mgr.ceph02 WHO MASK LEVEL OPTION VALUE RO mgr advanced mgr/prometheus/server_addr 0.0.0.0 * mgr advanced mgr/prometheus/server_port 9283 * $ ceph mgr services { "prometheus": "http://ceph01.ecloud.com:9283/" } ``` 5. Prometheus配置段 ```yaml - job_name: "Ceph" static_configs: - targets: # 所有mgr主機 - 192.168.31.132:9283 - 192.168.31.69:9283 - 192.168.31.177:9283 labels: cluster: production ``` 6. 驗證Prometheus的target ![](https://img.kancloud.cn/c0/06/c0062ce2feaec0dac3049c4b162720e8_1818x218.png) 7. grafana安裝dashboard ![](https://img.kancloud.cn/95/c9/95c9e119f7cc7084de20920c5221fedd_1189x764.png) > 使用 `2842` 的dashboard頁面 8. 驗證dashboard ![](https://img.kancloud.cn/47/00/4700871321a404b598ff3271fa04e29b_1753x863.png) ## 參考文檔 https://grafana.com/grafana/plugins/devopsprodigy-kubegraf-app/ https://kubernetes.github.io/ingress-nginx/user-guide/monitoring/#grafana https://etcd.io/docs/v3.4/op-guide/monitoring/#grafana ## 附件文件 所需的dashboard和plugins文件都放在百度網盤上 > 鏈接:https://pan.baidu.com/s/1bxnNl05F97Il7pZ0sgdRuQ > 提取碼:05eh
                  <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>

                              哎呀哎呀视频在线观看