正式なドキュメントは英語版であり、この日本語訳はAI支援翻訳により作成された参考用のものです。日本語訳の一部の内容は人間によるレビューがまだ行われていないため、翻訳のタイミングにより英語版との間に差異が生じることがあります。最新かつ正確な情報については、英語版をご参照ください。

PostgreSQL Server exporter

  • プラン: Free、Premium、Ultimate
  • 提供形態: GitLab Self-Managed

このPostgreSQL Server exporterを使用すると、様々なPostgreSQLメトリクスをエクスポートできます。

自己コンパイルによるインストール環境では、ユーザー自身がPrometheusをインストールして設定する必要があります。

PostgreSQL Server exporterを有効にするには:

  1. Prometheusを有効にする

  2. /etc/gitlab/gitlab.rbを編集し、postgres_exporterを有効にします:

    postgres_exporter['enable'] = true

    PostgreSQL Server exporterが別のノードで設定されている場合、ローカルアドレスがtrust_auth_cidr_addressesにリストされていることを確認してください。そうでないと、exporterがデータベースに接続できません。

  3. ファイルを保存して、GitLabを再設定し、変更を有効にします。

Prometheusは、localhost:9187で公開されているPostgreSQL Server exporterからパフォーマンスデータの収集を開始します。

高度な設定

ほとんどの場合、PostgreSQL Server exporterはデフォルトで動作するため、何も変更する必要はありません。PostgreSQL Server exporterをさらにカスタマイズするには、次の設定オプションを使用します:

  1. /etc/gitlab/gitlab.rbを編集します:

    # The name of the database to connect to.
    postgres_exporter['dbname'] = 'pgbouncer'
    # The user to sign in as.
    postgres_exporter['user'] = 'gitlab-psql'
    # The user's password.
    postgres_exporter['password'] = ''
    # The host to connect to. Values that start with '/' are for unix domain sockets
    # (default is 'localhost').
    postgres_exporter['host'] = 'localhost'
    # The port to bind to (default is '5432').
    postgres_exporter['port'] = 5432
    # Whether or not to use SSL. Valid options are:
    #   'disable' (no SSL),
    #   'require' (always use SSL and skip verification, this is the default value),
    #   'verify-ca' (always use SSL and verify that the certificate presented by
    #   the server was signed by a trusted CA),
    #   'verify-full' (always use SSL and verify that the certification presented
    #   by the server was signed by a trusted CA and the server host name matches
    #   the one in the certificate).
    postgres_exporter['sslmode'] = 'require'
    # An application_name to fall back to if one isn't provided.
    postgres_exporter['fallback_application_name'] = ''
    # Maximum wait for connection, in seconds. Zero or not specified means wait indefinitely.
    postgres_exporter['connect_timeout'] = ''
    # Cert file location. The file must contain PEM encoded data.
    postgres_exporter['sslcert'] = 'ssl.crt'
    # Key file location. The file must contain PEM encoded data.
    postgres_exporter['sslkey'] = 'ssl.key'
    # The location of the root certificate file. The file must contain PEM encoded data.
    postgres_exporter['sslrootcert'] = 'ssl-root.crt'
  2. ファイルを保存して、GitLabを再設定し、変更を有効にします。