如何设置Loki、Grafana和Prometheus


文档摘要

如何设置Loki、Grafana和Prometheus 安装Helm 安装Helm链接 安装Prometheus Operator 暴露服务 如果使用minikube 如果在本地 获取用户名和密码 安装Loki 若要有持久化的磁盘空间,请添加选项 --set loki.persistence.enabled=true: Loki堆栈 在Grafana中获取日志 安装Fluentd 添加S3服务以将日志推送到S3 日志记录 - Fluentd Fluentd 文档 配置文件由以下指令组成 source指令确定输入源。 match指令确定输出目的地。 filter指令确定事件处理管道。 system指令设置全局配置。 label指令对输出和过滤器进行分组,用于内部路由。

如何设置Loki、Grafana和Prometheus

helm install prom-op stable/prometheus-operator --namespace monitoring \ --set prometheus.service.type=NodePort \ --set grafana.service.type=NodePort \ --set commonLabels.prometheus=prom-op \ --set prometheus.prometheusSpec.serviceMonitorSelector.matchLabels.prometheus=prom-op
  • 暴露服务

    • 如果使用minikube minikube service loki --url --namespace=monitoring
    • 如果在本地 kubectl port-forward --namespace=monitoring svc/loki-grafana 3000:80
  • 获取用户名和密码

kubectl get secret --namespace monitoring prom-op-grafana -o yaml

  • 安装Loki
helm repo add loki https://grafana.github.io/loki/charts helm repo update helm install loki/loki --name loki --namespace monitoring

若要有持久化的磁盘空间,请添加选项 --set loki.persistence.enabled=true:

--namespace monitoring \ --set loki.persistence.enabled=true
  • Loki堆栈
To have persistent disk space, add the option --set loki.persistence.enabled=true: $ helm upgrade --install loki loki/loki-stack \ --namespace monitoring \ --set loki.persistence.enabled=true
  • 在Grafana中获取日志

  • 安装Fluentd

    • 添加S3服务以将日志推送到S3

日志记录 - Fluentd

  1. source指令确定输入源。
  2. match指令确定输出目的地。
  3. filter指令确定事件处理管道。
  4. system指令设置全局配置。
  5. label指令对输出和过滤器进行分组,用于内部路由。
  6. @include指令包含其他文件。

声明:
本文件灏天文库团队进行了翻译。尽管我们力求准确,但请注意,翻译可能包含错误或不准确之处。原文档以其原始语言为准。我们不对因使用此翻译而产生的任何误解或误译负责。


发布者: 作者: 转发
评论区 (0)
U