-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Xavi Hernandez <[email protected]>
- Loading branch information
1 parent
f03565a
commit 561bc45
Showing
4 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
- name: Stop monitoring if enabled | ||
include_tasks: stop.yml | ||
|
||
- name: Launch background sadc monitoring | ||
shell: | ||
executable: /bin/bash | ||
cmd: >- | ||
nohup /usr/lib64/sa/sadc -S XALL 1 </dev/null 2>/dev/null | ||
> >(nohup xz - >{{ config.statedir }}/sadc_{{ name }}.xz 2>/dev/null) & | ||
echo ${!} >/tmp/sadc.pid | ||
- name: Wait few seconds to monitor idle activity | ||
pause: | ||
seconds: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
- name: Check if sadc is running | ||
stat: | ||
path: /tmp/sadc.pid | ||
get_attributes: false | ||
get_checksum: false | ||
get_mime: false | ||
register: sadc_pid | ||
|
||
- name: Stop sadc if running | ||
when: sadc_pid.stat.exists | ||
block: | ||
- name: Wait few seconds to monitor idle activity | ||
pause: | ||
seconds: 5 | ||
|
||
- name: Stop sadc | ||
shell: | ||
executable: /bin/bash | ||
cmd: "kill -TERM $(cat /tmp/sadc.pid) && rm -f /tmp/sadc.pid" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ | |
- ansible/config.yml | ||
roles: | ||
- hosts.update | ||
- monitor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
- name: Install sysstat | ||
yum: | ||
name: sysstat | ||
state: latest | ||
|
||
- name: Disable sysstat service and timers | ||
systemd: | ||
name: "{{ item }}" | ||
enabled: false | ||
masked: true | ||
state: stopped | ||
loop: | ||
- sysstat | ||
- sysstat-collect.timer | ||
- sysstat-summary.timer | ||
|
||
- name: Make sure statedir is present | ||
file: | ||
path: "{{ config.statedir }}" | ||
state: directory |