AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1122671
Accepted
tholeb
tholeb
Asked: 2023-02-13 05:31:02 +0800 CST2023-02-13 05:31:02 +0800 CST 2023-02-13 05:31:02 +0800 CST

Grafana“已连接数据源,但未收到标签。验证 Loki 和 Promtail 是否已正确配置。”

  • 772

我正在尝试安装 loki,以便我可以在 Grafana 上读取日志,但我一直收到Data source connected, but no labels received. Verify that Loki and Promtail is configured properly.(日志中没有任何内容)。

我在 Raspberry Pi 4 8​​Gb 上为每个服务(grafana、loki、promtail)使用 docker 镜像。

每项服务都正常工作。我可以连接到 Grafana ( localhost:3000) 并查看 node_exporter 数据。我可以连接到 loki 本身并查看指标 ( localhost:3100/metrics),我也可以连接到 promtail ( localhost:9080/targets)。

在 Grafana 上,我尝试将 loki 指向10.88.0.1:3100/metrics(因为 Grafana 是一个 docker 容器,我必须使用它10.88.0.1来连接到主机)但是我收到了一个新错误Unable to fetch labels from Loki (Failed to call resource), please check the server logs for more details

这是我从该错误的日志中得到的:

logger=context userId=1 orgId=1 uname=admin t=2023-02-12T13:21:35.204508553Z level=error msg="Failed to call resource" error="404 page not found\n" traceID=
logger=context userId=1 orgId=1 uname=admin t=2023-02-12T13:21:35.204758623Z level=error msg="Request Completed" method=GET path=/api/datasources/2/resources/labels status=500 remote_addr=192.168.1.20 time_ms=7 duration=7.563973ms size=51 referer=http://raspberry.local:3000/datasources/edit/sgEZvn14k handler=/api/datasources/:id/resources/*

这很奇怪,因为没有/metricsGrafana 确实会找到 loki。

我正在使用 ansible 来配置我的锉刀:

- name: Grafana - Run container using podman
  containers.podman.podman_container:
      name: grafana
      image: grafana/grafana-oss:latest
      state: started
      recreate: true
      restart_policy: on-failure
      ports: "3000:3000"
      memory: "2048m"
      net:
          - host
      volume:
          - "grafana-storage:/var/lib/grafana"

- name: Loki - Run container using podman
  containers.podman.podman_container:
      name: loki
      image: grafana/loki:latest
      state: started
      recreate: true
      restart_policy: on-failure
      ports: "3100:3100"
      memory: "2048m"
      net:
          - host
      volume:
          - "loki-storage:/loki"

- name: Promtail - Run container using podman
  containers.podman.podman_container:
      name: promtail
      image: grafana/promtail:latest
      state: started
      recreate: true
      restart_policy: on-failure
      ports:
          - "9080:9080"
          - "1514:1514"
      memory: "2048m"
      net:
          - host
      volume:
          - "{{ lokiData }}/promtail.yml:/etc/promtail/promtail-config.yml"
      command: -config.file=/etc/promtail/promtail-config.yml

我的 promtail 配置:

server:
    http_listen_port: 9080
    grpc_listen_port: 0

positions:
    filename: /tmp/positions.yaml

clients:
    - url: http://10.88.0.1:3100/loki/api/v1/push

scrape_configs:
    - job_name: syslog
      syslog:
        listen_address: 0.0.0.0:1514
        labels:
          job: "syslog"
      relabel_configs:
        - source_labels: ['__syslog_message_hostname']
          target_label: 'host'

我的洛基配置:

auth_enabled: false

server:
  http_listen_port: 3100

common:
  path_prefix: /loki
  storage:
    filesystem:
      chunks_directory: /loki/chunks
      rules_directory: /loki/rules
  replication_factor: 1
  ring:
    kvstore:
      store: inmemory

schema_config:
  configs:
    - from: 2020-10-24
      store: boltdb-shipper
      object_store: filesystem
      schema: v11
      index:
        prefix: index_
        period: 24h

ruler:
  alertmanager_url: http://localhost:9093

我真的不知道现在该怎么办,我是 Grafana 的新手,所以也许我错过了什么。我用谷歌搜索了这个错误,但没有发现任何有趣的东西(主要是配置错误)。

grafana
  • 1 1 个回答
  • 78 Views

1 个回答

  • Voted
  1. Best Answer
    tholeb
    2023-02-14T01:37:12+08:002023-02-14T01:37:12+08:00

    我忘记添加日志/系统日志卷。事实上,一切正常,但 promtail 没有数据可发送。确保阅读该positions.yaml文件(位于 promtail 的配置中)。

    • 0

相关问题

  • 为什么此仪表板的创建者将字节乘以 8 以获得位?不是反过来吗?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve