文档文档

GitHub 输入插件

此插件从托管在 GitHub 上的项目和仓库收集信息。

Telegraf 还包含 webhook 输入插件,可作为收集仓库信息的替代方法。

引入于: Telegraf v1.11.0 标签: applications 操作系统支持: all

全局配置选项

插件支持其他全局和插件配置设置,用于修改指标、标签和字段,创建别名以及配置插件顺序等任务。更多详情请参阅 CONFIGURATION.md

配置

# Gather repository information from GitHub hosted repositories.
[[inputs.github]]
  ## List of repositories to monitor
  repositories = [
    "influxdata/telegraf",
    "influxdata/influxdb"
  ]

  ## Github API access token.  Unauthenticated requests are limited to 60 per hour.
  # access_token = ""

  ## Github API enterprise url. Github Enterprise accounts must specify their base url.
  # enterprise_base_url = ""

  ## Timeout for HTTP requests.
  # http_timeout = "5s"

  ## List of additional fields to query.
  ## NOTE: Getting those fields might involve issuing additional API-calls, so please
  ##       make sure you do not exceed the rate-limit of GitHub.
  ##
  ## Available fields are:
  ##  - pull-requests -- number of open and closed pull requests (2 API-calls per repository)
  # additional_fields = []

Metrics

  • github_repository
    • 标签 (tags)
      • name - 仓库名称
      • owner - 仓库所有者
      • language - 仓库的主要语言
      • license - 仓库设置的许可证
    • 字段 (fields)
      • forks (int)
      • open_issues (int)
      • networks (int)
      • size (int)
      • subscribers (int)
      • stars (int)
      • watchers (int)

当启用 internal 输入时

  • internal_github
    • 标签 (tags)
      • access_token - 访问令牌的混淆引用或“未认证”
    • 字段 (fields)
      • limit - 每小时可请求的次数上限
      • remaining - 每小时剩余可请求的次数
      • blocks - 由于速率限制而被阻止的请求次数

指定 additional_fields 时,插件将收集指定的属性。注意: 查询这些附加字段可能需要执行额外的 API 调用。请确保通过指定过多的附加字段来避免超出查询速率限制。以下列出了可用选项、所需的 API 调用和结果字段。

  • “pull-requests” (每个仓库 2 次 API 调用)
    • 字段 (fields)
      • open_pull_requests (int)
      • closed_pull_requests (int)

示例输出

github_repository,language=Go,license=MIT\ License,name=telegraf,owner=influxdata forks=2679i,networks=2679i,open_issues=794i,size=23263i,stars=7091i,subscribers=316i,watchers=7091i 1563901372000000000
internal_github,access_token=Unauthenticated closed_pull_requests=3522i,rate_limit_remaining=59i,rate_limit_limit=60i,rate_limit_blocks=0i,open_pull_requests=260i 1552653551000000000

此页面是否有帮助?

感谢您的反馈!


InfluxDB 3.8 新特性

InfluxDB 3.8 和 InfluxDB 3 Explorer 1.6 的主要增强功能。

查看博客文章

InfluxDB 3.8 现已适用于 Core 和 Enterprise 版本,同时发布了 InfluxDB 3 Explorer UI 的 1.6 版本。本次发布着重于操作成熟度,以及如何更轻松地部署、管理和可靠地运行 InfluxDB。

更多信息,请查看

InfluxDB Docker 的 latest 标签将指向 InfluxDB 3 Core

在 **2026 年 2 月 3 日**,InfluxDB Docker 镜像的 latest 标签将指向 InfluxDB 3 Core。为避免意外升级,请在您的 Docker 部署中使用特定的版本标签。

如果使用 Docker 来安装和运行 InfluxDB,latest 标签将指向 InfluxDB 3 Core。为避免意外升级,请在您的 Docker 部署中使用特定的版本标签。例如,如果使用 Docker 运行 InfluxDB v2,请将 latest 版本标签替换为 Docker pull 命令中的特定版本标签 — 例如

docker pull influxdb:2