HAProxy 和 Microsoft SQL Server 集成

强大的性能和简单的集成,由 InfluxData 构建的开源数据连接器 Telegraf 提供支持。

info

这不是大规模实时查询的推荐配置。 为了查询和压缩优化、高速摄取和高可用性,您可能需要考虑 HAproxy 和 InfluxDB

50 亿+

Telegraf 下载量

#1

时序数据库
来源:DB Engines

10 亿+

InfluxDB 下载量

2,800+

贡献者

目录

强大的性能,无限的扩展

收集、组织和处理海量高速数据。 当您将任何数据视为时序数据时,它会更有价值。 借助 InfluxDB,第一的时序平台,旨在与 Telegraf 一起扩展。

查看入门方法

输入和输出集成概述

此插件收集和报告来自 HAProxy(一个流行的开源负载均衡器和代理服务器)的统计信息,以帮助监控和优化其性能。

Telegraf 的 SQL 插件有助于将指标存储在 SQL 数据库中。 当配置为 Microsoft SQL Server 时,它支持特定的 DSN 格式和架构要求,从而实现与 SQL Server 的无缝集成。

集成详情

HAProxy

Telegraf 的 HAProxy 插件使用户能够通过其统计套接字或 HTTP 统计页面直接从 HAProxy 服务器收集统计信息。 HAProxy 是一种广泛使用的软件负载均衡器和代理服务器,为 TCP 和 HTTP 应用程序提供高可用性和性能。 通过与 HAProxy 集成,此插件允许用户实时监控和分析各种性能指标,例如活动服务器计数、请求率、响应代码和会话状态,从而促进更好的决策和对网络资源的积极管理。 主要功能包括支持基于 HTTP 和套接字的指标收集、与基本身份验证的兼容性以实现安全访问,以及用于指标字段命名的可配置选项,从而允许根据用户偏好进行自定义。

Microsoft SQL Server

Telegraf 的 Microsoft SQL Server SQL 输出插件旨在通过动态创建与传入数据结构匹配的表和列来捕获和存储指标数据。 此集成利用 go-mssqldb 驱动程序,该驱动程序通过包含服务器、端口和数据库详细信息的 DSN 遵循 SQL Server 连接协议。 尽管由于单元测试有限,该驱动程序被认为是实验性的,但它为动态架构生成和数据插入提供了强大的支持,从而实现了系统性能的详细时间戳记录。 尽管其状态为实验性,但这种灵活性使其成为需要可靠且精细的指标日志记录的环境的宝贵工具。

配置

HAProxy

[[inputs.haproxy]]
  ## List of stats endpoints. Metrics can be collected from both http and socket
  ## endpoints. Examples of valid endpoints:
  ##   - http://myhaproxy.com:1936/haproxy?stats
  ##   - https://myhaproxy.com:8000/stats
  ##   - socket:/run/haproxy/admin.sock
  ##   - /run/haproxy/*.sock
  ##   - tcp://127.0.0.1:1936
  ##
  ## Server addresses not starting with 'http://', 'https://', 'tcp://' will be
  ## treated as possible sockets. When specifying local socket, glob patterns are
  ## supported.
  servers = ["http://myhaproxy.com:1936/haproxy?stats"]

  ## By default, some of the fields are renamed from what haproxy calls them.
  ## Setting this option to true results in the plugin keeping the original
  ## field names.
  # keep_field_names = false

  ## 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

Microsoft SQL Server

