This page explains how to install the Telegraf agent on the target host so it can push OS metrics to the Collector.
The fastest path is the one-shot setup script generated by the Collector. The manual steps are also documented below if you prefer to do it yourself, or if your environment blocks scripts.
root (or with sudo)The command looks like this:
wget https://collector.example.com/api/v1/os-agent/generate?format=sh -O setup.sh && chmod +x setup.sh && sudo ./setup.sh
The script does:
telegraf package/etc/telegraf/telegraf.conf with the Collector URL and API key already filled intelegraf service
You should see Done. Telegraf installed and running. at the end.
.\setup.ps1
The script does:
dl.influxdata.comC:\Program Files\Telegraf\telegraf.conf with the Collector URL and API key already filled intelegraf Windows serviceImportant: Telegraf must be installed as a service on Windows. Running it as a normal user limits which processes it can read.
Use this if the one-shot script does not fit (offline host, custom path, etc.).
# Debian / Ubuntu curl -s https://repos.influxdata.com/influxdata-archive.key | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/influxdata-archive.gpg echo "deb https://repos.influxdata.com/debian stable main" | sudo tee /etc/apt/sources.list.d/influxdata.list sudo apt-get update && sudo apt-get install -y telegraf # RHEL / CentOS / Rocky sudo tee /etc/yum.repos.d/influxdata.repo <<'EOF' [influxdata] name = InfluxData Repository baseurl = https://repos.influxdata.com/rhel/$releasever/$basearch/stable enabled = 1 gpgcheck = 1 gpgkey = https://repos.influxdata.com/influxdata-archive_compat.key EOF sudo yum install -y telegraf
C:\Program Files\Telegraf\& "C:\Program Files\Telegraf\telegraf.exe" --service install --config "C:\Program Files\Telegraf\telegraf.conf" Start-Service telegraf
After Telegraf is installed, you still need a valid telegraf.conf. The simplest way:
/etc/telegraf/telegraf.confC:\Program Files\Telegraf\telegraf.conf# Linux sudo systemctl restart telegraf # Windows (PowerShell as Admin) Restart-Service telegraf
sudo systemctl status telegraf journalctl -u telegraf -f
A healthy log shows Loaded inputs: and Loaded outputs: lines, then nothing else - Telegraf only logs errors after startup.
Get-Service telegraf Get-EventLog -LogName Application -Source Telegraf -Newest 20
If the host does not appear, see Troubleshooting.
You can test the push endpoint with curl before installing Telegraf:
curl -X POST https://collector.example.com/api/v1/os-agent/push \ -H "Content-Type: text/plain" \ -H "X-API-Key: YOUR-KEY-HERE" \ -d 'cpu,host=test_host,cpu=cpu-total usage_idle=85.5,usage_user=10.2,usage_system=4.3 mem,host=test_host used_percent=72.1,available=4294967296'
Expected response: OK.
After this, the host test_host appears in the Monitor tab. You can then delete it manually once you are done testing.
If your Collector uses a self-signed certificate, Telegraf will refuse to connect by default. Open telegraf.conf and add this in the outputs.http section:
[[outputs.http]] url = "https://collector.example.com/api/v1/os-agent/push" ... insecure_skip_verify = true
The setup script adds this line automatically when the Collector URL starts with https.
Set the proxy as an environment variable before starting Telegraf:
# Linux - in /etc/default/telegraf HTTPS_PROXY=http://proxy.example.com:8080 HTTP_PROXY=http://proxy.example.com:8080 NO_PROXY=localhost,127.0.0.1
On Windows, set the same variables at the system level (Environment Variables) and restart the service.
sudo systemctl stop telegraf sudo systemctl disable telegraf sudo apt-get remove --purge telegraf # or: sudo yum remove telegraf sudo rm -rf /etc/telegraf
Stop-Service telegraf & "C:\Program Files\Telegraf\telegraf.exe" --service uninstall Remove-Item -Recurse "C:\Program Files\Telegraf"
The host stays in the Collector database with status ERROR (no recent push) until you delete it from the Monitor tab.