作者:知足者常乐-----仙_230 | 来源:互联网 | 2023-02-10 10:31
sudowgethttps:dl.influxdata.comtelegrafreleasestelegraf-1.12.4-1.x86_64.rpmsudoyumlocalins
sudo wget https://dl.influxdata.com/telegraf/releases/telegraf-1.12.4-1.x86_64.rpm
sudo yum localinstall telegraf-1.12.4-1.x86_64.rpm
sudo vim /etc/telegraf/telegraf.conf
![](https://img2.php1.cn/3cdc5/3beb/339/d64e231c8d33fce0.png)
注意:hostname可任意填写,它用来在Grafana监控面板中进行主机确定。因此它是作为一个tag将该配置文件中对应写入的influxdb库进行数据区分(如此库也有其它主机对其写入)。urls和database为安装InfluxDB的机器,本文同时安装了Telegraf和InfluxDB,故使用了127.0.0.1
总之,被监控机最小安装内容是Telegraf,而InfluxDB可以通过该配置文件指定是否也在本机。
hostname = "performance"
[[outputs.influxdb]]
urls = ["http://127.0.0.1:8086"]
database = "performance"
sudo service telegraf restart
sudo systemctl start telegraf
sudo systemctl enable telegraf
sudo systemctl is-enabled telegraf
![](https://img2.php1.cn/3cdc5/3beb/339/c896705ad1f40e22.png)
创建数据源
![](https://img2.php1.cn/3cdc5/3beb/339/de711babde90c80c.png)
![](https://img2.php1.cn/3cdc5/3beb/339/b89e222c972dedce.png)
配置数据看板
官方下载:https://grafana.com/grafana/dashboards/3967
![](https://img2.php1.cn/3cdc5/3beb/339/0374076d2b5d99bb.jpeg)
![](https://img2.php1.cn/3cdc5/3beb/339/382f1f71ebed7c75.png)
运行监控后的结果如下:
![](https://img2.php1.cn/3cdc5/3beb/339/814a3380ed85b72b.jpeg)
如果修改了telegraf.conf,则保存之后需要进行如下操作:
sudo service telegraf restart
sudo service influxdb restart
![](https://img2.php1.cn/3cdc5/3beb/339/caa77252dc9b60c0.png)