Coder Social home page Coder Social logo

Telegraf运行出错 about myperf4j HOT 10 CLOSED

linshunkang avatar linshunkang commented on May 9, 2024
Telegraf运行出错

from myperf4j.

Comments (10)

LinShunKang avatar LinShunKang commented on May 9, 2024

你把 telegraf.conf 发出来看看,看字面意思是 Telegraf 收集的时间超过 5s 了,先确认 Influx DB 正常启动了

from myperf4j.

hdl1930 avatar hdl1930 commented on May 9, 2024

你好,Influx DB 正常使用,telegraf.conf配置如下:

[global_tags]
  dc = ""
[agent]
  interval = "5s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 1000
  flush_buffer_when_full = true
  collection_jitter = "0s"
  flush_interval = "1s"
  flush_jitter = "0s"
  debug = false
  quiet = false
  #logfile = "logs/telegraf.log"
  logfile = ""
  hostname = ""
[[outputs.influxdb]]
  urls = ["http://127.0.0.1:8086"] # required
  database = "MyPerf4J_Test" # required
  precision = "s"
  timeout = "5s"
  retention_policy = ""
  write_consistency = "any"
[[inputs.tail]]
  files = ["D:/0/jiankong/MyPerf4J-ASM/logs/**.log"]
  from_beginning = false
  pipe = false
  watch_method = "inotify"
  data_format = "influx"

MyPerf4J-ASM 日志文件有5个,测试的日志不多应该不会超时。

class_metrics.log
gc_metrics.log
memory_metrics.log
method_metrics.log
thread_metrics.log

from myperf4j.

hdl1930 avatar hdl1930 commented on May 9, 2024

使用的Telegraf 版本是1.8.1,Influx DB版本是1.6.3

from myperf4j.

LinShunKang avatar LinShunKang commented on May 9, 2024

你好,建议如下:

  • 把Telegraf 的log配置上,看看有没有详细的错误信息
  • 确认 InfluxDB 的 8086 端口是否打开了

from myperf4j.

hdl1930 avatar hdl1930 commented on May 9, 2024

发现是telegraf.conf 配置的问题, [[inputs.tail]]中的files修改如下

files = ["D:/0/jiankong/MyPerf4J-ASM/logs/**.log"] 
==>
files = ["D:/0/jiankong/MyPerf4J-ASM/logs/*.log"]

这样既可采集日志。

另发现个问题,不知道是不是bug。
method_metrics.log 文件每整点生成一次,生成后日志后继续写入日志,发现文件修改时间未修改,
这样用inputs.tail 无法进行日志采集
在InfluxDB 中执行
show measurements
没有method_metrics这张表,只有其他四张表:
image

from myperf4j.

LinShunKang avatar LinShunKang commented on May 9, 2024

看看 Telegraf 的日志是否有解析 LineProtocol 错误的信息。
MyPerf4J 会根据配置文件中的 LogRollingTimeUnit 来滚动日志文件,所有的日志文件都是一样的,理论上不应该出现 "文件修改时间未修改" 的情况。

方便把 MyPerf4JPropFile 的内容发出来么?

from myperf4j.

hdl1930 avatar hdl1930 commented on May 9, 2024

你好,发现也是telegraf.conf 配置的问题,[[inputs.tail]]的watch_method 参数做如下修改,日志采集就正常了。

 ## Method used to watch for file updates.  Can be either "inotify" or "poll".
watch_method = "inotify"
==>
watch_method = "poll"

不过,不太理解这两个的区别。

日志文件文件修改时间未改变应该是正常的,修改为watch_method = "poll",日志的时间都是不变的,但日志采集正常
image

from myperf4j.

LinShunKang avatar LinShunKang commented on May 9, 2024

你好,我也不太清楚 poll 和 inotify 的区别,但是我在 macOS 和 Linux 上都是使用 inotify 日志采集都是正常的,并且日志正常滚动,日志文件的 modify time 也是定格在滚动的那一分钟。

from myperf4j.

CraKeyBoy avatar CraKeyBoy commented on May 9, 2024

您好,mac os 使用 watch_method = "poll" 才收集到日志。Telegraf 1.9.4

from myperf4j.

LinShunKang avatar LinShunKang commented on May 9, 2024

@javmain 你好,那就奇怪了,我在 macOS 和 Linux 上采用的是同一个配置,都没遇到问题,可能和软件的版本有关系吧

from myperf4j.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.