Deployment guide

Telegraf

Overview

Telegraf is the open-source, plugin-driven server agent from InfluxData for collecting and reporting metrics. It has more than 240 input plugins that gather metrics from the system, services and third-party APIs, and dozens of output plugins that report them to time-series databases, message queues and monitoring backends, all from a single lightweight binary.

The SecureAnyCloud image installs Telegraf from the official InfluxData apt repository as /usr/bin/telegraf and ships a ready-to-run sample configuration. It exposes the collected metrics on a built-in Prometheus endpoint, so you can scrape them from the moment the VM boots. The image is backed by 24/7 SecureAnyCloud support.

What you get:

  • Telegraf (MIT licensed) from the official InfluxData apt repository
  • The telegraf.service systemd unit from the package, enabled and running on boot
  • A sample configuration at /etc/telegraf/telegraf.conf: cpu, mem, disk, system and net inputs, with two outputs (a file under /var/log/telegraf/ and a Prometheus client endpoint)
  • The built-in Prometheus metrics endpoint on 127.0.0.1:9273 (/metrics)
  • 24/7 SecureAnyCloud support

This is a headless service product. The Prometheus client endpoint binds to 127.0.0.1 only, so you need no inbound application port beyond SSH.

Prerequisites

Before you deploy, make sure you have an active Azure subscription, an SSH key pair, and a VNet and subnet in the target region. Standard_B2s (2 vCPU, 4 GiB RAM) is a good starting size. In the network security group (NSG), allow inbound 22/tcp from your management network. No inbound application ports are required.

Step 1 - Deploy from the Azure Marketplace

Sign in to the Azure portal, choose Create a resource, search the Marketplace for Telegraf by SecureAnyCloud, and select Create. On the Basics tab, pick your subscription, resource group, region and size. Under Administrator account, choose SSH public key and paste your key. Under Inbound port rules, allow SSH (22). Then select Review + create and Create.

Step 2 - Deploy from the Azure CLI

Accept the Marketplace terms once per subscription, then create the VM. Replace the values in angle brackets:

# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn sac1647283583153:telegraf-ubuntu-24-04:default:latest
az vm create \
  --resource-group <your-rg> \
  --name telegraf \
  --image sac1647283583153:telegraf-ubuntu-24-04:default:latest \
  --size Standard_B2s \
  --admin-username azureuser \
  --ssh-key-values ~/.ssh/id_ed25519.pub \
  --vnet-name <your-vnet> --subnet <your-subnet> \
  --public-ip-sku Standard

Step 3 - Connect to your VM

Connect over SSH as azureuser:

ssh azureuser@<vm-public-ip>

Step 4 - Confirm Telegraf is installed and running

Check the Telegraf version and confirm that the service is active:

telegraf --version systemctl is-active telegraf

telegraf --version reports Telegraf 1.x, and systemctl is-active telegraf prints active.

Step 5 - Review the sample configuration

The ready-to-run configuration is at /etc/telegraf/telegraf.conf. It collects host metrics every 10 seconds from the cpu, mem, disk, system and net input plugins, and sends the stream to two outputs: a file under /var/log/telegraf/ and a Prometheus client endpoint. View the file:

cat /etc/telegraf/telegraf.conf

Step 6 - Collect metrics on demand with telegraf --test

Run a single collection across every configured input and print the metrics to your terminal in line protocol. This is a quick way to see exactly what Telegraf gathers, without touching the running service:

telegraf --test

Each line is a measurement (mem, disk, system, net, and after a couple of intervals cpu) stamped with your hostname and the sac-sample pipeline tag.

Step 7 - Scrape the Prometheus metrics endpoint

The outputs.prometheus_client plugin exposes the collected series on 127.0.0.1:9273. This is the health and scrape endpoint. It returns HTTP 200 with every collected metric in Prometheus exposition format:

curl -s http://127.0.0.1:9273/metrics | sed -n '1,20p'

You will see cpu_usage_*, mem_used*, disk_*, system_* and net_* series, each labeled with the host and pipeline tag.

Step 8 - Watch metrics flow to the file output

The outputs.file plugin writes every collected metric to /var/log/telegraf/metrics.out in InfluxDB line protocol. Tail the file to see the live stream:

tail -n 5 /var/log/telegraf/metrics.out

Step 9 - Customize the configuration

Edit /etc/telegraf/telegraf.conf to add your own inputs and outputs, then restart the service. These are a few common building blocks:

# Collect Docker container metrics [[inputs.docker]] endpoint = "unix:///var/run/docker.sock"
# Scrape an HTTP/JSON API [[inputs.http]] urls = ["http://localhost:8080/metrics"] data_format = "prometheus"
# Write to a remote InfluxDB v2 [[outputs.influxdb_v2]] urls = ["https://your-influxdb:8086"] token = "$INFLUX_TOKEN" organization = "your-org" bucket = "telegraf"

After editing, validate and apply your changes:

sudo telegraf --config /etc/telegraf/telegraf.conf --test sudo systemctl restart telegraf

Telegraf ships more than 240 input plugins and dozens of outputs (InfluxDB, Prometheus, Kafka, Elasticsearch, MQTT, Graphite, CloudWatch, Azure Monitor, and many more). See the Telegraf documentation for the full plugin catalog.

Maintenance

  • Service: managed by systemd. Use systemctl status telegraf and journalctl -u telegraf.
  • Configuration: /etc/telegraf/telegraf.conf. Validate with telegraf --test and restart the service after edits.
  • Monitoring: the Prometheus client endpoint on 127.0.0.1:9273/metrics exposes every collected series. Point your Prometheus scrape configuration or an SSH tunnel at it.
  • Upgrades: the package is not held. To upgrade, run sudo apt-get update && sudo apt-get install --only-upgrade telegraf.
  • Security patches: unattended-upgrades stays enabled, so the OS keeps receiving security updates automatically.

Support

SecureAnyCloud provides 24/7 expert support for this image. Contact sales@secureanycloud.com.

Telegraf is a trademark of InfluxData Inc. SecureAnyCloud is not affiliated with or endorsed by InfluxData Inc.

Deploy on Azure

Launch Telegraf on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.

View this image

Need Help?

Our support team is available 24/7.

sales@secureanycloud.com

Deploy on Azure