Myself have an idea to build own metric collection agent for linux systems with various customised features and controls. Would like to know what is the best practice to collect metrics continuous from a linux system.
Is it best to use infinite while loop with sleep inside for required time interval of data collection ? or any other best method available for recursive data collection without wasting system memory much.
If i want to collect multiple metrics, like CPU util, memory util, disk util etc. What is the best way to execute all commands in parallel ? is it good way to use & and leave it for background and collect all process ids and verify all are completed ? or any other best way is present which for this purpose ?
Thanks in Advance.