Files
product-demos/linux/tshoot.yml
2023-09-25 15:56:11 -04:00

30 lines
824 B
YAML

---
- name: Gather debug info
hosts: "{{ _hosts | default(omit) }}"
become: true
tasks:
- name: Gather recent vmstat info # noqa: no-changed-when
ansible.builtin.command: /bin/vmstat 1 5
register: vmstat
- name: Gather top CPU hogs # noqa: no-changed-when
ansible.builtin.command: ps -eo user,pid,size,pcpu,cmd --sort=-pcpu
register: pscpu
- name: Gather top memory hogs # noqa: no-changed-when
ansible.builtin.command: ps -eo user,pid,size,pcpu,cmd --sort=-size
register: pssize
- name: Swap + wait states
ansible.builtin.debug:
var: vmstat.stdout_lines
- name: Top 3 CPU hogs
ansible.builtin.debug:
var: pscpu.stdout_lines[:4]
- name: Top 3 memory hogs
ansible.builtin.debug:
var: pssize.stdout_lines[:4]