# CPU

**URL:** <https://forum.ansible.com/t/cpu/29016>\
**Category:** Ansible Project\
**Created:** [November 13, 2018, 11:43am UTC](https://forum.ansible.com/t/cpu/29016 "2018-11-13T11:43:57Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vinu\_Vajravel](https://avatars.discourse-cdn.com/v4/letter/v/ea666f/32.png) [@Vinu\_Vajravel](https://forum.ansible.com/u/Vinu_Vajravel)\
**Post date:** [November 13, 2018, 11:43am UTC](https://forum.ansible.com/t/cpu/29016/1 "2018-11-13T11:43:57Z")

</div>

HI Ansible Experts ,

Can anyone let me know how can i monitor CPU and memory usage using a play books please ?

THanks  
VInu

---

<div class="post-metadata">

**Author:** ![Brad2](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Brad2](https://forum.ansible.com/u/Brad2)\
**Post date:** [November 13, 2018, 12:26pm UTC](https://forum.ansible.com/t/cpu/29016/2 "2018-11-13T12:26:02Z")

</div>

Are you sure you want to use ansible for that task? It sounds more like something for a monitoring tool such as nagios, oneview, big brother, etc.

---

<div class="post-metadata">

**Author:** ![Thad\_Guidry](https://avatars.discourse-cdn.com/v4/letter/t/35a633/32.png) [@Thad\_Guidry](https://forum.ansible.com/u/Thad_Guidry)\
**Post date:** [November 13, 2018, 12:51pm UTC](https://forum.ansible.com/t/cpu/29016/3 "2018-11-13T12:51:55Z")

</div>

I’d highly recommend [https://sensu.io/](https://sensu.io/) which is open source and exudes DevOps best practices.

---

<div class="post-metadata">

**Author:** ![Vinu\_Vajravel](https://avatars.discourse-cdn.com/v4/letter/v/ea666f/32.png) [@Vinu\_Vajravel](https://forum.ansible.com/u/Vinu_Vajravel)\
**Post date:** [November 13, 2018, 1:36pm UTC](https://forum.ansible.com/t/cpu/29016/4 "2018-11-13T13:36:14Z")

</div>

do you know any perl or shell scripts or any plugins to interface with Nagios to monitor CPU/memory ?

Thanks  
Vinu

---

<div class="post-metadata">

**Author:** ![Jonathan\_Lozada\_De\_L](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@Jonathan\_Lozada\_De\_L](https://forum.ansible.com/u/Jonathan_Lozada_De_L)\
**Post date:** [November 13, 2018, 1:56pm UTC](https://forum.ansible.com/t/cpu/29016/5 "2018-11-13T13:56:40Z")

</div>

if you go to nagios page then you can find all this information.

---

<div class="post-metadata">

**Author:** ![Vivek1](https://avatars.discourse-cdn.com/v4/letter/v/839c29/32.png) [@Vivek1](https://forum.ansible.com/u/Vivek1)\
**Post date:** [November 13, 2018, 2:48pm UTC](https://forum.ansible.com/t/cpu/29016/6 "2018-11-13T14:48:48Z")

</div>

Icinga will be a good option for you. We are using it for our servers cpu and load monitoring which is an open source

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [November 13, 2018, 3:26pm UTC](https://forum.ansible.com/t/cpu/29016/7 "2018-11-13T15:26:45Z")

</div>

nagios/naemon, zabbix, sar, etc …many good ways to do this, but if you REALLY want to do shit in Ansible (I don’t recommend):

- name: get RAM  
shell: free  
register: memory

- name: cpu info  
shell top -n 1  
register: cpu

---

<div class="post-metadata">

**Author:** ![Ameya\_Agashe](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@Ameya\_Agashe](https://forum.ansible.com/u/Ameya_Agashe)\
**Post date:** [November 13, 2018, 11:48pm UTC](https://forum.ansible.com/t/cpu/29016/8 "2018-11-13T23:48:46Z")

</div>

Ansible is not a monitoring tool. You need a monitoring tool. There are many excellent tools out there. Respectfully, please don’t use Nagios!

Ameya

---

<div class="post-metadata">

**Author:** ![stifan\_kristi](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@stifan\_kristi](https://forum.ansible.com/u/stifan_kristi)\
**Post date:** [November 14, 2018, 12:58am UTC](https://forum.ansible.com/t/cpu/29016/9 "2018-11-14T00:58:18Z")

</div>

pls check:  
[https://en.wikipedia.org/wiki/System\_monitor](https://en.wikipedia.org/wiki/System_monitor)

there’s a lot of tools to use for monitoring system, and ansible is not for monitoring, perhaps you can combine it, ansible just used for manage it’s state ensure that the monitoring service is running

best regards,  
stifan

---

<div class="post-metadata">

**Author:** ![stifan\_kristi](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@stifan\_kristi](https://forum.ansible.com/u/stifan_kristi)\
**Post date:** [November 17, 2018, 11:07am UTC](https://forum.ansible.com/t/cpu/29016/10 "2018-11-17T11:07:19Z")

</div>

perhaps can learn from this:  
[https://itnext.io/monitoring-with-prometheus-using-ansible-812bf710ef43](https://itnext.io/monitoring-with-prometheus-using-ansible-812bf710ef43)

best regards,  
stifan
