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 / 问题

问题[grafana](server)

Martin Hope
Joan
Asked: 2024-05-30 17:47:59 +0800 CST

安装loki grafana限制使用的资源

  • 6

0

我按照指南https://grafana.com/docs/loki/latest/setup/install/helm/install-monolithic/在我的 k8s 集群中安装 loki:

deploymentMode: SingleBinary
loki:
  commonConfig:
    replication_factor: 1
  storage:
    type: 'filesystem'
  schemaConfig:
    configs:
    - from: "2024-01-01"
      store: tsdb
      index:
        prefix: loki_index_
        period: 24h
      object_store: filesystem # we're storing on filesystem so there's no real persistence here.
      schema: v13
singleBinary:
  replicas: 1
read:
  replicas: 0
backend:
  replicas: 0
write:
  replicas: 0

安装工作“正常”,但如果我执行kubectl describe pod loki-chunks-cache-0.我在 loki-chunks-cache-0 中看到以下错误:

警告 FailedScheduling 59 秒(24 小时内 x297)默认调度程序 0/2 个节点可用:1 pod 太多,2 内存不足。抢占:0/2 个节点

以及以下资源请求:

memcached:
    Image:      memcached:1.6.23-alpine
    Port:       11211/TCP
    Host Port:  0/TCP
    Args:
      -m 8192
      --extended=modern,track_sizes
      -I 5m
      -c 16384
      -v
      -u 11211
    Limits:
      memory:  9830Mi
    Requests:
      cpu:        500m
      memory:     9830Mi

我知道问题是我的 k8s 集群中没有足够的内存。但是我是否可以在 yaml 中指示此缓存的限制/请求以减少这些需求或完全禁用它?

grafana
  • 1 个回答
  • 93 Views
Martin Hope
Kate
Asked: 2024-04-13 04:55:35 +0800 CST

在 Grafana Loki 中解析嵌套的 JSON 日志(通过 Fluentd 转发)

  • 5

我的实验室有一些 Docker 容器,如下所示:

姓名 Docker镜像
流利的 流利/流利d:v1.16-1
流利位 cr. Fluentbit.io/ Fluent/Fluent-bit
洛基 格拉法纳/洛基
格拉法纳 grafana/grafana-企业
球童 球童:建造者

我的目标是收集 Caddy 日志并在 Grafana 中将它们可视化。

场景:Fluent-bit 跟踪日志并将其发送到 Fluentd。然后 Fluentd 将日志推送给 Loki。我的目标是使用 Fluentd 作为中央日志收集器。

问题在于 Grafana 端对这些日志的解析。

Caddy 日志采用(嵌套)JSON 格式。样本:

