From d956ebd27bb7c2c9383edcbf08b48d915f73f690 Mon Sep 17 00:00:00 2001 From: David Mehren <git@herrmehren.de> Date: Sun, 10 Jul 2022 13:10:09 +0200 Subject: [PATCH] Switch mysql,elasticsearch collector to go --- defaults/main.yml | 1 + tasks/main.yml | 11 ++++++++++- templates/go.d.conf.j2 | 20 ++++++++++++++++++++ templates/mysql.conf.j2 | 6 +++--- templates/netdata.conf.j2 | 2 ++ templates/python.d.conf.j2 | 4 ---- 6 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 templates/go.d.conf.j2 diff --git a/defaults/main.yml b/defaults/main.yml index 78214f3..f15140c 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,6 +1,7 @@ --- netdata_is_container: false netdata_enable_python: false +netdata_enable_go: false netdata_enable_haproxy: false netdata_enable_elasticsearch: false netdata_enable_postgres: false diff --git a/tasks/main.yml b/tasks/main.yml index e7b387b..75e3bdc 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -26,10 +26,19 @@ mode: 0644 notify: restart netdata +- name: Copy netdata go.d config + ansible.builtin.template: + src: go.d.conf.j2 + dest: /etc/netdata/go.d.conf + owner: root + group: root + mode: 0644 + notify: restart netdata + - name: Copy netdata mysql.plugin config ansible.builtin.template: src: mysql.conf.j2 - dest: /etc/netdata/python.d/mysql.conf + dest: /etc/netdata/go.d/mysql.conf owner: root group: root mode: 0644 diff --git a/templates/go.d.conf.j2 b/templates/go.d.conf.j2 new file mode 100644 index 0000000..6523772 --- /dev/null +++ b/templates/go.d.conf.j2 @@ -0,0 +1,20 @@ +# netdata go.d.plugin configuration +# +# This file is in YAML format. + +# Enable/disable the whole go.d.plugin. +enabled: yes + +# Enable/disable default value for all modules. +default_run: {% if netdata_is_container %} no {% else %} yes {% endif %} + +# Maximum number of used CPUs. Zero means no limit. +max_procs: 0 + +# Enable/disable specific g.d.plugin module +# If you want to change any value, you need to uncomment out it first. +# IMPORTANT: Do not remove all spaces, just remove # symbol. There should be a space before module name. +modules: + elasticsearch: {% if netdata_enable_elasticsearch %} yes {% else %} no {% endif %} + + mysql: {% if netdata_enable_mysql %} yes {% else %} no {% endif %} diff --git a/templates/mysql.conf.j2 b/templates/mysql.conf.j2 index 5c4fc4e..437fcbc 100644 --- a/templates/mysql.conf.j2 +++ b/templates/mysql.conf.j2 @@ -1,3 +1,3 @@ -local: - user: '{{ netdata_mysql_user }}' - pass: '{{ netdata_mysql_pass }}' +jobs: + - name: local + dsn: {{ netdata_mysql_user }}:{{ netdata_mysql_pass }}@unix(/var/run/mysqld/mysqld.sock)/ diff --git a/templates/netdata.conf.j2 b/templates/netdata.conf.j2 index 1779e5a..75ab03b 100644 --- a/templates/netdata.conf.j2 +++ b/templates/netdata.conf.j2 @@ -31,6 +31,8 @@ charts.d = no python.d = {% if netdata_enable_python %} yes {% else %} no {% endif %} + go.d = {% if netdata_enable_go %} yes {% else %} no {% endif %} + [plugin:proc] netdata server resources = no diff --git a/templates/python.d.conf.j2 b/templates/python.d.conf.j2 index 9ecf5c6..d947c11 100644 --- a/templates/python.d.conf.j2 +++ b/templates/python.d.conf.j2 @@ -15,8 +15,4 @@ default_run: {% if netdata_is_container %} no {% else %} yes {% endif %} haproxy: {% if netdata_enable_haproxy %} yes {% else %} no {% endif %} -elasticsearch: {% if netdata_enable_elasticsearch %} yes {% else %} no {% endif %} - postgres: {% if netdata_enable_postgres %} yes {% else %} no {% endif %} - -mysql: {% if netdata_enable_mysql %} yes {% else %} no {% endif %} -- GitLab