telegraf
Agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
Top Related Projects
The Prometheus monitoring system and time series database.
The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
Architected for speed. Automated for easy. Monitoring and troubleshooting, transformed!
The system statistics collection daemon. Please send Pull Requests here!
:tropical_fish: Beats - Lightweight shippers for Elasticsearch & Logstash
Main repository for Datadog Agent
Quick Overview
Telegraf is an open-source server agent for collecting, processing, aggregating, and writing metrics. It is plugin-driven, supporting various input sources, output destinations, and processors for data manipulation. Telegraf is designed to be lightweight and efficient, making it ideal for monitoring and metrics collection in diverse environments.
Pros
- Highly extensible with a wide range of plugins for inputs, outputs, and processors
- Low resource footprint and efficient performance
- Easy to configure and deploy
- Integrates well with InfluxDB and other time-series databases
Cons
- Learning curve for advanced configurations and custom plugins
- Some plugins may have limitations or inconsistencies
- Documentation can be overwhelming due to the large number of plugins
- Troubleshooting complex setups can be challenging
Code Examples
- Basic configuration to collect system metrics and write to InfluxDB:
[[inputs.cpu]]
[[inputs.mem]]
[[inputs.disk]]
[[outputs.influxdb]]
urls = ["http://localhost:8086"]
database = "telegraf"
- Using a processor to convert temperature from Celsius to Fahrenheit:
[[processors.converter]]
[processors.converter.fields]
temperature = "float"
[[processors.converter.fields.temperature]]
operation = "multiply"
value = 1.8
[[processors.converter.fields.temperature]]
operation = "add"
value = 32.0
- Collecting Docker metrics:
[[inputs.docker]]
endpoint = "unix:///var/run/docker.sock"
container_names = []
timeout = "5s"
perdevice = true
total = false
Getting Started
To get started with Telegraf:
- Install Telegraf on your system (e.g.,
sudo apt-get install telegraf
on Ubuntu) - Create a configuration file at
/etc/telegraf/telegraf.conf
- Add input and output plugins to the configuration file
- Start the Telegraf service:
sudo service telegraf start
Example minimal configuration:
[agent]
interval = "10s"
[[inputs.cpu]]
[[inputs.mem]]
[[outputs.file]]
files = ["stdout"]
data_format = "influx"
This configuration collects CPU and memory metrics every 10 seconds and writes them to stdout in InfluxDB line protocol format.
Competitor Comparisons
The Prometheus monitoring system and time series database.
Pros of Prometheus
- Built-in alerting and query language (PromQL) for powerful data analysis
- Native support for service discovery and dynamic environments
- Highly scalable and efficient time-series database
Cons of Prometheus
- Limited long-term storage options without additional components
- Pull-based model may not be suitable for all network architectures
- Less flexible data model compared to Telegraf's tag-based system
Code Comparison
Prometheus configuration (prometheus.yml):
scrape_configs:
- job_name: 'node'
static_configs:
- targets: ['localhost:9100']
Telegraf configuration (telegraf.conf):
[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
report_active = false
Key Differences
- Data collection: Prometheus uses a pull model, while Telegraf uses a push model.
- Storage: Prometheus includes its own time-series database, whereas Telegraf is primarily a data collection agent.
- Query language: Prometheus offers PromQL, while Telegraf relies on the query language of the connected database.
- Extensibility: Telegraf has a wider range of input plugins and output formats compared to Prometheus.
- Use cases: Prometheus is often used for monitoring containerized environments, while Telegraf is more versatile for various data collection scenarios.
Both projects are widely adopted in the monitoring and observability space, with Prometheus being more focused on metrics and alerting, while Telegraf offers broader data collection capabilities.
The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
Pros of Grafana
- Powerful visualization and dashboarding capabilities
- Supports multiple data sources, not limited to time-series databases
- Extensive plugin ecosystem for additional functionality
Cons of Grafana
- Primarily focused on data visualization, not data collection
- Steeper learning curve for complex dashboard creation
- Requires separate data collection and storage solutions
Code Comparison
Telegraf configuration (telegraf.conf):
[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
report_active = false
Grafana dashboard JSON snippet:
{
"datasource": "InfluxDB",
"fieldConfig": {
"defaults": {
"color": {"mode": "palette-classic"},
"custom": {"axisLabel": "", "axisPlacement": "auto"}
}
}
}
Summary
Telegraf is a plugin-driven server agent for collecting and reporting metrics, while Grafana is a multi-platform open-source analytics and interactive visualization web application. Telegraf excels at data collection from various sources, whereas Grafana shines in creating visually appealing dashboards and graphs. While they serve different primary purposes, they often complement each other in monitoring and observability stacks, with Telegraf collecting data that Grafana can then visualize.
Architected for speed. Automated for easy. Monitoring and troubleshooting, transformed!
Pros of Netdata
- Real-time monitoring with per-second granularity
- User-friendly web interface with interactive dashboards
- Minimal system resource usage
Cons of Netdata
- Limited long-term data storage capabilities
- Less extensive plugin ecosystem compared to Telegraf
Code Comparison
Netdata configuration (netdata.conf):
[global]
update every = 1
memory mode = ram
Telegraf configuration (telegraf.conf):
[agent]
interval = "10s"
round_interval = true
Key Differences
- Netdata focuses on real-time monitoring with a built-in web interface, while Telegraf is primarily a data collection agent that sends metrics to various backends.
- Netdata excels in immediate visualization and alerting, whereas Telegraf is more flexible in terms of data output and integration with different time-series databases.
- Netdata is easier to set up for quick monitoring, while Telegraf offers more customization options for complex monitoring scenarios.
Both projects are open-source and actively maintained, with strong community support. The choice between them depends on specific monitoring requirements, existing infrastructure, and desired level of customization.
The system statistics collection daemon. Please send Pull Requests here!
Pros of collectd
- Mature and well-established project with a long history
- Extensive plugin ecosystem with support for many data sources
- Lightweight and efficient, suitable for resource-constrained environments
Cons of collectd
- Less flexible configuration compared to Telegraf
- Limited built-in output options for modern time-series databases
- Slower development cycle and fewer updates
Code Comparison
collectd configuration example:
<Plugin cpu>
ReportByCpu true
ReportByState true
ValuesPercentage true
</Plugin>
Telegraf configuration example:
[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
report_active = false
Both collectd and Telegraf are popular open-source monitoring agents used for collecting and reporting system and application metrics. While collectd has been around longer and offers a wide range of plugins, Telegraf provides more flexibility and better integration with modern time-series databases like InfluxDB. Telegraf's configuration is generally considered more user-friendly, using TOML format compared to collectd's XML-based config. Telegraf also has a more active development community and frequent updates, making it a popular choice for modern monitoring setups.
:tropical_fish: Beats - Lightweight shippers for Elasticsearch & Logstash
Pros of Beats
- Tightly integrated with the Elastic Stack ecosystem
- Specialized data shippers for specific use cases (e.g., Filebeat, Metricbeat)
- Extensive built-in modules for common data sources
Cons of Beats
- Less flexible for custom data collection compared to Telegraf
- Primarily designed for use with Elasticsearch, limiting output options
- Steeper learning curve for users not familiar with the Elastic ecosystem
Code Comparison
Telegraf configuration example:
[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
report_active = false
[[outputs.influxdb]]
urls = ["http://localhost:8086"]
Beats configuration example (Metricbeat):
metricbeat.modules:
- module: system
metricsets: ["cpu"]
enabled: true
period: 10s
output.elasticsearch:
hosts: ["localhost:9200"]
Both projects use configuration files, but Telegraf uses TOML format while Beats uses YAML. Telegraf's configuration is more concise and allows for easy addition of multiple inputs and outputs. Beats configuration is more structured and module-oriented, reflecting its specialized nature for specific data types.
Main repository for Datadog Agent
Pros of datadog-agent
- Comprehensive monitoring solution with built-in integrations for various services and platforms
- Advanced features like APM, log management, and real-time alerting
- Robust support and documentation from Datadog
Cons of datadog-agent
- Closed-source and proprietary, limiting customization options
- Higher cost compared to open-source alternatives
- Potential vendor lock-in due to proprietary nature
Code Comparison
telegraf:
func (a *Agent) Run(ctx context.Context) error {
log.Printf("I! Starting Telegraf %s", version.Version)
err := a.runAgent(ctx)
return err
}
datadog-agent:
func (a *Agent) run(ctx context.Context) error {
log.Infof("Starting Datadog Agent v%v", version.AgentVersion)
err := a.start(ctx)
return err
}
Both agents use similar structures for initialization and running, with minor differences in logging and function names. Telegraf's code is more accessible due to its open-source nature, allowing for easier customization and community contributions. datadog-agent's code, while not publicly available, likely includes proprietary features and integrations specific to the Datadog ecosystem.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Telegraf
Telegraf is an agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
- Offers a comprehensive suite of over 300 plugins, covering a wide range of functionalities including system monitoring, cloud services, and message passing
- Enables the integration of user-defined code to collect, transform, and transmit data efficiently
- Compiles into a standalone static binary without any external dependencies, ensuring a streamlined deployment process
- Utilizes TOML for configuration, providing a user-friendly and unambiguous setup experience
- Developed with contributions from a diverse community of over 1,200 contributors
Users can choose plugins from a wide range of topics, including but not limited to:
- Devices: OPC UA, Modbus
- Logs: File, Tail, Directory Monitor
- Messaging: AMQP, Kafka, MQTT
- Monitoring: OpenTelemetry, Prometheus
- Networking: Cisco TelemetryMDT, gNMI
- System monitoring: CPU, Memory, Disk, Network, SMART, Docker, Nvidia SMI, etc.
- Universal: Exec, HTTP, HTTP Listener, SNMP, SQL
- Windows: Event Log, Management Instrumentation, Performance Counters
ð¨ Installation
For binary builds, Docker images, RPM & DEB packages, and other builds of Telegraf, please see the install guide.
See the releases documentation for details on versioning and when releases are made.
ð» Usage
Users define a TOML configuration with the plugins and settings they wish to use, then pass that configuration to Telegraf. The Telegraf agent then collects data from inputs at each interval and sends data to outputs at each flush interval.
For a basic walkthrough see quick start.
ð Documentation
For a full list of documentation including tutorials, reference and other material, start with the /docs directory.
Additionally, each plugin has its own README that includes details about how to configure, use, and sometimes debug or troubleshoot. Look under the /plugins directory for specific plugins.
Here are some commonly used documents:
â¤ï¸ Contribute
We love our community of over 1,200 contributors! Many of the plugins included in Telegraf were originally contributed by community members. Check out our contributing guide if you are interested in helping out. Also, join us on our Community Slack or Community Forums if you have questions or comments for our engineering teams.
If you are completely new to Telegraf and InfluxDB, you can also enroll for free at InfluxDB university to take courses to learn more.
â¹ï¸ Support
Please use the Community Slack or Community Forums if you have questions or comments for our engineering teams. GitHub issues are limited to actual issues and feature requests only.
ð License
Top Related Projects
The Prometheus monitoring system and time series database.
The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
Architected for speed. Automated for easy. Monitoring and troubleshooting, transformed!
The system statistics collection daemon. Please send Pull Requests here!
:tropical_fish: Beats - Lightweight shippers for Elasticsearch & Logstash
Main repository for Datadog Agent
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot