在集群中啟用監視功能,則有兩種方法可以收集有關Kibana的指標
舊版收集方法
kibaba通過定時請求ES集群API,獲取ES指標數據,將數據保存到ES索引中,然后通過查詢ES索引數據,展示到頁面上
官網文檔:https://www.elastic.co/guide/en/kibana/7.x/monitoring-kibana.html
流程
1、啟動Kibaban服務,打開監控菜單,使用內部收集
2、選擇打開Monitoring即可
3、等待Kibana進行設置
1)主要是會打開es集群的 xpack.monitoring.collection.enabled 設置
即啟動監控收集,此值默認是false
1 GET _cluster/settings 2 3 PUT _cluster/settings 4 { 5 "persistent": { 6 "xpack.monitoring.collection.enabled": true 7 } 8 }
2)還有kibana監控設置
monitoring.enabled:是否開啟監控,默認值為ture
monitoring.kibana.collection.enabled:是否開啟kibana監控收集,默認值為true
monitoring.ui.elasticsearch.hosts:指定存儲監視數據的Elasticsearch集群的位置,默認值為:與elasticsearch.hosts相同
monitoring.ui.elasticsearch.username:指定存儲監視數據的Elasticsearch集群的用戶名,默認值為:elasticsearch.username
設置的值
monitoring.ui.elasticsearch.password:指定存儲監視數據的Elasticsearch集群的密碼,默認值為:與elasticsearch.password相同
4、完成之后,會在ES中創建2個索引,用來存儲監控數據
5、完成之后,自動進入概覽,可以看到系統概覽、節點信息、索引信息等
6、概覽中包含了,
反映查詢指標:搜索率、搜索延遲、
反映插入指標:索引率、索引延遲
使用Metricbeat收集監視數據(推薦)
在6.5及更高版本中,可以使用Metricbeat收集有關Elasticsearch的數據並將其發送到監視集群,而不是按照Legacy收集方法中所述通過導出器進行路由。
流程:
1、啟用監視數據收集。
在生產集群上設置xpack.monitoring.collection.enabled
為true
。默認情況下,它是禁用的(false
)。
1 GET _cluster/settings 2 3 PUT _cluster/settings 4 { 5 "persistent": { 6 "xpack.monitoring.collection.enabled": true 7 } 8 }
2、在生產集群中的每個Elasticsearch節點上安裝Metricbeat。
3、在每個Elasticsearch節點上的Metricbeat中啟用Elasticsearch X-Pack模塊。
例如,要在modules.d
目錄中啟用默認配置,請運行以下命令:
命令:metricbeat modules enable elasticsearch-xpack
4、在每個Elasticsearch節點上的Metricbeat中配置Elasticsearch X-Pack模塊。
編輯modules.d/elasticsearch-xpack.yml文件,設置:
命令:vim modules.d/elasticsearch-xpack.yml
1 - module: elasticsearch 2 metricsets: 3 - ccr 4 - cluster_stats 5 - index 6 - index_recovery 7 - index_summary 8 - ml_job 9 - node_stats 10 - shard 11 - enrich 12 period: 10s 13 hosts: ["http://localhost:9200"] 14 #username: "user" 15 #password: "secret" 16 xpack.enabled: true
5、可選:在Metricbeat中禁用系統模塊。
命令:metricbeat modules disable system
6、確定將監視數據發送到哪里。編輯metricbeat.yml文件
命令:vim metricbeat.yml
1 output.elasticsearch: 2 # Array of hosts to connect to. 3 hosts: ["http://es-mon-1:9200", "http://es-mon2:9200"] 4 5 # Optional protocol and basic auth credentials. 6 #protocol: "https" 7 #username: "elastic" 8 #password: "changeme"
7、啟動metricbeat程序,ES增加索引:.monitoring-es-7-mb-2020.06.28
8、在kibana監控中,查看監控信息