目录
强大的性能,无限的扩展
收集、组织和处理海量高速数据。 当您将任何数据视为时间序列数据时,它都更有价值。 使用 InfluxDB,第一的时间序列平台,旨在与 Telegraf 一起扩展。
查看入门方法
输入和输出集成概述
Syslog 插件支持使用标准网络协议从各种来源收集 syslog 消息。 此功能对于需要高效监控和记录系统的环境至关重要。
Prometheus 输出插件使 Telegraf 能够在 HTTP 端点公开指标,以供 Prometheus 服务器抓取。 此集成允许用户以 Prometheus 可以高效处理的格式从各种来源收集和聚合指标。
集成详情
Syslog
Telegraf 的 Syslog 插件捕获通过各种协议(如 TCP、UDP 和 TLS)传输的 syslog 消息。 它同时支持 RFC 5424(较新的 syslog 协议)和较旧的 RFC 3164(BSD syslog 协议)。 此插件作为服务输入运行,有效地启动一个服务来监听传入的 syslog 消息。 与传统插件不同,服务输入可能无法与标准间隔设置或 CLI 选项(如 `--once`)一起使用。 它包括用于设置网络配置、套接字权限、消息处理和连接处理的选项。 此外,与 Rsyslog 的集成允许转发日志消息,使其成为实时收集和中继系统日志的强大工具,从而无缝集成到监控和日志记录系统中。
Prometheus
此插件有助于与 Prometheus 集成,Prometheus 是一种众所周知的开源监控和警报工具包,专为大规模环境中的可靠性和效率而设计。 通过充当 Prometheus 客户端,它允许用户通过 HTTP 服务器公开一组定义的指标,Prometheus 可以按指定的时间间隔抓取这些指标。 此插件通过允许各种系统以标准化格式发布性能指标,从而在监控各种系统中发挥着至关重要的作用,从而可以广泛了解系统运行状况和行为。 主要功能包括支持配置各种端点、启用 TLS 以进行安全通信以及 HTTP 基本身份验证的选项。 该插件还与全局 Telegraf 配置设置无缝集成,支持广泛的自定义以满足特定的监控需求。 这促进了不同系统必须有效通信性能数据的环境中的互操作性。 利用 Prometheus 的指标格式,它可以通过高级配置(如指标过期和收集器控制)实现灵活的指标管理,为监控和警报工作流程提供完善的解决方案。
配置
Syslog
[[inputs.syslog]]
## Protocol, address and port to host the syslog receiver.
## If no host is specified, then localhost is used.
## If no port is specified, 6514 is used (RFC5425#section-4.1).
## ex: server = "tcp://localhost:6514"
## server = "udp://:6514"
## server = "unix:///var/run/telegraf-syslog.sock"
## When using tcp, consider using 'tcp4' or 'tcp6' to force the usage of IPv4
## or IPV6 respectively. There are cases, where when not specified, a system
## may force an IPv4 mapped IPv6 address.
server = "tcp://127.0.0.1:6514"
## Permission for unix sockets (only available on unix sockets)
## This setting may not be respected by some platforms. To safely restrict
## permissions it is recommended to place the socket into a previously
## created directory with the desired permissions.
## ex: socket_mode = "777"
# socket_mode = ""
## Maximum number of concurrent connections (only available on stream sockets like TCP)
## Zero means unlimited.
# max_connections = 0
## Read timeout (only available on stream sockets like TCP)
## Zero means unlimited.
# read_timeout = "0s"
## Optional TLS configuration (only available on stream sockets like TCP)
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
## Enables client authentication if set.
# tls_allowed_cacerts = ["/etc/telegraf/clientca.pem"]
## Maximum socket buffer size (in bytes when no unit specified)
## For stream sockets, once the buffer fills up, the sender will start
## backing up. For datagram sockets, once the buffer fills up, metrics will
## start dropping. Defaults to the OS default.
# read_buffer_size = "64KiB"
## Period between keep alive probes (only applies to TCP sockets)
## Zero disables keep alive probes. Defaults to the OS configuration.
# keep_alive_period = "5m"
## Content encoding for message payloads
## Can be set to "gzip" for compressed payloads or "identity" for no encoding.
# content_encoding = "identity"
## Maximum size of decoded packet (in bytes when no unit specified)
# max_decompression_size = "500MB"
## Framing technique used for messages transport
## Available settings are:
## octet-counting -- see RFC5425#section-4.3.1 and RFC6587#section-3.4.1
## non-transparent -- see RFC6587#section-3.4.2
# framing = "octet-counting"
## The trailer to be expected in case of non-transparent framing (default = "LF").
## Must be one of "LF", or "NUL".
# trailer = "LF"
## Whether to parse in best effort mode or not (default = false).
## By default best effort parsing is off.
# best_effort = false
## The RFC standard to use for message parsing
## By default RFC5424 is used. RFC3164 only supports UDP transport (no streaming support)
## Must be one of "RFC5424", or "RFC3164".
# syslog_standard = "RFC5424"
## Character to prepend to SD-PARAMs (default = "_").
## A syslog message can contain multiple parameters and multiple identifiers within structured data section.
## Eg., [id1 name1="val1" name2="val2"][id2 name1="val1" nameA="valA"]
## For each combination a field is created.
## Its name is created concatenating identifier, sdparam_separator, and parameter name.
# sdparam_separator = "_"
Prometheus
[[outputs.prometheus_client]]
## Address to listen on.
## ex:
## listen = ":9273"
## listen = "vsock://:9273"
listen = ":9273"
## Maximum duration before timing out read of the request
# read_timeout = "10s"
## Maximum duration before timing out write of the response
# write_timeout = "10s"
## Metric version controls the mapping from Prometheus metrics into Telegraf metrics.
## See "Metric Format Configuration" in plugins/inputs/prometheus/README.md for details.
## Valid options: 1, 2
# metric_version = 1
## Use HTTP Basic Authentication.
# basic_username = "Foo"
# basic_password = "Bar"
## If set, the IP Ranges which are allowed to access metrics.
## ex: ip_range = ["192.168.0.0/24", "192.168.1.0/30"]
# ip_range = []
## Path to publish the metrics on.
# path = "/metrics"
## Expiration interval for each metric. 0 == no expiration
# expiration_interval = "60s"
## Collectors to enable, valid entries are "gocollector" and "process".
## If unset, both are enabled.
# collectors_exclude = ["gocollector", "process"]
## Send string metrics as Prometheus labels.
## Unless set to false all string metrics will be sent as labels.
# string_as_label = true
## If set, enable TLS with the given certificate.
# tls_cert = "/etc/ssl/telegraf.crt"
# tls_key = "/etc/ssl/telegraf.key"
## Set one or more allowed client CA certificate file names to
## enable mutually authenticated TLS connections
# tls_allowed_cacerts = ["/etc/telegraf/clientca.pem"]
## Export metric collection time.
# export_timestamp = false
## Specify the metric type explicitly.
## This overrides the metric-type of the Telegraf metric. Globbing is allowed.
# [outputs.prometheus_client.metric_types]
# counter = []
# gauge = []
输入和输出集成示例
Syslog
-
集中日志管理:使用 Syslog 插件将来自多个服务器的日志消息聚合到中央日志记录系统中。 通过从不同来源收集 syslog 数据,此设置可以帮助监控整体系统运行状况、有效解决问题和维护审计跟踪。
-
实时警报:将 Syslog 插件与警报工具集成,以便在检测到特定日志模式或错误时触发实时通知。 例如,如果日志中出现关键系统错误,则可以向运维团队发送警报,从而最大限度地减少停机时间并执行主动维护。
-
安全监控:利用 Syslog 插件进行安全监控,方法是从防火墙、入侵检测系统和其他安全设备捕获日志。 这种日志记录功能增强了安全可见性,并通过分析捕获的 syslog 数据,有助于调查潜在的恶意活动。
-
应用程序性能跟踪:利用 Syslog 插件通过从各种应用程序收集日志来监控应用程序性能。 这种集成有助于分析应用程序的行为和性能趋势,从而有助于优化应用程序流程并确保更平稳的运行。
Prometheus
-
监控多云部署:利用 Prometheus 插件从跨多个云提供商运行的应用程序收集指标。 这种情况允许团队通过单个 Prometheus 实例集中监控,该实例从不同环境抓取指标,从而提供跨混合基础设施的性能指标的统一视图。 它简化了报告和警报,提高了运营效率,而无需复杂的集成。
-
增强微服务可见性:实施该插件以公开 Kubernetes 集群内各种微服务的指标。 通过使用 Prometheus,团队可以实时可视化服务指标,识别瓶颈,并维护系统运行状况检查。 此设置支持基于从收集的指标生成的见解进行自适应扩展和资源利用率优化。 它增强了对服务交互进行故障排除的能力,从而显着提高了微服务架构的弹性。
-
电子商务中的实时异常检测:通过将此插件与 Prometheus 一起使用,电子商务平台可以监控关键性能指标,例如响应时间和错误率。 将异常检测算法与抓取的指标集成,可以识别指示潜在问题的意外模式,例如突然的流量高峰或后端服务故障。 这种主动监控可以增强业务连续性和运营效率,最大限度地减少潜在的停机时间,同时确保服务的可靠性。
-
API 的性能指标报告:利用 Prometheus 输出插件收集和报告 API 性能指标,然后可以在 Grafana 仪表板中可视化这些指标。 此用例能够详细分析 API 响应时间、吞吐量和错误率,从而促进 API 服务的持续改进。 通过密切监控这些指标,团队可以快速响应性能下降,确保最佳的 API 性能并保持高水平的服务可用性。
反馈
感谢您成为我们社区的一份子! 如果您有任何一般性反馈或在这些页面上发现了任何错误,我们欢迎并鼓励您提出意见。 请在 InfluxDB 社区 Slack 中提交您的反馈。
强大的性能,无限的扩展
收集、组织和处理海量高速数据。 当您将任何数据视为时间序列数据时,它都更有价值。 使用 InfluxDB,第一的时间序列平台,旨在与 Telegraf 一起扩展。
查看入门方法