File tree Expand file tree Collapse file tree 4 files changed +57
-0
lines changed
ansible/roles/monitor/tasks Expand file tree Collapse file tree 4 files changed +57
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ - name : Stop monitoring if enabled
3+ include_tasks : stop.yml
4+
5+ - name : Launch background sadc monitoring
6+ shell :
7+ executable : /bin/bash
8+ cmd : >-
9+ nohup /usr/lib64/sa/sadc -S XALL 1 </dev/null 2>/dev/null
10+ > >(nohup xz - >{{ config.statedir }}/sadc_{{ name }}.xz 2>/dev/null) &
11+ echo ${!} >/tmp/sadc.pid
12+
13+ - name : Wait few seconds to monitor idle activity
14+ pause :
15+ seconds : 5
Original file line number Diff line number Diff line change 1+ ---
2+ - name : Check if sadc is running
3+ stat :
4+ path : /tmp/sadc.pid
5+ get_attributes : false
6+ get_checksum : false
7+ get_mime : false
8+ register : sadc_pid
9+
10+ - name : Stop sadc if running
11+ when : sadc_pid.stat.exists
12+ block :
13+ - name : Wait few seconds to monitor idle activity
14+ pause :
15+ seconds : 5
16+
17+ - name : Stop sadc
18+ shell :
19+ executable : /bin/bash
20+ cmd : " kill -TERM $(cat /tmp/sadc.pid) && rm -f /tmp/sadc.pid"
Original file line number Diff line number Diff line change 99 - ansible/config.yml
1010 roles :
1111 - hosts.update
12+ - monitor
Original file line number Diff line number Diff line change 1+ ---
2+ - name : Install sysstat
3+ yum :
4+ name : sysstat
5+ state : latest
6+
7+ - name : Disable sysstat service and timers
8+ systemd :
9+ name : " {{ item }}"
10+ enabled : false
11+ masked : true
12+ state : stopped
13+ loop :
14+ - sysstat
15+ - sysstat-collect.timer
16+ - sysstat-summary.timer
17+
18+ - name : Make sure statedir is present
19+ file :
20+ path : " {{ config.statedir }}"
21+ state : directory
You can’t perform that action at this time.
0 commit comments