CPU

HI Ansible Experts ,

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

THanks
VInu

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.

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

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

Thanks
Vinu

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

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

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

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

pls check:
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

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

best regards,
stifan