diff --git a/tasks/main.yml b/tasks/main.yml index 75e3bdce4765413578b334deb375d9c15b2e122d..1c80b872f25ee62ec5fc708a240a80da8b80d02c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -55,6 +55,16 @@ when: netdata_enable_haproxy notify: restart netdata +- name: Copy netdata postgres.plugin config + ansible.builtin.template: + src: postgres.conf.j2 + dest: /etc/netdata/go.d/postgres.conf + owner: root + group: root + mode: 0644 + when: netdata_enable_postgres + notify: restart netdata + - name: Enable netdata ansible.builtin.service: name: netdata diff --git a/templates/go.d.conf.j2 b/templates/go.d.conf.j2 index 6523772d7ef8f4e399cac79f785673cf58ee3300..35e71d44f193c47f1457cbbc118cfd941253dcc2 100644 --- a/templates/go.d.conf.j2 +++ b/templates/go.d.conf.j2 @@ -18,3 +18,5 @@ modules: elasticsearch: {% if netdata_enable_elasticsearch %} yes {% else %} no {% endif %} mysql: {% if netdata_enable_mysql %} yes {% else %} no {% endif %} + + postgres: {% if netdata_enable_postgres %} yes {% else %} no {% endif %} diff --git a/templates/postgres.conf.j2 b/templates/postgres.conf.j2 new file mode 100644 index 0000000000000000000000000000000000000000..2d19043bed6e4241761b24349377d9fb9af7a2b8 --- /dev/null +++ b/templates/postgres.conf.j2 @@ -0,0 +1,85 @@ +# netdata go.d.plugin configuration for postgres [39/57] +# +# This file is in YAML format. Generally the format is: +# +# name: value +# +# There are 2 sections: +# - GLOBAL +# - JOBS +# +# +# [ GLOBAL ] +# These variables set the defaults for all JOBs, however each JOB may define its own, overriding the defaults. +# +# The GLOBAL section format: +# param1: value1 +# param2: value2 +# +# Currently supported global parameters: +# - update_every +# Data collection frequency in seconds. Default: 1. +# +# - autodetection_retry +# Re-check interval in seconds. Attempts to start the job are made once every interval. +# Zero means not to schedule re-check. Default: 0. +# +# - priority +# Priority is the relative priority of the charts as rendered on the web page, +# lower numbers make the charts appear before the ones with higher numbers. Default: 70000. +# +# +# [ JOBS ] +# JOBS allow you to collect values from multiple sources. +# Each source will have its own set of charts. +# +# IMPORTANT: +# - Parameter 'name' is mandatory. +# - Jobs with the same name are mutually exclusive. Only one of them will be allowed running at any time. +# +# This allows autodetection to try several alternatives and pick the one that works. +# Any number of jobs is supported. +# +# The JOBS section format: +# +# jobs: +# - name: job1 +# param1: value1 +# param2: value2 +# +# - name: job2 +# param1: value1 +# param2: value2 +# +# - name: job2 +# param1: value1 +# +# +# [ List of JOB specific parameters ]: +# - dsn +# Data Source Name. +# Format: postgres://[username[:password]]@host:port[/dbname]?sslmode=[disable|verify-ca|verify-full] +# Syntax: +# dsn: postgres://postgres:postgres@127.0.0.1:5432/postgres +# +# +# [ JOB defaults ]: +# No parameters +# +# +# [ JOB mandatory parameters ]: +# - name +# - dsn +# ------------------------------------------------MODULE-CONFIGURATION-------------------------------------------------- + +# update_every: 1 +# autodetection_retry: 0 +# priority: 70000 + +jobs: + - name: local + dsn: 'postgres://postgres:postgres@127.0.0.1:5432/postgres' + collect_databases_matching: '*' + - name: local + dsn: 'host=/var/run/postgresql dbname=postgres user=postgres' + collect_databases_matching: '*' diff --git a/templates/python.d.conf.j2 b/templates/python.d.conf.j2 index d947c116c33064c69c4ee2d08f45f0570afc8312..340456e65cf2de8abf5b76213045e6ba9200d7cf 100644 --- a/templates/python.d.conf.j2 +++ b/templates/python.d.conf.j2 @@ -14,5 +14,3 @@ enabled: yes default_run: {% if netdata_is_container %} no {% else %} yes {% endif %} haproxy: {% if netdata_enable_haproxy %} yes {% else %} no {% endif %} - -postgres: {% if netdata_enable_postgres %} yes {% else %} no {% endif %}