Skip to content

Commit

Permalink
Merge pull request #20 from mhakala/master
Browse files Browse the repository at this point in the history
collectd leaks memory, mitigate by setting systemd-croup memory limit…
  • Loading branch information
VilleS1 authored May 11, 2020
2 parents 2f66f4d + d71aafe commit bd7637c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ collectd_precache: True
# Extra rules for collectd prefix mangling
collectd_prefix_rules: []

# default systemd unit memory limit for this service
collectd_memory_limit: "1536M"

# Example: This mimics the old behaviour if you had
# collectd_prefix_rules:
# - name: generic_prefix
Expand Down
5 changes: 5 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---

- name: restart_collectd
systemd: name=collectd state=restarted daemon_reload=yes

10 changes: 10 additions & 0 deletions tasks/redhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@
register: collectd_rsyslog_drop
when: (collectd_drop_rsyslog_spam and collectd_plugins_exec is defined) or (ansible_virtualization_role != "guest" and collectd_ipmitool|bool)

- name: Add memory-limit via systemd as collectd leaks memory
lineinfile:
path: /usr/lib/systemd/system/collectd.service
regexp: '^MemoryLimit='
line: "MemoryLimit={{ collectd_memory_limit }}"
insertafter: '^\[Service\]'
firstmatch: yes
state: present
notify: restart_collectd

- name: enable and start collectd
service: name=collectd state=started enabled=yes
when: ansible_connection != 'chroot'
Expand Down

0 comments on commit bd7637c

Please sign in to comment.