## 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 = "xxxx/telegraf.log"
## 默认的账号密码,也在配置文件中。之后配置Grafana中的数据源会用到。
## HTTP Basic Auth
username = "telegraf"
password = "metricsmetricsmetricsmetrics"
3.InfluxDB
influxdb-1.7.6_windows_amd64.zip 解压到文件夹中:
influx.exe 表示客户端
influxd.exe 表示服务端
influx_inspect.exe 表示查看工具
influx_stress.exe 表示压力测试工具
influx_tsm 表示数据库转换工具(将数据库从 b1 或 bz1 格式转换为 tsm1 格式)
influxdb.conf 是配置文件
修改 influxdb.conf 配置文件,主要是修改三个文件夹路径:
[meta]
# Where the metadata/raft database is stored
dir = "xxxx/meta"
[data]
# The directory where the TSM storage engine stores TSM files.
dir = "xxxx/data"
# The directory where the TSM storage engine stores WAL files.
wal-dir = "xxxx/wal"
路径后面的/meta、/data、/wal 不要动。
4.Grafana
直接安装 grafana-7.3.6.windows-amd64.msi 即可。
5.使用
InfluxDB启动
进入安装目录,直接打开 influxd.exe 服务端;可以同时打开 influx.exe 客户端,进行交互式操作。
Telegraf启动
进入 Telegraf 安装目录,打开CMD执行:
# cmd 生成新的配置文件
# telegraf -config telegraf.conf
telegraf -sample-config -input-filter cpu:mem -output-filter influxdb > telegraf1.conf
# cmd 运行
telegraf.exe --config telegraf1.conf
运行了之后会自动在InfluxDB中增加一个新的数据库telegraf,并开始采集信息输入到 influxdb。
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!