Install and Configure Telegraf on FreeBSD 12


Welcome to our guide on how to install and configure Telegraf on FreeBSD 12. If you are looking at collecting and monitoring FreeBSD 12 system metrics, then you might want to use the powerful TIG stack monitoring and visualization tool. In this case, you can install Telegraf agent for collecting these metrics for analysis.

We have covered the installation and setup of TIG stack on Fedora 30 in our previous guide. See the link below.

Install and Setup TIG Stack on Fedora 30

Install and Configure Telegraf on FreeBSD 12

Telegraf is already available on the default FreeBSD 12 repositories and hence can be installed directly using the PKG package manager.

Update and Upgrade System Packages

Before you can run the installation of Telegraf, ensure that your system packages are re-synchronized to the latest versions.

pkg update
pkg upgrade

Verify the availability of the Telegraf package on the FreeBSD 12 repos.

pkg search telegraf
telegraf-1.10.1 Time-series data collection

Install Telegraf on FreeBSD 12

To install Telegraf on FreeBSD 12, run the command below;

pkg install telegraf
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	telegraf: 1.10.1

Number of packages to be installed: 1

The process will require 72 MiB more space.
24 MiB to be downloaded.

Proceed with this action? [y/N]: y

Start and Enable Telegraf

Once the installation is done, enable Telegraf to run on system boot and then start it.

sysrc telegraf_enable=yes
telegraf_enable:  -> yes
service telegraf start
Starting telegraf

Configure Telegraf on FreeBSD 12

Configuration of Telegraf is similar across various systems. However, the location of the default configuration file varies with the OS variants. For the case of FreeBSD 12, the default Telegraf configuration file is located under, /usr/local/etc/telegraf.conf.

As you already know, Telegraf supports various input as well as output plugins. In a basic configuration, we will configure Telegraf to collect a number of system metrics and ingest them on InfluxDB time series database.

Hence, to create a configuration file with specific metrics input plugins, create a new configuration file using the telegraf command as shown below.

mv /usr/local/etc/telegraf.conf /usr/local/etc/telegraf.conf.bak
telegraf config -input-filter cpu:mem:swap:system:processes -output-filter influxdb > /usr/local/etc/telegraf.conf

Next, edit the configuration file to define the InfluxDB (output plugin) connection details.

vim /usr/local/etc/telegraf.conf
  urls = ["http://<Influx-DB-Host-IP>:8086"]
  database = "<influxdb-database>"
  username = "<influxdb-user>"
  password = "<Password>"

Replace the <Influx-DB-Host-IP>, <influxdb-database>, <influxdb-user> and <Password> with your connection details appropriately. Your configuration file in basic form should look like;

Next, ensure that there is a connection to the InfluxDB from the Telegraf agent server host, FreeBSD 12 in this case. You can test this with telnet, as shown below.

telnet 8086
Connected to
Escape character is '^]'.

Restart Telegraf and run some basic configuration test.

service telegraf restart

To run configuration test;

telegraf -config /usr/local/etc/telegraf.conf -test

Next, Login to InfluxDB and verify that system metrics from Telegraf agent are received. For example to check the CPU usage metrics;

Connected to http://localhost:8086 version 1.7.6
InfluxDB shell version: 1.7.6
Enter an InfluxQL query
> use telegraf
Using database telegraf
> auth
username: telegraf
password: [email protected]
> select * from cpu where host='' and dc='freebsd12' limit 5
name: cpu
time                cpu       dc        host                  usage_guest usage_guest_nice usage_idle        usage_iowait usage_irq usage_nice usage_softirq usage_steal usage_system        usage_user
----                ---       --        ----                  ----------- ---------------- ----------        ------------ --------- ---------- ------------- ----------- ------------        ----------
1557396600000000000 cpu-total freebsd12 0           0                99.13589945011783 0            0         0          0             0           0.4713275726630008  0.3927729772191673
1557396600000000000 cpu0      freebsd12 0           0                99.13589945011783 0            0         0          0             0           0.4713275726630008  0.3927729772191673
1557396610000000000 cpu-total freebsd12 0           0                99.84251968503936 0            0         0          0             0           0.15748031496062992 0
1557396610000000000 cpu0      freebsd12 0           0                99.84251968503936 0            0         0          0             0           0.15748031496062992 0
1557396620000000000 cpu-total freebsd12 0           0                99.84301412872841 0            0         0          0             0           0.15698587127158556 0

Well, that looks good and that is just it about how to install and configure Telegraf on FreeBSD 12.

You can also check our related guides by following the links below;

Install Telegraf on Fedora 30/Fedora 29

Install InfluxDB on Fedora 30/Fedora 29

Install Grafana Monitoring Tool on Fedora 29

Install Grafana Metrics Monitoring Tool on Debian 9

Install Grafana Data Visualization Tool on Ubuntu 18.04


Please enter your comment!
Please enter your name here