如何调试 Telegraf?

mrp*_*ker 12 influxdb telegraf

我正在尝试让 Telegraf 与 InfluxDB 一起使用,但我遇到了困难。我已将以下块添加到 Telegraf 配置文件中:

[[inputs.win_perf_counters.object]]
  # Process metrics, in this case for IIS only
  ObjectName = "Process"
  Instances = ["W3SVC"]
  Counters = ["% Processor Time","Handle Count","Private Bytes","Thread Count","Virtual Bytes","Working Set"]
  Measurement = "win_proc"
Run Code Online (Sandbox Code Playgroud)

然而,当我搜索数据库时,我从未看到该测量结果。我知道该进程正在运行,所以它应该输出一些东西。问题是,即使我打开了日志记录,也没有日志文件。事件查看器中也没有任何内容。由于没有下载源代码并在本地调试器中运行程序,我不知道如何继续。有人有什么想法吗?

小智 11

[agent]
  ## Default data collection interval for all inputs
  interval = "10s"
  ## Log at debug level.
  debug = true
  ## Log only error level messages.
  quiet = false

  ## Log target controls the destination for logs and can be one of "file",
  ## "stderr" or, on Windows, "eventlog".  When set to "file", the output file
  ## is determined by the "logfile" setting.
  # logtarget = "file"

  ## Name of the file to be logged to when using the "file" logtarget.  If set to
  ## the empty string then logs are written to stderr.
  # logfile = ""

You can specify debug = true in the agent config to print the debug logs. If you don't specify any log file, the logs will be printed on terminal.
Run Code Online (Sandbox Code Playgroud)


小智 9

您现在可能已经解决了它,但供进一步参考。您可以添加文件输出。

[[outputs.file]]
  files = ["stdout"]
Run Code Online (Sandbox Code Playgroud)

在 telegraf.conf 中,然后观察控制台(stdout)的输出。