[[outputs.sql]]
  ## Database driver
  ## Valid options: mssql (Microsoft SQL Server), mysql (MySQL), pgx (Postgres),
  ## sqlite (SQLite3), snowflake (snowflake.com), clickhouse (ClickHouse)
  driver = "mssql"

  ## Data source name
  ## For Microsoft SQL Server, the DSN typically includes the server, port, username, password, and database name.
  ## Example DSN: "sqlserver://username:password@localhost:1433?database=telegraf"
  data_source_name = "sqlserver://username:password@localhost:1433?database=telegraf"

  ## Timestamp column name
  timestamp_column = "timestamp"

  ## Table creation template
  ## Available template variables:
  ##  {TABLE}        - table name as a quoted identifier
  ##  {TABLELITERAL} - table name as a quoted string literal
  ##  {COLUMNS}      - column definitions (list of quoted identifiers and types)
  table_template = "CREATE TABLE {TABLE} ({COLUMNS})"

  ## Table existence check template
  ## Available template variables:
  ##  {TABLE} - table name as a quoted identifier
  table_exists_template = "SELECT 1 FROM {TABLE} LIMIT 1"

  ## Initialization SQL (optional)
  init_sql = ""

  ## Maximum amount of time a connection may be idle. "0s" means connections are never closed due to idle time.
  connection_max_idle_time = "0s"

  ## Maximum amount of time a connection may be reused. "0s" means connections are never closed due to age.
  connection_max_lifetime = "0s"

  ## Maximum number of connections in the idle connection pool. 0 means unlimited.
  connection_max_idle = 2

  ## Maximum number of open connections to the database. 0 means unlimited.
  connection_max_open = 0

  ## Metric type to SQL type conversion
  ## You can customize the mapping if needed.
  #[outputs.sql.convert]
  #  integer       = "INT"
  #  real          = "DOUBLE"
  #  text          = "TEXT"
  #  timestamp     = "TIMESTAMP"
  #  defaultvalue  = "TEXT"
  #  unsigned      = "UNSIGNED"
  #  bool          = "BOOL"

输入和输出集成示例

HAProxy

  1. 动态负载调整:利用 HAProxy 插件实时监控流量模式,从而实现对负载均衡算法的自动调整。 通过持续收集服务器负载和请求率的指标,系统管理员可以动态分配资源,确保没有单个服务器成为瓶颈,从而提高整体应用程序性能和可用性。

  2. 历史性能分析:将此插件与时序数据库集成,以收集 HAProxy 随时间推移的指标,从而使您能够分析历史性能和流量趋势。 这可以促进预测性分析和容量规划,为企业提供对流量高峰时间的洞察,并帮助识别潜在的未来资源需求。

  3. 异常警报:实施警报工作流程,以便在 HAProxy 指标中检测到异常模式时触发警报,例如错误率突然飙升或请求处理能力下降。 通过利用此插件,运营团队可以及时收到通知,从而可以快速干预并最大限度地减少潜在停机对最终用户的影响。

Microsoft SQL Server

  1. 企业应用监控:利用该插件捕获在 SQL Server 上运行的企业应用程序的详细性能指标。 此设置允许 IT 团队分析系统性能、跟踪事务时间并识别复杂的多层环境中的瓶颈。

  2. 动态基础设施审计:部署该插件以创建 SQL Server 中基础设施更改和性能指标的动态审计日志。 此用例非常适合需要实时监控和历史分析系统性能以进行合规性和优化的组织。

  3. 自动化性能基准测试:使用该插件持续记录和分析 SQL Server 数据库的性能指标。 这实现了自动化基准测试,将历史数据与当前性能进行比较,从而帮助快速识别服务中的异常或降级。

  4. 集成 DevOps 仪表板:将该插件与 DevOps 监控工具集成,以将来自 SQL Server 的实时指标馈送到集中式仪表板。 这提供了应用程序运行状况的整体视图,使团队能够将 SQL Server 性能与应用程序级事件相关联,从而更快地进行故障排除和主动维护。

反馈

感谢您成为我们社区的一份子! 如果您有任何一般性反馈或在这些页面上发现了任何错误,我们欢迎并鼓励您提出意见。 请在 InfluxDB 社区 Slack 中提交您的反馈。

强大的性能,无限的扩展

收集、组织和处理海量高速数据。 当您将任何数据视为时序数据时,它会更有价值。 借助 InfluxDB,第一的时序平台,旨在与 Telegraf 一起扩展。

查看入门方法

相关集成

HTTP 和 InfluxDB 集成

HTTP 插件从一个或多个 HTTP(S) 端点收集指标。 它支持各种身份验证方法和数据格式的配置选项。

查看集成

Kafka 和 InfluxDB 集成

此插件从 Kafka 读取消息,并允许基于这些消息创建指标。 它支持各种配置,包括不同的 Kafka 设置和消息处理选项。

查看集成

Kinesis 和 InfluxDB 集成

Kinesis 插件允许从 AWS Kinesis 流中读取指标。 它支持多种输入数据格式,并提供 DynamoDB 的检查点功能,以实现可靠的消息处理。

查看集成