{“level”:“info”,“ts”:1712949034.535184,“logger”:“http.log.access.log1”,“msg”:“已处理的请求”,“request”:{“remote_ip”:“172.18. 0.1","re​​mote_port":"39664","client_ip":"172.18.0.1","proto":"HTTP/1.1","method":"POST","host":"grafana.darknet.com" ,"uri":"/api/short-urls","headers":{"Content-Length":["580"],"Origin":["http://grafana.darknet.com"]," Content-Type":["application/json"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:124.0) Gecko/20100101 Firefox/124.0"],"Accept":["application /json,文本/纯文本,*/*"],"X-Grafana-Org-Id":["1"],"连接":["keep-alive"],"接受语言":["en-US,en;q=0.5"],"接受-编码":["gzip, deflate"],"Referer":["http://grafana.darknet.com/explore?schemaVersion=1&panes=%7B%22Efb%22:%7B%22datasource%22:%22f779c221 -7bd2-468d-9f9c-96e069b869f8%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%7Bjob%3D%5C%22caddy.log.loki% 5C%22%7D%20%7C%20json%22,%22queryType%22:%22range%22,%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22f779c221-7bd2 -468d-9f9c-96e069b869f8%22%7D,%22editorMode%22:%22code%22%7D%5D,%22range%22:%7B%22from%22:%22now-1m%22,%22to%22:% 22now%22%7D%7D%7D&orgId=1"],"X-Grafana-Device-Id":["f343e938e74b3a57997faff69d24de8a"],"Cookie":[]}},"bytes_read":580,“user_id”:“”,“持续时间”:0.011267887,“大小”:72,“状态”:200,“resp_headers”:{“X-Xss-Protection”:[“1;模式=块”],“日期":["2024 年 4 月 12 日星期五 19:10:34 GMT"],"内容长度":["72"],"服务器":["球童"],"缓存控制":["无- store"],"Content-Type":["application/json"],"X-Content-Type-Options":["nosniff"],"X-Frame-Options":["deny"]}}[“Caddy”],“Cache-Control”:[“no-store”],“Content-Type”:[“application/json”],“X-Content-Type-Options”:[“nosniff”], "X-Frame-Options":["拒绝"]}}[“Caddy”],“Cache-Control”:[“no-store”],“Content-Type”:[“application/json”],“X-Content-Type-Options”:[“nosniff”], "X-Frame-Options":["拒绝"]}}

到目前为止我已经尝试了两种不同的配置:

  1. 让 Fluent-bit 将日志发送到 Fluentd,然后 Fluentd 将日志转发到 Loki(标记为caddy.log)
    架构:Cady --> Fluent-bit --> Fluentd --> Loki

  2. 让 Fluent-bit 将日志直接发送到 Loki(标记为caddy.log.loki)
    架构:Cady --> Fluent-bit --> Loki

这里我有以下 Fluent 位配置,可以使用不同的标签同时将日志发送到 Loki 和 Fluentd :

[INPUT]
    Name tail
    Path /var/log/caddy/*.log
    Parser json
    Tag caddy.log
    Path_Key log_filename

# send logs to Fluentd
[OUTPUT]
    Name forward
    Host fluentd
    Port 24224
    Match caddy.*

# send logs straight to Loki
[OUTPUT]
    name                   loki
    match                  caddy.*
    host                   loki
    port                   3100
    labels                 job=caddy.log.loki

Fluentd配置:

<source>
  @type  forward
</source>

<match caddy.*>
  @type loki
  url "http://loki:3100"
  extra_labels {"job": "caddy.log"}
  <buffer>
    flush_interval 5s
    flush_at_shutdown true
  </buffer>
</match>

然后在 Grafana 中,我可以浏览日志,并且“浏览”窗口中提供了两个可用标签。

如果我选择标签,caddy.log.loki日志将以纯 JSON 格式显示,如下所示。通过这个表达式我可以解析它们:{job="caddy.log.loki"} | json。一些嵌套的 JSON 被提取,例如:request_client_ip 但不是全部,例如request.headers丢失了,但我可以忍受。

日志被视为 JSON

如果我选择标签,caddy.log那么日志将以“混合”格式显示:

混合格式的日志

似乎发生了一些转变,但我不确定在哪里。我可以用来logfmt解析这些行。但我仍然留下一些未解析的字段(request,resp_headers),如下所示:

使用 logfmt 后

问题:

  • 如果我添加 Fluentd 步骤,为什么日志不再以纯 JSON 格式呈现?
  • 使用 Fluentd 在 Loki/Grafana 中传送和解析嵌套 JSON 日志的最佳方式是什么?
grafana
  • 1 个回答
  • 37 Views
Martin Hope
Windowlicker
Asked: 2023-12-14 00:04:50 +0800 CST

使用 promtail + loki + grafana 进行的设置未显示任何日志数据

  • 5

在使用 promtail、loki 和 grafana 的设置中,grafana explore 中没有显示任何数据。所有三个部分都在同一台机器上运行。

问题是:在哪里查找设置中的错误?

普罗姆泰尔

promtail.yaml:

server:
  http_listen_port: 9080
  grpc_listen_port: 0

positions:
  filename: /var/db/promtail/positions.yaml

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

scrape_configs:
- job_name: system
  static_configs:
  - targets:
      - localhost
    labels:
      job: varlogs
      __path__: /var/log/**/*log

这似乎没问题。测试:

promtail --config.file=promtail.yaml --log.level=info -print-config-stderr

---
# Loki Config
# (version=, branch=, revision=unknown)
global:
  file_watch_config:
    min_poll_frequency: 250ms
    max_poll_frequency: 250ms
server:
  http_listen_network: tcp
  http_listen_address: ""
  http_listen_port: 9080
[...]
level=info ts=2023-12-13T16:00:24.711575585Z caller=promtail.go:133 msg="Reloading configuration file" md5sum=169d8cc02367d196d7ba24694ea90c5d
level=info ts=2023-12-13T16:00:24.712927375Z caller=server.go:322 http=[::]:9080 grpc=[::]:32729 msg="server listening on addresses"
level=info ts=2023-12-13T16:00:24.713264874Z caller=main.go:174 msg="Starting Promtail" version="(version=, branch=, revision=unknown)"
level=warn ts=2023-12-13T16:00:24.713474024Z caller=promtail.go:263 msg="enable watchConfig"
level=info ts=2023-12-13T16:00:29.714075081Z caller=filetargetmanager.go:361 msg="Adding target" key="/var/log/**/*log:{job=\"varlogs\"}"
level=info ts=2023-12-13T16:00:29.716662721Z caller=filetarget.go:313 msg="watching new directory" directory=/var/log/loki
level=info ts=2023-12-13T16:00:29.716703277Z caller=filetarget.go:313 msg="watching new directory" directory=/var/log/promtail
level=info ts=2023-12-13T16:00:29.716812088Z caller=filetarget.go:313 msg="watching new directory" directory=/var/log/gitea
level=info ts=2023-12-13T16:00:29.716857702Z caller=filetarget.go:313 msg="watching new directory" directory=/var/log/grafana
level=info ts=2023-12-13T16:00:29.717132151Z caller=filetarget.go:313 msg="watching new directory" directory=/var/log/redis
level=info ts=2023-12-13T16:00:29.717201082Z caller=filetarget.go:313 msg="watching new directory" directory=/var/log/caddy
level=info ts=2023-12-13T16:00:29.717280021Z caller=filetarget.go:313 msg="watching new directory" directory=/var/log
ts=2023-12-13T16:00:29.720424446Z caller=log.go:168 level=info msg="Seeked /var/log/caddy/caddy.log - &{Offset:606936482 Whence:0}"
level=info ts=2023-12-13T16:00:29.720534804Z caller=tailer.go:145 component=tailer msg="tail routine: started" path=/var/log/caddy/caddy.log
ts=2023-12-13T16:00:29.720631282Z caller=log.go:168 level=info msg="Seeked /var/log/gitea/gitea.log - &{Offset:8194 Whence:0}"
level=info ts=2023-12-13T16:00:29.72066379Z caller=tailer.go:145 component=tailer msg="tail routine: started" path=/var/log/gitea/gitea.log
ts=2023-12-13T16:00:29.720728343Z caller=log.go:168 level=info msg="Seeked /var/log/grafana/grafana.log - &{Offset:38901 Whence:0}"
level=info ts=2023-12-13T16:00:29.720756759Z caller=tailer.go:145 component=tailer msg="tail routine: started" path=/var/log/grafana/grafana.log
[...]

洛基

洛基.yaml

auth_enabled: false

server:
  http_listen_port: 3100
  grpc_listen_port: 9096

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

query_range:
  results_cache:
    cache:
      embedded_cache:
        enabled: true
        max_size_mb: 100

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

loki 应用程序/服务已启动并正在运行。我还可以在这里测试什么吗?

格拉法纳

创建的 loki 数据源:

  • 类型:洛基
  • URL:(http://127.0.0.1:3100 其他所有内容:保留默认设置)

即使没有任何过滤条件,仅查看 grafana/explore也不会显示任何数据。光是按Run query好像没有什么效果。

grafana 日志对我来说看起来不错:

尾部 /var/log/grafana/grafana.log

logger=grafana.update.checker t=2023-12-13T16:31:16.759743533+01:00 level=info msg="Update check succeeded" duration=486.885735ms
logger=cleanup t=2023-12-13T16:41:16.24610575+01:00 level=info msg="Completed cleanup jobs" duration=13.483743ms
logger=plugins.update.checker t=2023-12-13T16:41:16.617294501+01:00 level=info msg="Update check succeeded" duration=334.848905ms
logger=grafana.update.checker t=2023-12-13T16:41:16.657803737+01:00 level=info msg="Update check succeeded" duration=387.307337ms
logger=cleanup t=2023-12-13T16:51:16.240282272+01:00 level=info msg="Completed cleanup jobs" duration=7.750284ms
logger=grafana.update.checker t=2023-12-13T16:51:16.292110778+01:00 level=info msg="Update check succeeded" duration=21.261137ms
logger=plugins.update.checker t=2023-12-13T16:51:16.313163122+01:00 level=info msg="Update check succeeded" duration=31.295959ms
logger=cleanup t=2023-12-13T17:01:16.220217724+01:00 level=info msg="Completed cleanup jobs" duration=4.195714ms
logger=plugins.update.checker t=2023-12-13T17:01:16.312587838+01:00 level=info msg="Update check succeeded" duration=30.754461ms
logger=grafana.update.checker t=2023-12-13T17:01:16.333881656+01:00 level=info msg="Update check succeeded" duration=63.366615ms

感谢您指出这里可能缺少的内容。

grafana
  • 1 个回答
  • 156 Views
Martin Hope
tholeb
Asked: 2023-02-13 05:31:02 +0800 CST

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

  • 5

我正在尝试安装 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 个回答
  • 78 Views
Martin Hope
questionto42standswithUkraine
Asked: 2022-04-15 06:35:02 +0800 CST

一次选择 Grafana 时间序列图表中的所有标签,而不是“Ctrl+单击”——选择每个标签直到标记完整列表?

  • 1

在 Grafana 的时间序列图中,我尝试标记一堆标签,以便显示它们的所有曲线。

默认情况下,我在图表中只得到四个标签的曲线,但我有几十个标签,我不想用鼠标标记所有东西,这需要太多时间和精力。

这个想法很可能是选择太多曲线会让你迷失在线条中。但在这种情况下,图表是关于发现异常值、强烈的变化和趋势,或者只是高数字。您可以将鼠标悬停在任何可能引起您注意的曲线上,仅此而已。因此,一张图中有 80 条曲线是没有问题的。

过滤器只是缩小列表,而不是标记其中的所有标签。我可以使用它来正则表达式检查具有 2 位数秒持续时间的查询和 query_name 上的一些其他过滤器。

在此处输入图像描述

然而,我只想一次性查看所有标签的曲线,而不仅仅是单击以下内容:

在此处输入图像描述

有什么诀窍可以完成这项工作吗?甚至可以使用 Grafana Dashboard 代码将作业标记为硬编码列表?或者是否有捷径或其他技巧来选择所有?

grafana
  • 1 个回答
  • 136 Views
Martin Hope
JJandke
Asked: 2021-12-09 13:21:46 +0800 CST

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

  • 0

为了监控服务器,我们为 Grafana 导入了仪表板。这使用 Telegraf 和 InfluxDB 作为收集器和数据库。

当需要调整某些图表时,我注意到在网络速度查询中,接收到的字节(bytes_recv)乘以8,但图表本身的单位以位显示。

SELECT non_negative_derivative(mean(bytes_recv),1s)*8 as "in" FROM "net" WHERE host =~ /$server/ AND interface =~ /$netif/ AND $timeFilter GROUP BY time($interval), * fill(none)

根据我的理解是:8Bit = 1Byte。据此,如果数据以字节形式提供,则必须将其除以 8 才能获得位,如果图形应该显示位。

此外(如果我没记错的话): 兆位 = Mb Mebibit = Mib 兆字节 = MB Mebibyte = MiB

参考这个,图上的单位好像是兆比特吧?我是否理解了根本上的错误,或者“*”是否与“/”混淆了?

Grafana 仪表板的屏幕截图

networking grafana network-speed telegraf
  • 1 个回答
  • 145 Views
Martin Hope
Stefan
Asked: 2021-09-27 14:37:16 +0800 CST

Grafana 在 kubernetes 中部署,并在 ingess 中使用 Letsencript 证书

  • 0

我想在我的 AKS kubernetes 集群中部署 grafana。对于部署,我使用 helm

helm install grafana grafana/grafana --namespace=grafana --set "service.type=ClusterIP,persistence.enabled=true,replicaCount=1,persistence.size=10Gi,persistence.accessModes[0]=ReadWriteOnce,plugins=grafana-azure-monitor-datasource\,grafana-kubernetes-app,ingress.enabled=true,ingress.tls[0]=enabeld,ingress.tls[0].hosts[0]=mydomain.de,ingress.tls[0].secretName=tls-grafana-ingress,ingress.hosts[0]=mydomain.de,ingress.annotations.kubernetes.io/ingress.class=nginx,ingress.cert-manager.io/issuer=letsencrypt-prod" 

它可以创建 grafana(当我删除“ ingress.annotations.kubernetes.io/ingress.class=nginx,ingress.cert-manager.io/issuer=letsencrypt-prod”时),但 tls 证书有问题。证书将不会产生。

我需要改变什么,所以证书也会创建?

问候斯特凡

nginx kubernetes grafana helm
  • 1 个回答
  • 312 Views
Martin Hope
cyly derder
Asked: 2021-06-19 08:32:12 +0800 CST

将 grafana 设置克隆到不同的服务器

  • 0

我正在编写一组脚本来自动设置任何原始 ubuntu 服务器,使其处于可用于我的生产环境的状态。

我想做的一件事是设置 grafana,以便在安装时,它已经添加了 prometheus 作为数据源,设置了仪表板,并且已经完成了任何其他配置步骤,而无需触摸图形界面。

为此,我认为我可以在开发服务器中设置 grafana,并将整个配置目录保存在 gitlab 中,以将该配置复制到任何新服务器中。

这是可以做到的吗?而且,我应该在版本控制中保存哪些目录才能完全复制本地 grafana 设置?

ubuntu grafana server-setup
  • 2 个回答
  • 542 Views
Martin Hope
LuckyFr
Asked: 2021-03-14 16:23:13 +0800 CST

Telegraf 手动工作,但不是服务 - 在后台运行 Telegraf

  • 0

我有一个在 Ubuntu 20.04 上运行的虚拟机,我安装了 Telegraf、InfluxDB 和 Grafana 来监控虚拟机和集群的节点。

一切正常,除非我尝试让电报在后台工作。

手动启动正在工作的 Telegraf 的命令:

telegraf --config http://XXX.XX.X.X:8086/api/v2/telegrafs/XXXXXXXXXXX

返回我:

2021-03-14T00:02:27Z I! Starting Telegraf 1.17.3
2021-03-14T00:02:27Z I! Loaded inputs: cpu disk diskio mem net processes swap system
2021-03-14T00:02:27Z I! Loaded aggregators:
2021-03-14T00:02:27Z I! Loaded processors:
2021-03-14T00:02:27Z I! Loaded outputs: influxdb_v2
2021-03-14T00:02:27Z I! Tags enabled: host=XXXXX
2021-03-14T00:02:27Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"XXXXX", Flush Interval:10s

所以到目前为止一切都很好。

但无法运行此服务(/lib/systemd/system/telegraf.service):

[Unit]
Description=The plugin-driven server agent for reporting metrics into InfluxDB
Documentation=https://github.com/influxdata/telegraf
After=network.target

[Service]
EnvironmentFile=-/etc/default/telegraf
User=telegraf
ExecStart=/usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d $TELEGRAF_OP>
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
RestartForceExitStatus=SIGPIPE
KillMode=control-group

[Install]
WantedBy=multi-user.target

它开始很好,但在检查了服务状态后,我得到了:

14T00:10:46Z E! [agent] Error writing to outputs.influxdb: could not write any address
14T00:10:56Z W! [outputs.influxdb] Metric buffer overflow; 25 metrics have been dropped
14T00:10:56Z E! [outputs.influxdb] When writing to [http://XXX.XX.X.X:8086]: 401 Unauthorized
14T00:10:56Z E! [agent] Error writing to outputs.influxdb: could not write any address
14T00:11:06Z W! [outputs.influxdb] Metric buffer overflow; 25 metrics have been dropped
14T00:11:06Z E! [outputs.influxdb] When writing to [http://XXX.XX.X.X:8086]: 401 Unauthorized
14T00:11:06Z E! [agent] Error writing to outputs.influxdb: could not write any address
14T00:11:16Z W! [outputs.influxdb] Metric buffer overflow; 25 metrics have been dropped
14T00:11:16Z E! [outputs.influxdb] When writing to [http://XXX.XX.X.X:8086]: 401 Unauthorized
14T00:11:16Z E! [agent] Error writing to outputs.influxdb: could not write any address

InfluxDB 没有得到任何数据,所以 Grafana。

谁能帮我解决这个服务问题并让 Telegraf 在后台工作?

linux ubuntu monitoring grafana telegraf
  • 1 个回答
  • 5142 Views
Martin Hope
csgeek
Asked: 2021-02-10 16:48:48 +0800 CST

入口 Nginx SSL 503 错误

  • 1

服务.yaml

apiVersion: v1
kind: Service
metadata:
  creationTimestamp: null
  labels:
    io.kompose.service: grafana
  name: grafana
spec:
  ports:
    - name: "3000"
      port: 3000
      targetPort: 3000
  selector:
    io.kompose.service: grafana
status:
  loadBalancer: {}

部署:

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    kompose.cmd: kompose convert
    kompose.version: 1.22.0 (HEAD)
  creationTimestamp: null
  labels:
    io.kompose.service: grafana
  name: grafana
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: grafana
  strategy: {}
  template:
    metadata:
      annotations:
        kompose.cmd: kompose convert
        kompose.version: 1.22.0 (HEAD)
      creationTimestamp: null
      labels:
        io.kompose.service: grafana
    spec:
      containers:
        - env:
            - name: GF_SERVER_DOMAIN
              #              value: "testing.esamir.com"
              value: "direct.esamir.com"
            - name: GF_SERVER_ROOT_URL
              value: "%(protocol)s://%(domain)s:%(http_port)s/"
            - name: GF_SERVER_SERVE_FROM_SUB_PATH
              value: "true"
            - name: GF_DATABASE_URL
              valueFrom:
                configMapKeyRef:
                  name: grafanaconfig
                  key: url

          image: grafana/grafana:7.4.0-ubuntu
          name: grafana
          ports:
            - containerPort: 3000
          resources: {}
      restartPolicy: Always
status: {}

入口-nginx 配置:

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: hello-kubernetes-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  rules:
    - host: testing1.com
      http:
        paths:
          - backend:
              serviceName: hello-kubernetes-second
              servicePort: 80
    - host: testing2.com
      http:
        paths:
          - backend:
              serviceName: dashboard
              servicePort: 3000

如果我在 testing1.com 上连接到 http 或 https,它正在运行一个简单的 hello-world kubernetes 应用程序。一切都完美无缺。

如果我在 https 或 http 上连接到 testin2.com,我会收到 503 错误。“503服务暂时不可用”

查看日志,我发现了这个错误:“2021-02-09 15:34:25.309 PSTError getting Endpoints for Service "test/dashboard": no object matching key "test/dashboard" in local store"

作为参考,我的所有清单都部署在 K8 的 test 命名空间下。

我在网上找到的大多数参考资料都在谈论确保服务具有有效的端点。

kubectl 获取端点 --namespace 测试

NAME                                       ENDPOINTS                                      AGE
grafana                                    10.68.5.23:3000                                6h4m
hello-kubernetes-second                    10.68.3.9:8080,10.68.5.5:8080,10.68.6.6:8080   6h22m
nginx-ingress-nginx-controller             10.68.5.8:443,10.68.5.8:80                     6h20m
nginx-ingress-nginx-controller-admission   10.68.5.8:8443                                 6h20m

kubectl 描述 svc grafana -n 测试


Namespace:         test
Labels:            io.kompose.service=grafana
Annotations:       <none>
Selector:          io.kompose.service=grafana
Type:              ClusterIP
IP:                10.71.248.111
Port:              3000  3000/TCP
TargetPort:        3000/TCP
Endpoints:         10.68.5.23:3000
Session Affinity:  None
Events:            <none>

据我所知,我的服务确实有一个有效的端点。我错过了什么?

google-cloud-platform kubernetes grafana ingress
  • 1 个回答
  • 1019 Views

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