目录
强大的性能,无限的扩展能力
收集、组织和处理海量高速数据。 当您将任何数据视为时序数据时,它会更有价值。 借助 InfluxDB,这是排名第一的时序平台,旨在与 Telegraf 一起扩展。
查看入门方法
输入和输出集成概览
Jenkins 插件通过其 API 从 Jenkins 实例收集有关作业和节点的重要信息,从而促进全面的监控和分析。
Telegraf 的 SQL 输出插件通过为每种指标类型动态创建表,将指标存储在 SQL 数据库中。 当配置为 SQLite 时,它利用基于文件的 DSN 和为轻量级嵌入式数据库使用量身定制的最小 SQL 模式。
集成详情
Jenkins
Jenkins Telegraf 插件允许用户从 Jenkins 实例收集指标,而无需在 Jenkins 本身安装任何额外的插件。 通过利用 Jenkins API,该插件检索有关 Jenkins 环境中运行的节点和作业的信息。 这种集成提供了 Jenkins 基础设施的全面概览,包括可用于监控和分析的实时指标。 主要功能包括用于作业和节点选择的可配置过滤器、可选的 TLS 安全设置以及有效管理请求超时和连接限制的能力。 这使其成为依赖 Jenkins 进行持续集成和交付的团队的必备工具,确保他们拥有维护最佳性能和可靠性所需的洞察力。
SQLite
SQL 输出插件使用动态模式将 Telegraf 指标写入 SQL 数据库,其中每种指标类型对应一个表。 对于 SQLite,该插件使用 modernc.org/sqlite 驱动程序,并且需要 DSN 格式为文件 URI(例如,“file:/path/to/telegraf.db?cache=shared”)。 此配置利用标准 ANSI SQL 进行表创建和数据插入,确保与 SQLite 的功能兼容。
配置
Jenkins
[[inputs.jenkins]]
## The Jenkins URL in the format "schema://host:port"
url = "http://my-jenkins-instance:8080"
# username = "admin"
# password = "admin"
## Set response_timeout
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 SSL but skip chain & host verification
# insecure_skip_verify = false
## Optional Max Job Build Age filter
## Default 1 hour, ignore builds older than max_build_age
# max_build_age = "1h"
## Optional Sub Job Depth filter
## Jenkins can have unlimited layer of sub jobs
## This config will limit the layers of pulling, default value 0 means
## unlimited pulling until no more sub jobs
# max_subjob_depth = 0
## Optional Sub Job Per Layer
## In workflow-multibranch-plugin, each branch will be created as a sub job.
## This config will limit to call only the lasted branches in each layer,
## empty will use default value 10
# max_subjob_per_layer = 10
## Jobs to include or exclude from gathering
## When using both lists, job_exclude has priority.
## Wildcards are supported: [ "jobA/*", "jobB/subjob1/*"]
# job_include = [ "*" ]
# job_exclude = [ ]
## Nodes to include or exclude from gathering
## When using both lists, node_exclude has priority.
# node_include = [ "*" ]
# node_exclude = [ ]
## Worker pool for jenkins plugin only
## Empty this field will use default value 5
# max_connections = 5
## When set to true will add node labels as a comma-separated tag. If none,
## are found, then a tag with the value of 'none' is used. Finally, if a
## label contains a comma it is replaced with an underscore.
# node_labels_as_tag = false
SQLite
[[outputs.sql]]
## Database driver
## Valid options: mssql (Microsoft SQL Server), mysql (MySQL), pgx (Postgres),
## sqlite (SQLite3), snowflake (snowflake.com), clickhouse (ClickHouse)
driver = "sqlite"
## Data source name
## For SQLite, the DSN is a filename or URL with the scheme "file:".
## Example: "file:/path/to/telegraf.db?cache=shared"
data_source_name = "file:/path/to/telegraf.db?cache=shared"
## 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
## The values on the left are the data types Telegraf has and the values on the right are the SQL types used when writing to SQLite.
#[outputs.sql.convert]
# integer = "INT"
# real = "DOUBLE"
# text = "TEXT"
# timestamp = "TIMESTAMP"
# defaultvalue = "TEXT"
# unsigned = "UNSIGNED"
# bool = "BOOL"
输入和输出集成示例
Jenkins
-
持续集成监控:使用 Jenkins 插件通过收集作业持续时间和失败率的指标来监控持续集成管道的性能。 这可以帮助团队识别管道中的瓶颈并提高整体构建效率。
-
资源分配分析:利用 Jenkins 节点指标来评估不同代理之间的资源使用情况。 通过了解资源的分配方式,团队可以优化其 Jenkins 架构,潜在地重新分配代理或调整作业配置以获得更好的性能。
-
作业执行趋势:分析历史作业性能指标以识别作业执行随时间变化的趋势。 通过这些数据,团队可以主动解决潜在问题,然后再扩大,并根据需要调整作业或其配置。
-
作业失败警报:实施利用 Jenkins 作业指标的警报,以便在作业失败时通知团队成员。 这种主动方法可以提高运营意识并加快对失败的响应时间,确保有效监控关键作业。
SQLite
- 本地监控存储:配置插件以将指标写入本地 SQLite 数据库文件。 这非常适合不需要设置全面数据库服务器的轻量级部署。
- 嵌入式应用程序:将 SQLite 用作边缘设备中嵌入式应用程序的后端,受益于其基于文件的架构和最低的资源需求。
- 快速设置以进行测试:利用 SQLite 的易用性快速设置 Telegraf 指标收集的测试环境,而无需外部数据库服务。
- 自定义模式管理:如果您需要特定的列类型或索引,请调整表创建模板以预定义您的模式,确保与您的应用程序需求兼容。
反馈
感谢您成为我们社区的一份子! 如果您有任何一般性反馈或在这些页面上发现任何错误,我们欢迎并鼓励您的意见。 请在 InfluxDB 社区 Slack 中提交您的反馈。
强大的性能,无限的扩展能力
收集、组织和处理海量高速数据。 当您将任何数据视为时序数据时,它会更有价值。 借助 InfluxDB,这是排名第一的时序平台,旨在与 Telegraf 一起扩展。
查看入门方法