N
N
NOONE2014-09-02 22:27:23
linux
NOONE, 2014-09-02 22:27:23

How can I implement a bash script Load monitoring?

Actually the subject, you need to write a BASH script that will monitor the CPU load on different servers, so the question is, how best to implement a connection to the servers? i.e. it is necessary that he ran let's say on 4 servers wrote down the values ​​top | grep CPU , I believe that I would write this value to a variable, then do operations with the rest of the servers and, as a result, on the computer on which it was launched, write the data to a file such as log.txt (It should be of this form Server name, time, well and the top output itself).
The script will be run by cron every 5 minutes, it is important that a new value is written to the log.txt file but the old one is not overwritten.
So here are the questions
How to do authentication?
And how to organize such data output to a file?
Thank you all for your help!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Andrey Burov, 2014-09-03
@BuriK666

Do not invent crutches, munin and sar are perfect for your task

S
s1dney, 2014-09-03
@s1dney

Yeah, and then such kulibins are updated in a cycle through the ssh-key system and backups are made.
For these purposes, there are a huge variety of monitoring systems .

I
Igor, 2014-09-03
@merryjane

Key authentication. This is the most convenient thing about ssh.
Writing to a file via >> so that the lines are added without overwriting the old ones.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question