本文介绍在RHEL 8/CentOS 8操作系统上安装Telegraf的方法。在选写本文时,RHEL 8没有官方存储库,但我们可以使用RHEL 7的InfluxData存储库,它可以正常工作。其它系统安装方法请参考在Ubuntu 18.04/Debian 9上安装Telegraf的方法及在Fedora 29/Fedora 28上安装Telegraf的方法。
在RHEL 8/CentOS 8上安装Telegraf 先更新系统RHEL 8系统: sudo yum -y update 一、添加Influxdata RPM存储库 然后添加Influxdata RPM存储库,如下: cat <<EOF | sudo tee /etc/yum.repos.d/influxdb.repo [influxdb] name = InfluxDB Repository - RHEL baseurl = https://repos.influxdata.com/rhel/7/x86_64/stable/ enabled = 1 gpgcheck = 1 gpgkey = https://repos.influxdata.com/influxdb.key EOF 二、在RHEL 8/CentOS 8上安装Telegraf的方法 添加存储库后,使用以下命令在RHEL 8上安装Telegraf: $ sudo yum -y install telegraf Updating Subscription Management repositories. Updating Subscription Management repositories. bintray--sbt-rpm 731 B/s | 1.3 kB 00:01 bintray--sbt-rpm 6.8 kB/s | 12 kB 00:01 Red Hat Enterprise Linux 8 for x86_64 - Ap 1.6 kB/s | 4.1 kB 00:02 Red Hat Enterprise Linux 8 for x86_64 - Ba 3.2 kB/s | 4.1 kB 00:01 Dependencies resolved. Package Arch Version Repository Size Installing: telegraf x86_64 1.10.0-1 influxdb 17 M Transaction Summary Install 1 Package Total download size: 17 M Installed size: 60 M Downloading Packages: telegraf-1.10.0-1.x86_64.rpm 1.2 MB/s | 17 MB 00:14 Total 1.2 MB/s | 17 MB 00:14 warning: /var/cache/dnf/influxdb-5468cd5ca80e07dd/packages/telegraf-1.10.0-1.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 2582e0c5: NOKEY InfluxDB Repository - RHEL 5.1 kB/s | 3.0 kB 00:00 Importing GPG key 0x2582E0C5: Userid : "InfluxDB Packaging Service <support@influxdb.com>" Fingerprint: 05CE 1508 5FC0 9D18 E99E FB22 684A 14CF 2582 E0C5 From : https://repos.influxdata.com/influxdb.key Key imported successfully Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installed: telegraf-1.10.0-1.x86_64 Running scriptlet: telegraf-1.10.0-1.x86_64 1/1 Installing : telegraf-1.10.0-1.x86_64 1/1 Running scriptlet: telegraf-1.10.0-1.x86_64 1/1 Created symlink /etc/systemd/system/multi-user.target.wants/telegraf.service → /usr/lib/systemd/system/telegraf.service. Installed: telegraf-1.10.0-1.x86_64 Verifying : telegraf-1.10.0-1.x86_64 1/1 Installed: telegraf-1.10.0-1.x86_64 Complete! 可以使用rpm命令查看包详细信息,运行rpm -qi telegraf命令,所安装的版本是1.10.0:
三、在RHEL 8/CentOS 8上启动并配置Telegraf服务 既然在RHEL 8上安装了telegraf,让我们启动该服务并使其在启动时启动: sudo systemctl enable --now telegraf 确认状态,运行systemctl status telegraf命令:
至此,安装配置Telegraf完成。
相关主题 |