Skip to content

Commit

Permalink
* Sepertating MySQL and MongoDB services due to an issue with the "it…
Browse files Browse the repository at this point in the history
…ems".

* Omit the parameters value for MySQL and MongoDB services (they should not be an empty string)
  • Loading branch information
timorunge committed Mar 21, 2018
1 parent 27943db commit 31b1a45
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ pmm_client_db:
port: 3306
username: root
password: toor
parameters: ''
```
Examples
Expand Down
4 changes: 2 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ pmm_client_db:
port: 3306
username: root
password: toor
parameters: ''
parameters:
mongodb:
host: localhost
port: 27017
username: root
password: toor
parameters: ''
parameters:
22 changes: 14 additions & 8 deletions tasks/client-services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,22 @@
('proxysql:metrics' in item)
with_items: "{{ pmm_client_add_services }}"

- name: Adding MySQL and MongoDB services to monitoring
- name: Adding MySQL services to monitoring
shell: >
if ! pmm-admin list | grep {{ item | quote }} ; then
pmm-admin add {{ item | quote }} --host {{ pmm_client_db[item][host] | quote }}
--port {{ pmm_client_db[item][port] | quote }} --user {{ pmm_client_db[item][username] | quote }}
--password {{ pmm_client_db[item][password] | quote }} {{ pmm_client_db[item][parameters] | quote }} ; fi
when: >
('linux:metrics' not in item) and
('proxysql:metrics' not in item) or
('mysql' == item or 'mongodb' == item)
pmm-admin add {{ item | quote }} --host {{ pmm_client_db['mysql']['host'] | quote }}
--port {{ pmm_client_db['mysql']['port'] | quote }} --user {{ pmm_client_db['mysql']['username'] | quote }}
--password {{ pmm_client_db['mysql']['password'] | quote }} {{ pmm_client_db['mysql']['parameters'] | default(omit) | quote }} ; fi
when: ('mysql' in item)
with_items: "{{ pmm_client_add_services }}"

- name: Adding MongoDB services to monitoring
shell: >
if ! pmm-admin list | grep {{ item | quote }} ; then
pmm-admin add {{ item | quote }} --host {{ pmm_client_db['mongodb']['host'] | quote }}
--port {{ pmm_client_db['mongodb']['port'] | quote }} --user {{ pmm_client_db['mongodb']['username'] | quote }}
--password {{ pmm_client_db['mongodb']['password'] | quote }} {{ pmm_client_db['mongodb']['parameters'] | default(omit) | quote }} ; fi
when: ('mongodb' in item)
with_items: "{{ pmm_client_add_services }}"

- name: Removing services from monitoring
Expand Down

0 comments on commit 31b1a45

Please sign in to comment.