To extract information from all hosts.

37 views
Skip to first unread message

Shivakumar Venkataswamy

unread,
Dec 23, 2022, 4:48:31 AM12/23/22
to Ansible Project
Hi All,

I'm looking for extract information like Load, memory usage, uptime,swap space from all linux servers in csv farmat. could please anyone suggest playbook for the same. 

Regards,
Shivu

Will McDonald

unread,
Dec 23, 2022, 5:28:22 AM12/23/22
to ansible...@googlegroups.com
The Ansible setup module will give you facts about target systems including memory usage, uptime,swap space, it would be fairly simple to extend this with a custom fact to also grab the contents of /proc/loadavg


Reading between the lines though, it sounds like you have been tasked to use ansible as an ersatz monitoring solution? Scheduling ansible runs against a number of hosts to grab runtime stats might not be the most efficient use case, you may want to investigate dedicated tooling like Sensu, Nagios, Zabbix or similar.

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/bc9141d5-447e-4114-80b1-5a5b81f846bbn%40googlegroups.com.

OSiUX

unread,
Dec 25, 2022, 4:30:01 PM12/25/22
to ansible...@googlegroups.com

dmc...@gmail.com

unread,
Dec 29, 2022, 1:35:49 PM12/29/22
to Ansible Project
I've tried ansible-cmdb but it doesn't work as well as I would like and it's not been updates for a long time. I did try and contact the author as i had some ideas to make it better but got no reply.

 I created this to solve the same problem but I store the results in a mongoDB. I created an ansible-galaxy module for it here: https://galaxy.ansible.com/apidb/ansibledb_opensource

You can extend standard facts by adding the custom_extensions role which integrates with ansibleDB and gives you the ability to write your own facts and add them in so the setup module adds them int to the output: https://github.com/apidb-io/custom_extensions

There are lots of examples to pull out the data using JQ and add in comma delimiter output for excel.
Reply all
Reply to author
Forward
0 new messages