目录
输入和输出集成概述
此插件与 Apache HTTP 服务器的 mod_status 接口,以收集和报告服务器的性能指标。
Graphite 插件使用户能够通过 TCP 将 Telegraf 收集的指标发送到 Graphite。此集成允许使用 Graphite 的强大功能高效存储和可视化时间序列数据。
集成详情
Apache
Apache 插件使用 Apache HTTP 服务器的 mod_status 模块收集服务器性能信息。它依赖于 mod_status 功能,该功能必须在 Apache 配置中显式启用,才能访问机器可读的状态页面。此插件允许用户获取与 Apache 运行性能相关的多个指标,包括工作进程状态、连接统计信息和服务器负载,从而有助于实时有效地监控和排除 Web 服务器性能故障。
Graphite
此插件通过原始 TCP 将指标写入 Graphite,从而将 Telegraf 收集的指标无缝集成到 Graphite 生态系统中。借助此插件,用户可以配置多个 TCP 端点以进行负载均衡,从而确保指标传输的高可用性和可靠性。使用前缀自定义指标命名以及使用各种模板选项的功能增强了数据在 Graphite 中的表示方式的灵活性。此外,对 Graphite 标签的支持以及对指标名称进行严格清理的选项允许强大的数据管理,满足用户的不同需求。对于希望利用 Graphite 强大的指标存储和可视化功能,同时保持对数据表示形式的控制的组织而言,此功能至关重要。
配置
Apache
[[inputs.apache]]
## An array of URLs to gather from, must be directed at the machine
## readable version of the mod_status page including the auto query string.
## Default is "http://localhost/server-status?auto".
urls = ["http://localhost/server-status?auto"]
## Credentials for basic HTTP authentication.
# username = "myuser"
# password = "mypassword"
## Maximum time to receive response.
# response_timeout = "5s"
## Optional TLS Config
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
## Use TLS but skip chain & host verification
# insecure_skip_verify = false
Graphite
# Configuration for Graphite server to send metrics to
[[outputs.graphite]]
## TCP endpoint for your graphite instance.
## If multiple endpoints are configured, the output will be load balanced.
## Only one of the endpoints will be written to with each iteration.
servers = ["localhost:2003"]
## Local address to bind when connecting to the server
## If empty or not set, the local address is automatically chosen.
# local_address = ""
## Prefix metrics name
prefix = ""
## Graphite output template
## see https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_OUTPUT.md
template = "host.tags.measurement.field"
## Strict sanitization regex
## This is the default sanitization regex that is used on data passed to the
## graphite serializer. Users can add additional characters here if required.
## Be aware that the characters, '/' '@' '*' are always replaced with '_',
## '..' is replaced with '.', and '\' is removed even if added to the
## following regex.
# graphite_strict_sanitize_regex = '[^a-zA-Z0-9-:._=\p{L}]'
## Enable Graphite tags support
# graphite_tag_support = false
## Applied sanitization mode when graphite tag support is enabled.
## * strict - uses the regex specified above
## * compatible - allows for greater number of characters
# graphite_tag_sanitize_mode = "strict"
## Character for separating metric name and field for Graphite tags
# graphite_separator = "."
## Graphite templates patterns
## 1. Template for cpu
## 2. Template for disk*
## 3. Default template
# templates = [
# "cpu tags.measurement.host.field",
# "disk* measurement.field",
# "host.measurement.tags.field"
#]
## timeout in seconds for the write connection to graphite
# timeout = "2s"
## Optional TLS Config
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
## Use TLS but skip chain & host verification
# insecure_skip_verify = false
输入和输出集成示例
Apache
-
实时性能监控:使用 Apache 输入插件设置一个实时仪表板,显示 Apache 服务器的关键性能指标。通过可视化“繁忙工作进程”和“负载平均值”等指标,您可以快速识别性能瓶颈和服务器运行状况问题,从而有助于主动管理 Web 流量负载。
-
服务器问题自动警报:实施基于此插件收集的指标的警报,以便在性能下降时通知管理员。例如,如果
BusyWorkers
指标超过某个阈值,则可以触发自动警报,从而确保及时响应事件,以维护正常运行时间和服务的可靠性。 -
历史性能分析:将 Apache 插件收集的数据与长期存储解决方案相结合,以跟踪一段时间内的性能趋势。此累积数据有助于了解使用模式、预测资源需求以及做出有关服务器扩展或优化的明智决策。
-
跨系统监控:使用 Telegraf 的功能,将从 Apache 收集的指标与 Web 堆栈其他组件的指标集成,以将数据发送到集中式监控解决方案。这种整体视图可以简化不同技术之间的故障排除和协调,从而确保整个系统的最佳性能。
Graphite
-
动态指标可视化:Graphite 插件可用于将来自各种来源的实时指标(例如应用程序性能数据或服务器运行状况指标)馈送到 Graphite 中。这种动态集成使团队能够创建交互式仪表板,以可视化关键性能指标、跟踪一段时间内的趋势,并做出数据驱动的决策以提高系统性能。
-
负载均衡的指标收集:通过在插件中配置多个 TCP 端点,组织可以实现指标传输的负载均衡。此用例确保指标交付既有弹性又高效,从而降低高流量期间数据丢失的风险,并保持向 Graphite 的可靠信息流。
-
自定义指标标记:通过支持 Graphite 标签,用户可以使用 Graphite 插件来增强指标的粒度。使用相关信息(例如应用程序环境或服务类型)标记指标,可以进行更精细的查询和分析,从而使团队能够深入研究特定感兴趣的领域,以获得更好的运营见解。
-
增强的数据清理:利用插件的严格清理选项,用户可以确保其指标名称符合 Graphite 的要求。这种主动措施消除了指标名称中无效字符可能引起的问题,从而实现更清晰的数据管理和更准确的可视化。
反馈
感谢您成为我们社区的一份子!如果您有任何一般性反馈或在这些页面上发现任何错误,我们欢迎并鼓励您提出意见。请在 InfluxDB 社区 Slack 中提交您的反馈。