极客时间运维进阶训练营第七周作业
Mandatory
了解 Prometheus 各组件的功能,熟悉 Prometheus 的数据采集流程
基于 Docker 或二进制部署 Prometheus Server
基于 Docker 或二进制部署 node-exporter,并通过 Prometheus 收集 node-exporter 指标数据
安装 Grafana 并添加 Prometheus 数据源,导入模板可以图形显示指标数据
掌握 Prometheus 的 PromQL 语句的简单使用
部署 Prometheus 联邦集群并实现指标数据收集
Prometheus Introduction
Monitoring
The value of monitoring system
Monitoring type
Process
Prometheus
Introduction
Architecture
Data collection flow
TSDB
Install Prometheus and node-exporter on K8s
Check K8s cluster status
Add prometheus Helm repo
Deploy prometheus
Check the installation
Forward port and check UI
Install Grafana on K8s
Install
Check deployment
Access UI
Config Grafana
Add "Prometheus" data source
Install template
Check Dashboard
PromQL Statement
Introduction
Official documentation: https://prometheus.io/docs/prometheus/latest/querying/basics/
Instance vector
Range vector
scalar
Others
tag matching
Time range
Operator
Aggregate
Prometheus Fedaration for K8s
Introduction
Install the Prometheus Operator on each cluster
Ref: https://github.com/kemilad/prometheus-federation-and-thanos-k8s-webinar
Add the Bitnami charts repository to Helm:
helm repo add bitnami https://charts.bitnami.com/bitnami
Install the Prometheus Operator in the first “data producer” cluster using the command below:
Then get the sidecar service public ip address:
Do the same thing for your second data producer cluster.
Install and configure Thanos
Get the
values.yaml
file in this repository; do the correct configurations according to that file.Install Thanos using the command below:
Wait for the deployment to complete and note the DNS name and port number for the Thanos Querier service in the deployment output.
Follow the instructions according to that output and check it on your browser.
Configure Grafana to use Thanos as a data source
From the Grafana dashboard, click the “Add data source” button.
On the “Choose data source type” page, select “Prometheus”.
On the “Settings” page, set the URL for the Prometheus server to http://NAME:PORT, where NAME is the DNS name for the Thanos service obtained at the end of Step 2 and PORT is the corresponding service port. Leave all other values at their default.
Click “Save & Test” to save and test the configuration. If everything is configured correctly, you should see a success message.
Optional
Prometheus pushgateway
Introduction
Pod YAML
Install
Reference: https://kb.novaordis.com/index.php/Prometheus_Pushgateway_Installation
版权声明: 本文为 InfoQ 作者【9527】的原创文章。
原文链接:【http://xie.infoq.cn/article/22c723a56e01886e44a684333】。文章转载请联系作者。
评论