windows CPU Memory Swap-Memory utilization report in txt format

Hello Ansible Team

I am trying to develped below task

CPU/Memory related alerts need manual intervention to review the system health against the resources consuming the CPU/MEMORY. Every time engineer needs to login to the system and performs the troubleshooting leading more effort consumption Objective - To develop the mechanism that enables centralized management of CPU/Memory utilization issues Expected Outcome - Mechanism may provide functionality : • Find Total MEM/CPU Utilization • List Top 20 CPU/MEM Utilization in process • List Virtual memory Statistics • List of Virtual CPU Statistics

Team any one have idea please help me on that how i do this using ansible for widows

Thank you Team
Avinash

Well, while you can use Ansible to run smth like Get-Process with Ansible’s win_shell or tasklist with win_command and then parse and analyze responses, this is not smth Ansible should be used for (IMHO) as this is task for monitoring system like Zabbix/SCOM. Keep in mind that Ansible requires some CPU/Memory to run its tasks on the managed node, so if you windows machine is under heavy load, you will have to wait for Ansible’s taks completion for a long time.
You may want to take a look into Telegraf → InfluxDB/Graphite/Prometheus->Grafana stack.
In this case your metrics (CPU/Memory) are shipped by a Telegraf agent running on Windows to TSDB of your choice and exposed as graphs, tables, etc in Grafana.
All these components can be installed and configured with Ansible.

вт, 16 июн. 2020 г. в 12:30, Avinash Jadhav <avinashrjadhav8@gmail.com>:

Hi Thank you for great information on that

ill try using win_shell and win_command