开启/关闭 监控
配置参数
配置项 | 类型 | 示例 | 描述 |
---|---|---|---|
grafanaLocalNodePort | number | 31380 | grafana 服务端口 |
操作步骤
ONES 配置开启监控
修改配置
进入运行中的 ones 容器
ones-ai-k8s.sh
修改配置
vim config/private.yaml
# 添加如下配置
grafanaLocalNodePort: 31380
monitoringSystemOverlay: "only-local-storage"
fluentOverlay: "common"
应用配置
make setup-monitoring-system
make setup-fluent-bit
示例输出
bash-5.0# make setup-monitoring-system
python3 ./script/python/ones/cmd/setupapp.py --app=monitoring-system --version=v1 --ones-path=
2023-08-11 09:41:03,026 [INFO] ones_path=, k8s_root_dir=/data/ones/ones-ai-k8s
2023-08-11 09:41:03,094 [INFO] render config
2023-08-11 09:41:04,862 [WARNING] /data/ones/ones-ai-k8s/private-overlay-templates/monitoring-system/v1 not found, skip
2023-08-11 09:41:04,862 [INFO] ones_path=, k8s_root_dir=/data/ones/ones-ai-k8s
2023-08-11 09:41:04,930 [INFO] compatible overlay
2023-08-11 09:41:06,691 [INFO] collect dir info
2023-08-11 09:41:06,695 [INFO] setup global resrouces
2023-08-11 09:41:07,804 [INFO] gen registry credentials
2023-08-11 09:41:07,808 [INFO] setup namespace, registry-secret
2023-08-11 09:41:08,202 [INFO] setup local-storage static-pvc, static-pv (cache config to tmp/config.yaml)
storageclass.storage.k8s.io/ones-local-storage unchanged
storageclass.storage.k8s.io/ones-local-storage-mock unchanged
deployment.apps/localstorage-ones-cn-server-node02 unchanged
storageclass.storage.k8s.io/ones-local-storage unchanged
storageclass.storage.k8s.io/ones-local-storage-mock unchanged
2023-08-11 09:41:09,868 [INFO] diff monitoring-system before setup
2023-08-11 09:41:11,709 [INFO] backward compatible
2023-08-11 09:41:11,782 [INFO] setup monitoring-system
2023-08-11 09:41:12,358 [INFO] record latest data
render to tmp/latest-record-setup-app-comfigmap.yaml
render to tmp/date-record-setup-app-comfigmap.yaml
2023-08-11 09:41:13,453 [INFO] remove /data/ones/ones-ai-k8s/tmp
2023-08-11 09:41:13,455 [INFO] setup monitoring-system finish
2023-08-11 09:41:13,455 [INFO] elapsed time: 10.361 seconds
bash-5.0#
验证
直接使用 ONES 服务的 ip + grafanaLocalNodePort 访问 grafana 控制台
如需开启告警(比如邮件),请参考文档 开启/关闭 ALertmanger告警。
ONES 配置关闭监控
关闭监控
进入运行中的 ones 容器
ones-ai-k8s.sh
修改配置 vim config/private.yaml
# 注释如下配置
# grafanaLocalNodePort: 31380
# monitoringSystemOverlay: "only-local-storage"
# fluentOverlay: "common"
关闭监控并删除数据
make delete-monitoring-system RETAIN_DATA=false
kubectl -n monitoring-system patch --type=merge configmap/stream-aggr-vmagent-vmagent -p '{"metadata":{"finalizers":[]}}'
更新 fluent-bit
make setup-fluent-bit