浏览代码

Fix collectd and telegraf check for galera

There is wrong assumption that when server pillar is
defined the node is galera master, we need to check
actually that it is enabled.

Change-Id: I594c3fbdb1dfc829e7750c2fb1a6d4f5593074b2
master
Vasyl Saienko 6 年前
父节点
当前提交
2d9a03fd16
共有 2 个文件被更改,包括 25 次插入32 次删除
  1. +15
    -19
      galera/meta/collectd.yml
  2. +10
    -13
      galera/meta/telegraf.yml

+ 15
- 19
galera/meta/collectd.yml 查看文件

@@ -1,29 +1,25 @@
{%- if pillar.galera is defined %}
{%- if pillar.galera.master is defined %}
{%- from "galera/map.jinja" import master with context %}
{%- set server = master %}
{%- elif pillar.galera.slave is defined %}
{%- from "galera/map.jinja" import slave with context %}
{%- set server = slave %}
{%- from "galera/map.jinja" import master, slave with context %}
{%- if master.get('enabled', False) %}
{%- set service = master %}
{%- elif slave.get('enabled', False) %}
{%- set service = slave %}
{%- endif %}
{%- endif %}

{%- if server is defined %}
{%- if service is defined %}
local_plugin:
mysql:
template: galera/files/collectd_mysql.conf
socket: {{ server.socket }}
password: {{ server.admin.password }}
username: {{ server.admin.user }}
socket: {{ service.socket }}
password: {{ service.admin.password }}
username: {{ service.admin.user }}
mysql_status:
template: galera/files/collectd_mysql_status.conf
socket: {{ server.socket }}
password: {{ server.admin.password }}
username: {{ server.admin.user }}
socket: {{ service.socket }}
password: {{ service.admin.password }}
username: {{ service.admin.user }}
mysql_check:
plugin: python
template: galera/files/collectd_mysql_check.conf
socket: {{ server.socket }}
password: {{ server.admin.password }}
username: {{ server.admin.user }}
socket: {{ service.socket }}
password: {{ service.admin.password }}
username: {{ service.admin.user }}
{%- endif %}

+ 10
- 13
galera/meta/telegraf.yml 查看文件

@@ -1,19 +1,16 @@
{%- if pillar.galera is defined %}
{%- if pillar.galera.master is defined %}
{%- from "galera/map.jinja" import master with context %}
{%- set server = master %}
{%- elif pillar.galera.slave is defined %}
{%- from "galera/map.jinja" import slave with context %}
{%- set server = slave %}
{%- endif %}
{%- from "galera/map.jinja" import master, slave with context %}
{%- if master.get('enabled', False) %}
{%- set service = master %}
{%- elif slave.get('enabled', False) %}
{%- set service = slave %}
{%- endif %}

{%- if server is defined %}
{%- if service is defined %}
agent:
input:
mysql:
address: {{ server.socket }}
username: {{ server.admin.user }}
password: {{ server.admin.password }}
tagexclude: [server]
address: {{ service.socket }}
username: {{ service.admin.user }}
password: {{ service.admin.password }}
tagexclude: [service]
{%- endif %}

正在加载...
取消
保存