{"id":35808,"date":"2026-03-18T04:16:49","date_gmt":"2026-03-18T01:16:49","guid":{"rendered":"https:\/\/computingforgeeks.com\/?p=35808"},"modified":"2026-03-24T12:02:50","modified_gmt":"2026-03-24T09:02:50","slug":"install-telegraf-debian","status":"publish","type":"post","link":"https:\/\/computingforgeeks.com\/install-telegraf-debian\/","title":{"rendered":"Install and Configure Telegraf on Debian 13\/12"},"content":{"rendered":"\n<p>Telegraf is an open-source, plugin-driven server agent built by InfluxData for collecting, processing, and writing metrics. It is part of the TICK stack (Telegraf, InfluxDB, Chronograf, Kapacitor) and supports over 300 input and output plugins out of the box. If you run infrastructure at any reasonable scale, Telegraf is one of the most practical tools for getting system and application metrics into a time-series database like InfluxDB, then visualizing them in Grafana.<\/p>\n\n\n\n<p>This guide walks through installing Telegraf on Debian 13 (Trixie) or Debian 12 (Bookworm) from the official InfluxData repository, configuring it to collect system and application metrics, shipping those metrics to InfluxDB v2, and building a Grafana dashboard on top of the data.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What Telegraf Does<\/h2>\n\n\n\n<p>Telegraf runs as a lightweight agent on your servers. It pulls metrics from configured inputs (CPU, memory, disk, network, Docker, Nginx, PostgreSQL, and hundreds more), applies optional processing or aggregation, and pushes the results to one or more output destinations. The most common setup pairs Telegraf with InfluxDB for storage and Grafana for visualization.<\/p>\n\n\n\n<p>Key characteristics:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Written in Go &#8211; single binary, no external dependencies<\/li>\n\n\n\n<li>Plugin architecture &#8211; inputs, outputs, processors, and aggregators are all plugins<\/li>\n\n\n\n<li>Low memory footprint &#8211; typically uses 50-100MB of RAM<\/li>\n\n\n\n<li>Pull and push models &#8211; can scrape endpoints or receive pushed data<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p>Before you begin, make sure you have the following in place:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A server running Debian 13 (Trixie) or Debian 12 (Bookworm)<\/li>\n\n\n\n<li>Root or sudo access<\/li>\n\n\n\n<li>InfluxDB v2 installed and running (local or remote) &#8211; needed for the output configuration<\/li>\n\n\n\n<li>Grafana installed (optional, for visualization)<\/li>\n\n\n\n<li>Internet access to reach the InfluxData package repository<\/li>\n<\/ul>\n\n\n\n<p>Update your system packages first:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update && sudo apt upgrade -y<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1 &#8211; Add the InfluxData Repository<\/h2>\n\n\n\n<p>Telegraf is not in the default Debian repositories. You need to add the official InfluxData apt repository to get the latest stable release.<\/p>\n\n\n\n<p>Install the prerequisite packages:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install -y curl gnupg2 apt-transport-https software-properties-common<\/code><\/pre>\n\n\n\n<p>Import the InfluxData GPG key:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -fsSL https:\/\/repos.influxdata.com\/influxdata-archive_compat.key | sudo gpg --dearmor -o \/etc\/apt\/trusted.gpg.d\/influxdata-archive.gpg<\/code><\/pre>\n\n\n\n<p>Add the InfluxData repository:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \"deb [signed-by=\/etc\/apt\/trusted.gpg.d\/influxdata-archive.gpg] https:\/\/repos.influxdata.com\/debian stable main\" | sudo tee \/etc\/apt\/sources.list.d\/influxdata.list<\/code><\/pre>\n\n\n\n<p><strong>Verify<\/strong> the repository file was created:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cat \/etc\/apt\/sources.list.d\/influxdata.list<\/code><\/pre>\n\n\n\n<p>You should see the repository line pointing to <code>https:\/\/repos.influxdata.com\/debian stable main<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2 &#8211; Install Telegraf<\/h2>\n\n\n\n<p>Update the package index and install Telegraf:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\nsudo apt install -y telegraf<\/code><\/pre>\n\n\n\n<p><strong>Verify<\/strong> the installation:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>telegraf --version<\/code><\/pre>\n\n\n\n<p>Expected output (version number may differ):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Telegraf 1.33.x (git: HEAD xxxxxxxx)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3 &#8211; Enable and Start Telegraf<\/h2>\n\n\n\n<p>Enable Telegraf to start on boot and start the service:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl enable --now telegraf<\/code><\/pre>\n\n\n\n<p><strong>Verify<\/strong> the service is running:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl status telegraf<\/code><\/pre>\n\n\n\n<p>You should see <code>active (running)<\/code> in the output. If it shows a failure, check the logs:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo journalctl -u telegraf --no-pager -n 50<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4 &#8211; Configure Telegraf (telegraf.conf)<\/h2>\n\n\n\n<p>The main configuration file lives at <code>\/etc\/telegraf\/telegraf.conf<\/code>. The default file is heavily commented and contains examples for every plugin. For a production setup, I recommend starting with a clean configuration and adding only what you need.<\/p>\n\n\n\n<p>Back up the original configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo cp \/etc\/telegraf\/telegraf.conf \/etc\/telegraf\/telegraf.conf.bak<\/code><\/pre>\n\n\n\n<p>Generate a fresh config with specific plugins:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo telegraf --input-filter cpu:mem:disk:diskio:net:system:docker:nginx:postgresql --output-filter influxdb_v2 config | sudo tee \/etc\/telegraf\/telegraf.conf<\/code><\/pre>\n\n\n\n<p>This gives you a config file with only the input and output plugins you actually need. Now edit it to match your environment:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/telegraf\/telegraf.conf<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Global Tags and Agent Settings<\/h3>\n\n\n\n<p>Set global tags to identify this host in your metrics. These tags get appended to every metric Telegraf collects:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[global_tags]\n  environment = \"production\"\n  datacenter = \"eu-west-1\"\n\n[agent]\n  interval = \"10s\"\n  round_interval = true\n  metric_batch_size = 1000\n  metric_buffer_limit = 10000\n  collection_jitter = \"0s\"\n  flush_interval = \"10s\"\n  flush_jitter = \"0s\"\n  precision = \"\"\n  hostname = \"\"\n  omit_hostname = false<\/code><\/pre>\n\n\n\n<p>The <code>interval<\/code> setting controls how often Telegraf collects metrics. 10 seconds is a good default for most setups. Reduce it to 5s if you need higher resolution, but be aware of the increased load on InfluxDB.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Configure the InfluxDB v2 Output<\/h3>\n\n\n\n<p>This is the output section that ships metrics to InfluxDB v2. Replace the placeholder values with your actual InfluxDB details:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[[outputs.influxdb_v2]]\n  urls = [\"http:\/\/127.0.0.1:8086\"]\n  token = \"your-influxdb-api-token\"\n  organization = \"your-org\"\n  bucket = \"telegraf\"<\/code><\/pre>\n\n\n\n<p>To generate an API token in InfluxDB v2, use the InfluxDB UI or the CLI:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>influx auth create --org your-org --description \"Telegraf write token\" --write-buckets<\/code><\/pre>\n\n\n\n<p>Make sure the bucket exists. Create it if it does not:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>influx bucket create --name telegraf --org your-org --retention 30d<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Configure Input Plugins<\/h3>\n\n\n\n<p>Here are the input plugin configurations for each data source.<\/p>\n\n\n\n<p><strong>CPU metrics:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[[inputs.cpu]]\n  percpu = true\n  totalcpu = true\n  collect_cpu_time = false\n  report_active = false<\/code><\/pre>\n\n\n\n<p><strong>Memory metrics:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[[inputs.mem]]\n  # No additional configuration needed<\/code><\/pre>\n\n\n\n<p><strong>Disk metrics:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[[inputs.disk]]\n  ignore_fs = [\"tmpfs\", \"devtmpfs\", \"devfs\", \"iso9660\", \"overlay\", \"aufs\", \"squashfs\"]\n\n[[inputs.diskio]]\n  # Collect I\/O stats for all devices<\/code><\/pre>\n\n\n\n<p><strong>Network metrics:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[[inputs.net]]\n  interfaces = [\"eth0\", \"ens*\"]\n  ignore_protocol_stats = false<\/code><\/pre>\n\n\n\n<p><strong>System metrics<\/strong> (uptime, load, etc.):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[[inputs.system]]\n  # Collects load averages, uptime, number of users<\/code><\/pre>\n\n\n\n<p><strong>Docker metrics<\/strong> (requires the telegraf user to be in the docker group):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[[inputs.docker]]\n  endpoint = \"unix:\/\/\/var\/run\/docker.sock\"\n  gather_services = false\n  container_names = []\n  timeout = \"5s\"\n  perdevice = true\n  total = false<\/code><\/pre>\n\n\n\n<p>Add the telegraf user to the docker group so it can access the Docker socket:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo usermod -aG docker telegraf\nsudo systemctl restart telegraf<\/code><\/pre>\n\n\n\n<p><strong>Nginx metrics<\/strong> (requires the stub_status module):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[[inputs.nginx]]\n  urls = [\"http:\/\/127.0.0.1\/nginx_status\"]<\/code><\/pre>\n\n\n\n<p>Make sure your Nginx configuration includes a stub_status location block:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>server {\n    listen 127.0.0.1:80;\n    location \/nginx_status {\n        stub_status on;\n        allow 127.0.0.1;\n        deny all;\n    }\n}<\/code><\/pre>\n\n\n\n<p><strong>PostgreSQL metrics:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[[inputs.postgresql]]\n  address = \"host=localhost user=telegraf password=yourpassword dbname=postgres sslmode=disable\"\n  databases = [\"postgres\"]<\/code><\/pre>\n\n\n\n<p>Create a dedicated PostgreSQL user for Telegraf with read-only access:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo -u postgres psql -c \"CREATE USER telegraf WITH PASSWORD 'yourpassword';\"\nsudo -u postgres psql -c \"GRANT pg_monitor TO telegraf;\"<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5 &#8211; Test the Configuration<\/h2>\n\n\n\n<p>Before restarting Telegraf with the new config, validate it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo telegraf --config \/etc\/telegraf\/telegraf.conf --test<\/code><\/pre>\n\n\n\n<p>The <code>--test<\/code> flag runs all configured input plugins once and prints the collected metrics to stdout without sending them to the output. This is the single most useful debugging command for Telegraf.<\/p>\n\n\n\n<p>You should see output like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>> cpu,cpu=cpu-total,host=debian-server usage_idle=98.5,usage_system=0.8,usage_user=0.7 1710000000000000000\n> mem,host=debian-server available=6442450944i,total=8589934592i,used=2147483648i 1710000000000000000\n> disk,device=sda1,fstype=ext4,host=debian-server,path=\/ free=42949672960i,total=107374182400i,used=64424509440i 1710000000000000000<\/code><\/pre>\n\n\n\n<p>If a specific input plugin has errors (for example, Docker socket permission denied), the error will show up clearly in the test output. Fix it before proceeding.<\/p>\n\n\n\n<p>You can also test a single input plugin in isolation:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo telegraf --config \/etc\/telegraf\/telegraf.conf --input-filter cpu --test<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 6 &#8211; Restart Telegraf and Verify Metrics Collection<\/h2>\n\n\n\n<p>Apply the new configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart telegraf<\/code><\/pre>\n\n\n\n<p><strong>Verify<\/strong> the service restarted cleanly:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl status telegraf\nsudo journalctl -u telegraf --no-pager -n 20<\/code><\/pre>\n\n\n\n<p>Check that metrics are arriving in InfluxDB. Use the InfluxDB CLI to query:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>influx query 'from(bucket: \"telegraf\") |> range(start: -5m) |> filter(fn: (r) => r._measurement == \"cpu\") |> limit(n: 5)' --org your-org<\/code><\/pre>\n\n\n\n<p>If you see results, Telegraf is successfully collecting and shipping metrics to InfluxDB.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 7 &#8211; View Metrics in Grafana<\/h2>\n\n\n\n<p>With metrics flowing into InfluxDB, you can now build Grafana dashboards to visualize the data.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Add InfluxDB as a Data Source in Grafana<\/h3>\n\n\n\n<p>Open Grafana in your browser (default: <code>http:\/\/your-server:3000<\/code>), then:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to <strong>Connections<\/strong> &#8211; <strong>Data Sources<\/strong> &#8211; <strong>Add data source<\/strong><\/li>\n\n\n\n<li>Select <strong>InfluxDB<\/strong><\/li>\n\n\n\n<li>Set the query language to <strong>Flux<\/strong><\/li>\n\n\n\n<li>Enter the InfluxDB URL: <code>http:\/\/127.0.0.1:8086<\/code><\/li>\n\n\n\n<li>Enter your organization name, API token, and default bucket (<code>telegraf<\/code>)<\/li>\n\n\n\n<li>Click <strong>Save &amp; Test<\/strong> to verify the connection<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Import a Pre-built Dashboard<\/h3>\n\n\n\n<p>Rather than building panels from scratch, import a community dashboard. Grafana dashboard ID <strong>928<\/strong> (Telegraf System Dashboard) works well as a starting point:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to <strong>Dashboards<\/strong> &#8211; <strong>Import<\/strong><\/li>\n\n\n\n<li>Enter dashboard ID <code>928<\/code> and click <strong>Load<\/strong><\/li>\n\n\n\n<li>Select your InfluxDB data source<\/li>\n\n\n\n<li>Click <strong>Import<\/strong><\/li>\n<\/ol>\n\n\n\n<p>This gives you panels for CPU usage, memory usage, disk I\/O, network traffic, and system load out of the box.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Build a Custom Panel<\/h3>\n\n\n\n<p>To create a custom panel, for example CPU usage over the last hour, use a Flux query like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from(bucket: \"telegraf\")\n  |> range(start: -1h)\n  |> filter(fn: (r) => r._measurement == \"cpu\")\n  |> filter(fn: (r) => r._field == \"usage_idle\")\n  |> filter(fn: (r) => r.cpu == \"cpu-total\")\n  |> aggregateWindow(every: 1m, fn: mean, createEmpty: false)\n  |> map(fn: (r) => ({ r with _value: 100.0 - r._value }))<\/code><\/pre>\n\n\n\n<p>This query calculates CPU usage by subtracting idle percentage from 100, aggregated in 1-minute windows.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 8 &#8211; Custom Input Plugins<\/h2>\n\n\n\n<p>Telegraf supports drop-in configuration files. Instead of packing everything into the main <code>telegraf.conf<\/code>, put custom plugin configs in <code>\/etc\/telegraf\/telegraf.d\/<\/code>. Telegraf loads all <code>.conf<\/code> files from this directory automatically.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">HTTP Response Check<\/h3>\n\n\n\n<p>Monitor whether your web application is responding:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo tee \/etc\/telegraf\/telegraf.d\/http_response.conf &lt;&lt;'EOF'\n[[inputs.http_response]]\n  urls = [\"https:\/\/example.com\", \"https:\/\/api.example.com\/health\"]\n  response_timeout = \"5s\"\n  method = \"GET\"\n  follow_redirects = true\n  response_string_match = \"ok\"\n  [inputs.http_response.tags]\n    check = \"uptime\"\nEOF<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Exec Plugin &#8211; Custom Script Output<\/h3>\n\n\n\n<p>Run a custom script and collect its output as metrics:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo tee \/etc\/telegraf\/telegraf.d\/custom_script.conf &lt;&lt;'EOF'\n[[inputs.exec]]\n  commands = [\"\/usr\/local\/bin\/custom_metrics.sh\"]\n  timeout = \"10s\"\n  data_format = \"influx\"\n  name_suffix = \"_custom\"\nEOF<\/code><\/pre>\n\n\n\n<p>The script should output data in InfluxDB line protocol format:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n# \/usr\/local\/bin\/custom_metrics.sh\necho \"app_queue_depth,queue=email value=$(wc -l < \/var\/spool\/mail\/queue 2>\/dev\/null || echo 0)\"<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Prometheus Input<\/h3>\n\n\n\n<p>Scrape any Prometheus-compatible metrics endpoint:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo tee \/etc\/telegraf\/telegraf.d\/prometheus.conf &lt;&lt;'EOF'\n[[inputs.prometheus]]\n  urls = [\"http:\/\/localhost:9090\/metrics\", \"http:\/\/localhost:8080\/metrics\"]\n  metric_version = 2\nEOF<\/code><\/pre>\n\n\n\n<p>After adding any new plugin configs, restart Telegraf:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart telegraf\nsudo telegraf --config \/etc\/telegraf\/telegraf.conf --config-directory \/etc\/telegraf\/telegraf.d --test<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 9 &#8211; Monitoring System Services<\/h2>\n\n\n\n<p>Telegraf can monitor the state of systemd services, which is useful for alerting when a service goes down.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo tee \/etc\/telegraf\/telegraf.d\/systemd_services.conf &lt;&lt;'EOF'\n[[inputs.systemd_units]]\n  unittype = \"service\"\n  pattern = \"nginx* postgresql* docker* influxdb* grafana*\"\n  timeout = \"5s\"\nEOF<\/code><\/pre>\n\n\n\n<p>This plugin reports the active state, load state, and sub state of each matched service. You can then set up Grafana alerts to notify you when any service leaves the &#8220;running&#8221; state.<\/p>\n\n\n\n<p><strong>Verify<\/strong> the systemd service monitoring is working:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo telegraf --config \/etc\/telegraf\/telegraf.d\/systemd_services.conf --test<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting<\/h2>\n\n\n\n<p>Here are the most common issues you will run into and how to fix them.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Telegraf fails to start<\/h3>\n\n\n\n<p>Check the journal for the exact error:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo journalctl -u telegraf --no-pager -n 100<\/code><\/pre>\n\n\n\n<p>Most startup failures come from syntax errors in the config file. Validate the configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo telegraf --config \/etc\/telegraf\/telegraf.conf --test 2>&1 | head -20<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Permission denied on Docker socket<\/h3>\n\n\n\n<p>The telegraf user needs to be in the docker group:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo usermod -aG docker telegraf\nsudo systemctl restart telegraf<\/code><\/pre>\n\n\n\n<p>Verify group membership:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>groups telegraf<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Metrics not appearing in InfluxDB<\/h3>\n\n\n\n<p>Check the following in order:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Is Telegraf running?<\/strong> &#8211; <code>sudo systemctl status telegraf<\/code><\/li>\n\n\n\n<li><strong>Is the output config correct?<\/strong> &#8211; Verify the URL, token, org, and bucket in the <code>[[outputs.influxdb_v2]]<\/code> section<\/li>\n\n\n\n<li><strong>Can Telegraf reach InfluxDB?<\/strong> &#8211; <code>curl -s http:\/\/127.0.0.1:8086\/health<\/code><\/li>\n\n\n\n<li><strong>Is the API token valid?<\/strong> &#8211; Check for 401 errors in the Telegraf logs<\/li>\n\n\n\n<li><strong>Does the bucket exist?<\/strong> &#8211; <code>influx bucket list --org your-org<\/code><\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Nginx input plugin returns connection refused<\/h3>\n\n\n\n<p>Make sure the stub_status module is enabled and the URL in Telegraf matches the Nginx config:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl http:\/\/127.0.0.1\/nginx_status<\/code><\/pre>\n\n\n\n<p>If this returns &#8220;Active connections&#8221; and connection stats, Nginx is configured correctly. If not, check your Nginx configuration and reload it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nginx -t && sudo systemctl reload nginx<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">PostgreSQL authentication failure<\/h3>\n\n\n\n<p>Verify the telegraf database user can connect:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>psql -h localhost -U telegraf -d postgres -c \"SELECT 1;\"<\/code><\/pre>\n\n\n\n<p>If this fails, check <code>pg_hba.conf<\/code> for local authentication rules and make sure the password is correct in the Telegraf config.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">High memory usage<\/h3>\n\n\n\n<p>If Telegraf is using too much memory, reduce the buffer sizes in the agent section:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[agent]\n  metric_batch_size = 500\n  metric_buffer_limit = 5000<\/code><\/pre>\n\n\n\n<p>Also check if any input plugin is collecting an unexpectedly large number of series (common with Docker or Kubernetes plugins on busy hosts).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Debug mode<\/h3>\n\n\n\n<p>For detailed debugging, run Telegraf in the foreground with debug logging:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo telegraf --config \/etc\/telegraf\/telegraf.conf --debug<\/code><\/pre>\n\n\n\n<p>This prints every metric collected and every write to the output, which makes it straightforward to identify where things break down.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>You now have Telegraf running on Debian 13 or Debian 12, collecting system metrics (CPU, memory, disk, network), application metrics (Docker, Nginx, PostgreSQL), and shipping everything to InfluxDB v2. With Grafana connected to InfluxDB, you have a full monitoring pipeline from data collection through visualization.<\/p>\n\n\n\n<p>The drop-in config directory at <code>\/etc\/telegraf\/telegraf.d\/<\/code> makes it easy to add new data sources as your infrastructure grows. Add a new <code>.conf<\/code> file, restart Telegraf, and the metrics start flowing. For a full list of available plugins, check the <a href=\"https:\/\/docs.influxdata.com\/telegraf\/latest\/plugins\/\" target=\"_blank\" rel=\"noopener\">official Telegraf plugin documentation<\/a>.<\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>Telegraf is an open-source, plugin-driven server agent built by InfluxData for collecting, processing, and writing metrics. It is part of the TICK stack (Telegraf, InfluxDB, Chronograf, Kapacitor) and supports over 300 input and output plugins out of the box. If you run infrastructure at any reasonable scale, Telegraf is one of the most practical tools &#8230; <a title=\"Install and Configure Telegraf on Debian 13\/12\" class=\"read-more\" href=\"https:\/\/computingforgeeks.com\/install-telegraf-debian\/\" aria-label=\"Read more about Install and Configure Telegraf on Debian 13\/12\">Read more<\/a><\/p>\n","protected":false},"author":3,"featured_media":35857,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[165,26,299,50],"tags":[342,393],"class_list":["post-35808","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-monitoring","category-debian","category-how-to","category-linux-tutorials","tag-monitoring","tag-telegraf"],"_links":{"self":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/35808","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/comments?post=35808"}],"version-history":[{"count":2,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/35808\/revisions"}],"predecessor-version":[{"id":164142,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/35808\/revisions\/164142"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media\/35857"}],"wp:attachment":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media?parent=35808"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/categories?post=35808"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/tags?post=35808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}