Telegraf 命令和标志
telegraf
命令启动并运行 Telegraf 功能所需的所有进程。
用法
telegraf [commands]
telegraf [flags]
命令
命令 | 描述 |
---|---|
config | 生成和迁移 Telegraf 配置 |
secrets | 管理 secret stores 中的密钥 |
plugins | 打印可用的插件 |
version | 将当前版本打印到 stdout |
全局标志
标志 | 描述 |
---|---|
--config <file> | 要加载的配置文件。 |
--config-directory <directory> | 包含其他 *.conf 文件的目录。 |
--test-wait | 在测试或 once 模式下,等待服务输入完成的秒数。 |
--usage <plugin> | 打印插件用法 (示例: telegraf --usage mysql )。 |
--pprof-addr <address> | 要监听的 pprof 地址。默认禁用。 |
--watch-config | 在本地配置更改时重启 Telegraf。使用 fs 通知 (notify ) 或轮询 (poll )。默认禁用。 |
--pidfile <file> | 要写入 PID 的文件。 |
--password <password> | 解锁 secret stores 的密码。 |
--old-env-behavior | 切换回 v1.27 之前的环境替换行为。 |
--once | 收集一次指标,写入它们,然后退出。 |
--debug | 启用调试日志记录。 |
--quiet | 在安静模式下运行。 |
--unprotected | 不要在内存中保护密钥。 |
--test | 收集一次指标并打印它们。 |
--deprecation-list | 打印所有已弃用的插件或插件选项。 |
--input-list | 打印可用的输入插件。 |
--output-list | 打印可用的输出插件。 |
--version | (已弃用) 打印 Telegraf 版本。 |
--sample-config | (已弃用) 打印完整的示例配置。 |
--plugin-directory <directory> | (已弃用) 包含 *.so 文件的目录,用于递归搜索插件。找到的插件将被加载、标记和识别。 |
--section-filter <filter> | 过滤要输出的配置部分 (agent , global_tags , outputs , processors , aggregators 和 inputs )。分隔符为 : 。 |
--input-filter <filter> | 过滤要启用的输入插件。分隔符为 : 。 |
--output-filter | 过滤要启用的输出插件。分隔符为 : 。 |
--aggregator-filter <filter> | 过滤要启用的聚合器。分隔符为 : 。 |
--processor-filter <filter> | 过滤要处理的处理器插件。分隔符为 : 。 |
--secretstore-filter <filter> | 过滤要启用的 secretstore 插件。分隔符为 : 。 |
示例
- 生成 Telegraf 配置文件
- 生成仅包含特定插件的配置
- 运行单个 Telegraf 配置并将指标输出到 stdout
- 运行 Telegraf,但仅启用配置文件中定义的插件
- 运行 Telegraf,但仅启用特定插件
- 运行带有 pprof 的 Telegraf
生成 Telegraf 配置文件
telegraf config > telegraf.conf
生成仅包含特定插件的配置
telegraf config \
--input-filter cpu \
--output-filter influxdb
运行单个 Telegraf 配置并将指标输出到 stdout
telegraf --config telegraf.conf --test
运行 Telegraf,但仅启用配置文件中定义的插件
telegraf --config telegraf.conf
运行 Telegraf,但仅启用特定插件
telegraf \
--config telegraf.conf \
--input-filter cpu:mem \
--output-filter influxdb
运行带有 pprof 的 Telegraf
telegraf \
--config telegraf.conf \
--pprof-addr localhost:6060
此页是否对您有帮助?
感谢您的反馈!
支持和反馈
感谢您成为我们社区的一份子!我们欢迎并鼓励您提供关于 Telegraf 和此文档的反馈和错误报告。要寻求支持,请使用以下资源
拥有年度合同或支持合同的客户 可以联系 InfluxData 支持。