telegraf 编译安装以及问题记录

代码下载:

# git clone https://github.com/influxdata/telegraf.git

直接编译:

# cd telegraf
# make build

编译报错问题列表

  • 问题1:
root@book:~/dba/telegraf# make build
CGO_ENABLED=0 go build -tags "" -ldflags " -X github.com/influxdata/telegraf/internal.Commit=2ae65d1a -X github.com/influxdata/telegraf/internal.Branch=master -X github.com/influxdata/telegraf/internal.Version=1.28.0-2ae65d1a" ./cmd/telegraf
go: downloading modernc.org/sqlite v1.24.0
go: downloading collectd.org v0.5.0
verifying [email protected]: checksum mismatch
        downloaded: h1:mRTLdljvxJNXPMMO9RSxf0PANDAqu/Tz+I6Dt6OjB28=
        go.sum:     h1:y4uFSAuOmeVhG3GCRa3/oH+ysePfO/+eGJNfd0Qa3d8=

SECURITY ERROR
This download does NOT match an earlier download recorded in go.sum.
The bits may have been replaced on the origin server, or an attacker may
have intercepted the download attempt.

For more information, see 'go help module-auth'.
make: *** [Makefile:132: build] Error 1

解决方法:直接替换go.sum里面的h1

  • 问题2
plugins/inputs/ras/ras.go:16:2: unrecognized import path "modernc.org/sqlite": https fetch: Get "https://modernc.org/sqlite?go-get=1": dial tcp 216.239.32.21:443: i/o timeout

解决方法:设置代理

# go env -w GOPROXY=https://goproxy.cn,direct
  • 问题3
    执行命令读取配置,发生错误
# telegraf --config telegraf.conf
2023-08-20T12:38:56Z I! Loading config: telegraf.conf
2023-08-20T12:38:56Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?

问题定位:telegraf.conf配置文件错误,建议重新生成新的配置文件;

你可能感兴趣的:(telegraf,linux,监控,采集,数据,MySQL)