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.servicesystemd unit from the package, enabled and running on boot - A sample configuration at
/etc/telegraf/telegraf.conf:cpu,mem,disk,systemandnetinputs, 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 StandardStep 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 telegraftelegraf --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.confStep 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 --testEach 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.outStep 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 telegrafTelegraf 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 telegrafandjournalctl -u telegraf. - Configuration:
/etc/telegraf/telegraf.conf. Validate withtelegraf --testand restart the service after edits. - Monitoring: the Prometheus client endpoint on
127.0.0.1:9273/metricsexposes 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
Overview
This image runs Telegraf, the open-source, plugin-driven server agent for collecting and reporting metrics, events and logs. With hundreds of input plugins, Telegraf gathers telemetry from the host, containers, databases, message queues, cloud services and any StatsD, SNMP, Prometheus or HTTP source. It processes and aggregates the data, then writes it to dozens of output destinations, including InfluxDB, Prometheus, Graphite, Kafka, CloudWatch, OpenTSDB and any HTTP endpoint.
The image is a ready-to-use metrics appliance. telegraf.service is enabled and starts on boot, running a self-contained sample pipeline. By the time you connect over SSH, the agent is already collecting and serving host metrics.
What you get:
- A headless metrics-agent service with no web interface and no credentials to manage.
- Telegraf running as a long-lived daemon, installed from the official InfluxData package repository.
- A TOML configuration file at
/etc/telegraf/telegraf.conf, plus a drop-in directory at/etc/telegraf/telegraf.d/. - A built-in Prometheus client output that is enabled but bound to loopback only (
127.0.0.1:9273), so the metrics endpoint answers on the instance without being exposed to the network. - A security group that opens port 22 only. You open whatever scrape or forward ports your own pipeline needs.
- A dedicated, independently resizable EBS data volume mounted at
/var/lib/telegraf. The sample file output persists metrics as line protocol on this durable storage instead of the operating system disk, and you can point your own file or buffered outputs at the same volume.
Prerequisites
Before you deploy this image, make sure you have the following:
- An Amazon Web Services account where you can launch EC2 instances
- IAM permissions to launch instances, create security groups, and subscribe to AWS Marketplace products
- An EC2 key pair in the target Region for SSH access to the instance
- A VPC and subnet in the target Region, with a security group allowing inbound port 22 from your management network
- The AWS CLI (version 2) installed locally if you plan to deploy from the command line
Launch the Instance from the AWS Marketplace
Sign in to the AWS Management Console, open the EC2 service, and select Launch instance. Under Application and OS Images, choose AWS Marketplace AMIs and search for Telegraf. Select the SecureAnyCloud listing, choose Select, then choose Continue on the subscription summary.
Pick an instance type of t3.small or larger. Choose your EC2 key pair under Key pair (login). Under Network settings, select your VPC and subnet, and create or select a security group that opens port 22 from your management network. Leave the root volume at the default size or larger.
Select Launch instance. First-boot initialization takes a few seconds after the instance state becomes Running and the status checks pass. telegraf.service is already running its sample pipeline by the time you can connect.
Launch the Instance from the AWS CLI
The following command launches an instance from the SecureAnyCloud Telegraf Marketplace AMI into an existing subnet and security group. Replace <ami-id> with the AMI ID shown on the Marketplace listing. Replace <key-name> with your EC2 key pair name and <subnet-id> with your subnet ID. Replace <security-group-id> with a security group that opens port 22 from your management network.
aws ec2 run-instances \
--image-id <ami-id> \
--instance-type t3.small \
--key-name <key-name> \
--subnet-id <subnet-id> \
--security-group-ids <security-group-id> \
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=telegraf}]'When the instance reaches the Running state and its status checks pass, note its public IP address or DNS name. You can find it in the EC2 console or with aws ec2 describe-instances.
Connect to Your Instance
Connect over SSH using your key pair. The login user on the Ubuntu 24.04 variant is ubuntu:
ssh -i <key-name>.pem ubuntu@<public-ip>A welcome banner prints the most useful commands. Run sudo cat /root/telegraf-info.txt to see the full getting-started notes. They cover what is running, the Prometheus endpoint, where the pipeline configuration lives, the file output path, the common input, processor and output plugins, and how to validate and reload the configuration.
Verify the Service
Telegraf runs as a system service that is enabled and started on boot. Confirm that the daemon is active:
systemctl is-active telegrafThe command prints active. To see the full unit status, including the main PID, memory use and the command line the daemon is running, run:
systemctl status telegraf --no-pagerConfirm the installed binary and the Telegraf version, which is pinned to 1.39.0 on this image:
telegraf --versionThe output reports Telegraf 1.39.0. The telegraf binary is on the system path at /usr/bin/telegraf. The package installs the telegraf.service systemd unit, which runs the agent as the dedicated telegraf user.
The Metrics Endpoint
Telegraf ships with a built-in Prometheus client output. On this image it is enabled and bound to loopback only (127.0.0.1:9273), so the metrics endpoint answers on the instance but is never exposed to the network. The endpoint serves a standard Prometheus exposition page with the live host metrics that the sample input plugins collect. Query it:
curl -s http://127.0.0.1:9273/metrics | grep -E "^(cpu_usage_idle|mem_used_percent|system_uptime)" | headThe output shows the cpu_usage_idle, mem_used_percent and system_uptime measurements with their current values, each tagged with the host. This confirms that the input plugins are collecting host telemetry and that the output is serving it, not merely loaded. To list the metric families that the agent exposes, run:
curl -s http://127.0.0.1:9273/metrics | grep "^# TYPE" | head -20To scrape Telegraf from a Prometheus server, change the listen address in the outputs.prometheus_client block of the configuration to a routable interface, and open port 9273 in the instance security group yourself. The read-only endpoint stays private by default.
Edit the Pipeline
Telegraf reads its pipeline from a simple TOML configuration file at /etc/telegraf/telegraf.conf, with optional drop-in snippets under /etc/telegraf/telegraf.d/. The shipped configuration is a self-contained sample that needs no external dependencies. List the configuration directory:
ls /etc/telegraf/The shipped sample pairs the cpu, mem, disk and system input plugins (real host telemetry on a 10-second interval) with the prometheus_client output (the loopback metrics endpoint) and a file output that persists the metrics as line protocol on the data volume. Read the input and output blocks:
grep -vE "^\s*#|^\s*$" /etc/telegraf/telegraf.confTo build your own pipeline, enable the plugins you need. Common input plugins collect data from your sources: cpu, mem, disk, net and system for the host, docker for containers, postgresql, mysql and redis for databases, kafka for queues, and snmp, prometheus, statsd, http and exec for protocols and custom sources. Chain processor and aggregator plugins (converter, regex, enum, basicstats, histogram) to transform, enrich and roll up the stream. Send the stream to output plugins to ship the metrics: influxdb/influxdb_v2, prometheus_client, graphite, kafka, cloudwatch, opentsdb, http and file. The single static binary bundles the entire plugin set, so most sources and destinations need only a configuration block and no extra installs.
After you edit the configuration, validate it, then restart the service to apply your changes. These commands test and reload your pipeline:
sudo telegraf --config /etc/telegraf/telegraf.conf --test sudo systemctl restart telegrafThe --test run loads the configuration, runs one collection cycle, prints the metrics it gathered, and exits without starting the daemon. It is a quick way to confirm that a new input works. Open whatever scrape or forward ports your pipeline needs in the instance security group.
The Data Volume
The sample file output writes to a dedicated EBS volume mounted at /var/lib/telegraf. This keeps the persisted metrics off the operating system disk and lets you resize or snapshot the volume independently. Confirm the mount and watch the metrics flow:
df -h /var/lib/telegraf
sudo tail -n 4 /var/lib/telegraf/telegraf-metrics.outThe sample output appends the collected metrics as InfluxDB line protocol to /var/lib/telegraf/telegraf-metrics.out, one line per measurement per collection cycle. To grow the volume, expand the EBS volume in the AWS console, then grow the file system on the instance by running sudo resize2fs on the underlying device. Point your own file or buffered outputs at this volume to give them the same durable, independently resizable storage.
Support
This image is published and supported by SecureAnyCloud. Support covers input and output plugin configuration, processors and aggregators, tagging and filtering, metric buffering, routing to your observability backend, the metrics endpoint, and upgrade planning. To reach SecureAnyCloud, use the support channel listed on the AWS Marketplace listing.
All product and company names are trademarks or registered trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.
Deploy on AWS
Launch Telegraf with 24/7 support from SecureAnyCloud.
View on Marketplace
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com