Skip to main content

Enterprise Server 3.16 은(는) 현재 릴리스 후보로 제공됩니다.

Exporting and scraping Prometheus metrics

GitHub Enterprise Server provides Prometheus-compatible metrics by transforming collectd data. These metrics can be scraped from a dedicated endpoint, allowing integration with observability and monitoring tools for performance insights.

GitHub Enterprise Server includes a Prometheus metrics exporter to simplify observability and monitoring. This feature allows metrics to be scraped directly from the appliance, eliminating the need to forward collectd metrics to an external collectd server for transformation before sending them to a Prometheus system. By supporting Prometheus-compatible metrics natively, the exporter enables seamless integration with external monitoring dashboards and alerting systems.

Enabling Prometheus metrics exporter and scraping metrics

By default, the Prometheus metrics exporter and scraping are disabled. Enabling the exporter for collectd metrics opens the metrics endpoint (also knows as scrape endpoint) at http(s)://HOSTNAME:9103. Ensure that firewall rules allow traffic on port 9103.

You can enable the Prometheus metrics exporter using the 관리 콘솔, the command line interface within the appliance, or the API.

Enabling using the 관리 콘솔

  1. 페이지의 오른쪽 상단에 있는 GitHub Enterprise Server의 관리 계정에서 을 클릭합니다.

  2. “Site admin”(사이트 관리자) 페이지에 아직 없는 경우 왼쪽 상단에서 Site admin(사이트 관리자)을 클릭합니다.

  3. " 사이트 관리자" 사이드바에서 관리 콘솔 을 클릭합니다.

  4. In the monitoring settings, select Enable prometheus.

  5. In the Trusted IPv4/IPv6 addresses or CIDR blocks in a comma-separated list field, type the comma-separated list of ip addresses or CIDR blocks. An example: 10.0.0.1, 192.168.1.0/8. If this field is left empty, then scraping requests from any source IP will be accepted.

  6. "설정" 사이드바에서 설정 저장을 클릭합니다.

    Note

    관리 콘솔에 설정을 저장하면 시스템 서비스가 다시 시작되어 사용자에게 표시되는 가동 중지 시간이 발생할 수 있습니다.

  7. 구성 실행이 완료될 때까지 기다립니다.

Enabling via the command line interface

To enable the Prometheus metrics exporter, SSH into the GitHub Enterprise Server appliance and run the following commands:

ghe-config app.prometheus.enabled true
# Specify a comma-separated list of trusted IPv4/IPv6 addresses or CIDR blocks.
ghe-config app.prometheus.trusted-ips "10.0.0.1, 192.168.1.0/8"
ghe-config-apply

Enabling using the API

You can enable the Prometheus metrics exporter using the API by sending a PUT request to update the configuration settings.

curl -L -H "Content-Type: application/json" -X PUT -u "api_key:xxxxxxx" https://<hostname>/manage/v1/config/settings -d '{"prometheus": {"enabled": true, "trusted_ips": "10.0.0.1, 192.168.1.0/8"}}'

Verifying the Prometheus metrics exporter is enabled

To verify that the Prometheus metrics exporter is enabled, use curl to query the /metrics endpoint on port 9103. For more information about the administrative ports, see 네트워크 포트.

curl localhost:9103/metrics

If successful, the response will include metrics with the collectd_ prefix.

Configuring your external Prometheus server

To scrape exported metrics from GitHub Enterprise Server, add a scraping configuration to the prometheus.yaml file on your external Prometheus server.

- job_name: "ghes-prom-agent"
  scrape_interval: 10s
  static_configs:
    - targets: ["http(s)://HOSTNAME:9103/metrics"]

Support for the darkshipped Prometheus metrics exporter

If you have been using the Prometheus metrics exporter since it was darkshipped in GitHub Enterprise Server 3.12, it will continue to work after upgrading to 3.16. In this version, you now have the option to specify trusted IPs for scraping requests.

Sharing feedback

You can share your feedback on the Prometheus metrics exporter and scraping functionality with GitHub. For help with questions or issues, visit GitHub Enterprise 지원.