Skip to content

Latest commit

 

History

History

gitlab

Gitlab Integration

Overview

Integration that allows to:

  • Visualize and monitor metrics collected via Gitlab through Prometheus

See the Gitlab documentation for more information about Gitlab and its integration with Prometheus.

Setup

Installation

The Gitlab check is included in the Datadog Agent package, so you don't need to install anything else on your Gitlab servers.

Configuration

Host

Follow the instructions below to configure this check for an Agent running on a host. For containerized environments, see the Containerized section.

Metric collection
  1. Edit the gitlab.d/conf.yaml file, in the conf.d/ folder at the root of your Agent's configuration directory, to point to the Gitlab's metrics endpoint. See the sample gitlab.d/conf.yaml for all available configuration options.

    Note: The metrics in metrics.py are collected by default. The allowed_metrics configuration option in the init_config collects specific legacy metrics. Some metrics may not be collected depending on your Gitlab instance version and configuration. See Gitlab's documentation for further information about its metric collection.

  2. Allow access to monitoring endpoints by updating your /etc/gitlab/gitlab.rb to include the following line:

    gitlab_rails['monitoring_whitelist'] = ['127.0.0.0/8', '192.168.0.1']
    

    Note Save and reconfigure Gitlab to see the changes.

  3. Restart the Agent

Log collection
  1. Collecting logs is disabled by default in the Datadog Agent, enable it in your datadog.yaml file:

    logs_enabled: true
  2. Next, edit gitlab.d/conf.yaml by uncommenting the logs lines at the bottom. Update the logs path with the correct path to your Gitlab log files.

      logs:
        - type: file
          path: /var/log/gitlab/gitlab-rails/production_json.log
          service: '<SERVICE_NAME>'
          source: gitlab
        - type: file
          path: /var/log/gitlab/gitlab-rails/production.log
          service: '<SERVICE_NAME>'
          source: gitlab
        - type: file
          path: /var/log/gitlab/gitlab-rails/api_json.log
          service: '<SERVICE_NAME>'
          source: gitlab
  3. Restart the Agent.

Containerized

For containerized environments, see the Autodiscovery Integration Templates for guidance on applying the parameters below.

Metric collection
Parameter Value
<INTEGRATION_NAME> gitlab
<INIT_CONFIG> blank or {}
<INSTANCE_CONFIG> {"gitlab_url":"http://%%host%%/", "prometheus_endpoint":"http://%%host%%:10055/-/metrics"}
Log collection

Collecting logs is disabled by default in the Datadog Agent. To enable it, see Docker log collection.

Parameter Value
<LOG_CONFIG> {"source": "gitlab", "service": "gitlab"}

Validation

Run the Agent's status subcommand and look for gitlab under the Checks section.

Data Collected

Metrics

See metadata.csv for a list of metrics provided by this integration.

Events

The Gitlab check does not include any events.

Service Checks

The Gitlab check includes health, readiness, and liveness service checks.

gitlab.prometheus_endpoint_up: Returns CRITICAL if the check cannot access the Prometheus metrics endpoint of the Gitlab instance. gitlab.health: Returns CRITICAL if the check cannot access the Gitlab instance. gitlab.liveness: Returns CRITICAL if the check cannot access the Gitlab instance due to deadlock with Rails Controllers. gitlab.readiness: Returns CRITICAL if the Gitlab instance is able to accept traffic via Rails Controllers.

Troubleshooting

Need help? Contact Datadog support.