项目简介
Telegraf 是一个基于插件的服务端代理,从数据库、系统和 IoT 传感器收集并发送指标和事件。支持超过 300 个输入、输出和聚合插件,编译为无外部依赖的静态二进制文件。
README 预览
# Telegraf\n\n[](https://godoc.org/github.com/influxdata/telegraf)\n[](https://hub.docker.com/_/telegraf/)\n[](https://goreportcard.com/report/github.com/influxdata/telegraf)\n[](https://circleci.com/gh/influxdata/telegraf)\n\nTelegraf is an agent for collecting, processing, aggregating, and writing\nmetrics, logs, and other arbitrary data.\n\n* Offers a comprehensive suite of over 300 plugins, covering a wide range of\n functionalities including system monitoring, cloud services, and message\n passing\n* Enables the integration of user-defined code to collect, transform, and\n transmit data efficiently\n* Compiles into a standalone static binary without any external dependencies,\n ensuring a streamlined deployment process\n* Utilizes TOML for configuration, providing a user-friendly and unambiguous\n setup experience\n* Developed with contributions from a diverse community of over 1,200\n contributors\n\nUsers can choose plugins from a wide range of topics, including but not limited\nto:\n\n* Devices: [OPC UA][], [Modbus][]\n* Logs: [File][], [Tail][], [Directory Monitor][]\n* Messaging: [AMQP][], [Kafka][], [MQTT][]\n* Monitoring: [OpenTelemetry][], [Prometheus][]\n* Networking: [Cisco TelemetryMDT][], [gNMI][]\n* System monitoring: [CPU][], [Memory][], [Disk][], [Network][], [SMART][],\n [Docker][], [Nvidia SMI][], etc.\n* Universal: [Exec][], [HTTP][], [HTTP Listener][], [SNMP][], [SQL][]\n* Windows: [Event Log][], [Management Instrumentation][],\n [Performance Counters][]\n\n## 🔨 Installation\n\nFor binary builds, Docker images, RPM & DEB packages, and other builds of\nTelegraf, please see the [install guide](/docs/INSTALL_GUIDE.md).\n\nSee the [releases documentation](/docs/RELEASES.md) for details on versioning\nand when releases are made.\n\n## 💻 Usage\n\nUsers define a TOML configuration with the plugins and settings they wish to\nuse, then pass that configuration to Telegraf. The Telegraf agent then\ncollects data from inputs at each interval a
常见问题 (5)
故障排除如何修复 Telegraf opcua_listener 因 StatusBadNodeIDUnknown 错误导致的永久断开连接问题?
升级到 Telegraf v1.40.0 或更高版本。该 bug 位于 gopcua 的重连状态机中:当订阅在自动重连期间重建失败时(例如,由于被监控的节点在服务器地址空间中已不存在而返回 StatusBadNodeIDUnknown 0x80340000),客户端会停留在 Connected 状态,但没有任何活动的订阅,且发布循环已失效,因此 Telegraf 永远不会重试,一直保持断开状态直到被重启。该修复(gopcua/opcua#877)已合入 gopcua v0.9.1,并随 Telegraf v1.40.0+ 一起发布。在完成升级之前,唯一的变通方法是在断开连接发生时重启 Telegraf 服务(例如,通过针对 no subscriptions to resume 调试日志设置看门狗/监控告警)。
故障排除如何修复Telegraf OPC UA监听器在监控超过1150个节点时出现的'EOF'错误?
这是一个已知的错误(问题 #14568),当许多节点配置了安全连接时,OPC UA 监听器插件会发送过大的请求。服务器以 'BadTcpMessageTooLarge' 拒绝该请求,导致 'EOF' 错误。解决方法:将节点分成大约 500 个一组,分散到多个 [[inputs.opcua_listener]] 实例或 group 块中。正在开发一个永久性的批处理修复方案。
故障排除如何修复 Telegraf nightly Docker 镜像显示旧版本或过期版本的问题?
这是由 nightly CI 和 S3 发布成功完成后遗留的过期公共分发/源构件(artifact)导致的;并非 Docker 构建失败。InfluxData 已解决该分发问题。请使用以下命令更新镜像:
docker run --pull=always --rm quay.io/influxdb/telegraf-nightly:alpine --version
如果仍在使用旧镜像,请将其删除并重新拉取:
docker image rm quay.io/influxdb/telegraf-nightly:alpine
docker pull quay.io/influxdb/telegraf-nightly:alpine
在事件期间,受影响的镜像报告为 Telegraf 1.39.0-f6fa1073,而不是预期的 nightly 提交 511c852e。作为临时解决方法,请使用最近一次成功的 CircleCI nightly 任务中的构件,或从所需的提交构建 Telegraf。
故障排除为什么 Telegraf 的 inputs.nftables 插件在读取大型 nftables 集合时速度很慢?
该插件在运行 nft 时未使用 --terse,导致它会转储每个 nftables 集合中的每个元素。对于大型或存在竞争的集合,这可能需要数分钟甚至数小时。请将 Telegraf 升级到包含 inputs.nftables --terse 修复的版本。升级后,当 include 中未包含 "sets" 时,插件会传递 --terse,例如:
[[inputs.nftables]]
include = ["tables", "chains"]
如果需要集合指标,请将 nft 升级到 1.1.7 或更高版本。该版本可以通过 --terse 返回集合元素计数,从而避免完整的元素转储。可使用 nft --version 进行验证。对于较旧的 Telegraf 或 nft 版本,临时解决方法是避免监控集合,或减小被检查集合的大小。
故障排除为什么Telegraf的系统运行时间指标在Prometheus中以gauge类型报告?
Telegraf(未发布的1.39.0版本)中的一个错误将'uptime'指标错误地注册为gauge(仪表)类型。正确的类型应为counter(计数器),因为uptime只会递增。该问题将在正式发布前修复。对于受影响的开发构建版本,可通过在Prometheus中使用metric_relabel_configs或relabeling规则覆盖指标类型,将其视为counter。修复后请升级至最新的稳定版本。