Github monitoring and integration with Zabbix
Zabbix + Github All Categories AI infrastructure Applications DevOps Official Templates Nahrajte svou integraci Github GitHub is a developer platform that allows developers to create, store, manage and share their code. It uses Git software, providing the distributed version control of Git plus access control, bug tracking, software feature requests, task management, continuous integration, and wikis for every project.
Dostupná řešení GitHub organization by HTTP GitHub webhook Zabbix version 8.0 7.4 7.2 7.0 6.0 Download GitHub organization by HTTP Overview This template is designed for the effortless deployment of GitHub organization monitoring by Zabbix via GitHub REST API and doesn't require any external scripts. For more details about GitHub REST API, refer to the official documentation . Requirements Zabbix version: 8.0 and higher.
Tested versions This template has been tested on: GitHub API version 2022-11-28 Configuration Zabbix should be configured according to the instructions in the Templates out of the box section. Setup Additional information is available in the official documentation: Regarding authentication Rate limits for the REST API Create an access token for monitoring One of the simplest ways to send authenticated requests is to use a personal access token - either a classic or a fine-grained one.
Classic personal access token You can create a new classic personal access token by following the instructions in the official documentation . Additional information about OAuth scopes is available in the official documentation . Note that authenticated users must have admin access to the repository and the repo scope must be set to get information about self-hosted runners . In order to gather security and analysis metrics for a repository, the authenticated user must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository.
Fine-grained personal access token Alternatively, you can use a fine-grained personal access token . In order to use fine-grained tokens to monitor organization-owned repositories, organizations must opt in to fine-grained personal access tokens and set up a personal access token policy . The fine-grained token needs to have the following permissions set to provide access to the organization and repository resources: "Actions" repository permissions (read); "Administration" repository permissions (read); "Contents" repository permissions (read); "Issues" repository permissions (read); "Metadata" repository permissions (read); "Pull requests" repository permissions (read).
Set the access token that you've created in step 1 in the {$GITHUB.API.TOKEN} macro Change the API URL in the {$GITHUB.API.URL} macro if needed (for self-hosted installations) Set the organization name in the {$GITHUB.ORG.NAME} macro Set the Copilot monitoring flag to 1 in the {$GITHUB.COPILOT.USED} macro if you want to gather Copilot metrics Note that the Copilot Metrics API access policy must be enabled for the organization.
Only organization owners and billing managers of the parent enterprise can view Copilot metrics . OAuth app tokens and personal access tokens (classic) need either the manage_billing:copilot , read:org , or read:enterprise scopes to use this endpoint. The fine-grained token needs to have the following permissions set to provide access to Copilot metrics: "GitHub Copilot Business" organization permissions (read); "Administration" organization permissions (read).
Set the LLD rule filters if needed: Filter repositories by name: {$GITHUB.REPO.NAME.MATCHES} , {$GITHUB.REPO.NAME.NOT_MATCHES} ; Filter repositories by owner: {$GITHUB.REPO.OWNER.MATCHES} , {$GITHUB.REPO.OWNER.NOT_MATCHES} ; Filter Copilot IDEs by name: {$GITHUB.COPILOT.IDE.NAME.MATCHES} , {$GITHUB.COPILOT.IDE.NAME.NOT_MATCHES} ; Filter Copilot models by name: {$GITHUB.COPILOT.MODEL.NAME.MATCHES} , {$GITHUB.COPILOT.MODEL.NAME.NOT_MATCHES} ; Filter Copilot programming languages by name: {$GITHUB.COPILOT.LANG.NAME.MATCHES} , {$GITHUB.COPILOT.LANG.NAME.NOT_MATCHES} .
Note: Update intervals and timeouts for script items can be changed individually via {$GITHUB.INTERVAL} and {$GITHUB.TIMEOUT} macros with context. Depending on the organization being monitored, it can be adjusted if needed (if you are exceeding rate limits, you can increase update intervals for some script items to stay within per hour request limits). But be aware that it may also affect the triggers (check whether the item is used in triggers and adjust thresholds and/or evaluation periods if needed).
Macros used Name Description Default {$GITHUB.API.URL} Set the API URL here. https://api.github.com/ {$GITHUB.USER_AGENT} The user agent that is used in headers for HTTP requests. Zabbix/8.0 {$GITHUB.API_VERSION} The API version that is used in headers for HTTP requests. 2022-11-28 {$GITHUB.COPILOT.USED} The flag for gathering Copilot metrics. If set to a value other than "1", items for Copilot will not be created. If set to "1", the {$GITHUB.ORG.NAME} macro is required.
0 {$GITHUB.ORG.NAME} Set the organization name here. {$GITHUB.API.TOKEN} Set the access token here. {$GITHUB.INTERVAL} The update interval for the script items that retrieve data from the API. Can be used with context if needed (check the context values in relevant items). 1m {$GITHUB.INTERVAL:"get_repo_list"} The update interval for the script item that retrieves a list of repositories. 15m {$GITHUB.INTERVAL:"get_copilot_data"} The update interval for the script item that retrieves Copilot statistics.
1h {$GITHUB.INTERVAL:"get_copilot_billing"} The update interval for the script item that retrieves Copilot billing. 1h {$GITHUB.TIMEOUT} The timeout threshold for the script items that retrieve data from the API. Can be used with context if needed (check the context values in relevant items). 15s {$GITHUB.HTTP_PROXY} The HTTP proxy for script items (set if needed). If the macro is empty, then no proxy is used. {$HTTP.TLS.VERIFY} TLS certificate verification for script items: "none" - disabled, "peer" - verify the certificate chain and expiration, "full" - full verification.
Any other value enables full verification. To override the setting for this template only, define the macro with the context "GitHub organization", e.g. {$HTTP.TLS.VERIFY:"GitHub organization"}. full {$GITHUB.RESULTS_PER_PAGE} The number of results to fetch per page. Can be used with context and adjusted if needed (check the context values in script parameters of relevant items). 100 {$GITHUB.REPO.NAME.MATCHES} The repository name regex filter to use in repository discovery - for including. .+ {$GITHUB.REPO.NAME.NOT_MATCHES} The repository name regex filter to use in repository discovery - for excluding.
CHANGE_IF_NEEDED {$GITHUB.REPO.OWNER.MATCHES} The repository owner regex filter to use in repository discovery - for including. .+ {$GITHUB.REPO.OWNER.NOT_MATCHES} The repository owner regex filter to use in repository discovery - for excluding. CHANGE_IF_NEEDED {$GITHUB.COPILOT.IDE.NAME.MATCHES} The Copilot IDE name regex filter to use in Copilot-related metric discovery - for including. .+ {$GITHUB.COPILOT.IDE.NAME.NOT_MATCHES} The Copilot IDE name regex filter to use in Copilot-related metric discovery - for excluding.
CHANGE_IF_NEEDED {$GITHUB.COPILOT.MODEL.NAME.MATCHES} The Copilot model name regex filter to use in Copilot-related metric discovery - for including. .+ {$GITHUB.COPILOT.MODEL.NAME.NOT_MATCHES} The Copilot model name regex filter to use in Copilot-related metric discovery - for excluding. CHANGE_IF_NEEDED {$GITHUB.COPILOT.LANG.NAME.MATCHES} The Copilot programming language name regex filter to use in Copilot-related metric discovery - for including. .+ {$GITHUB.COPILOT.LANG.NAME.NOT_MATCHES} The Copilot programming language name regex filter to use in Copilot-related metric discovery - for excluding.
CHANGE_IF_NEEDED Items Name Description Type Key and additional info Get repositories Get
The rest of this page is on the live site.