Execd 输入插件
此插件将给定的外部程序作为长期运行的守护进程运行,并在进程的 stdout 上以支持的 数据格式之一收集指标。该程序应保持运行,并在接收到配置的 signal 时输出数据。
进程的 stderr 输出将被中继到 Telegraf 的日志记录设施,默认情况下将记录为错误。但是,您可以通过在消息前加上 E! 表示错误、W! 表示警告、I! 表示信息、D! 表示调试和 T! 表示跟踪级别,后跟一个空格和实际消息来记录到其他级别。例如,输出 I! A log message 将在您的 Telegraf 日志输出中创建一条信息日志行。
引入于: Telegraf v1.14.0 标签: system 操作系统支持: all
服务输入
此插件是服务输入。普通插件收集由 interval 设置确定的指标。服务插件启动一个服务来监听并等待指标或事件发生。服务插件与普通插件的两个主要区别是:
- 全局或插件特定的
interval设置可能不适用 --test、--test-wait和--once的 CLI 选项可能不会为此插件生成输出
全局配置选项
插件支持其他全局和插件配置设置,用于修改指标、标签和字段,创建别名以及配置插件顺序等任务。更多详情请参阅 CONFIGURATION.md。
配置
# Run executable as long-running input plugin
[[inputs.execd]]
## One program to run as daemon.
## NOTE: process and each argument should each be their own string
command = ["telegraf-smartctl", "-d", "/dev/sda"]
## Environment variables
## Array of "key=value" pairs to pass as environment variables
## e.g. "KEY=value", "USERNAME=John Doe",
## "LD_LIBRARY_PATH=/opt/custom/lib64:/usr/local/libs"
# environment = []
## Define how the process is signaled on each collection interval.
## Valid values are:
## "none" : Do not signal anything. (Recommended for service inputs)
## The process must output metrics by itself.
## "STDIN" : Send a newline on STDIN. (Recommended for gather inputs)
## "SIGHUP" : Send a HUP signal. Not available on Windows. (not recommended)
## "SIGUSR1" : Send a USR1 signal. Not available on Windows.
## "SIGUSR2" : Send a USR2 signal. Not available on Windows.
# signal = "none"
## Delay before the process is restarted after an unexpected termination
# restart_delay = "10s"
## Buffer size used to read from the command output stream
## Optional parameter. Default is 64 Kib, minimum is 16 bytes
# buffer_size = "64Kib"
## Disable automatic restart of the program and stop if the program exits
## with an error (non-zero error code)
# stop_on_error = false
## Data format to consume.
## Each data format has its own unique set of configuration options, read
## more about them here:
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
# data_format = "influx"示例
请参阅 examples 目录中关于不同语言期望从 Telegraf 接收各种信号的基本示例
- Go: 示例期望
signal = "SIGHUP" - Python: 示例期望
signal = "none" - Ruby: 示例期望
signal = "none" - shell: 示例期望
signal = "STDIN"
Metrics
取决于用户的数据。
示例输出
取决于用户的数据。
此页面是否有帮助?
感谢您的反馈!
支持和反馈
感谢您成为我们社区的一员!我们欢迎并鼓励您对 Telegraf 和本文档提出反馈和 bug 报告。要获取支持,请使用以下资源
具有年度合同或支持合同的客户可以 联系 InfluxData 支持。