Kamal
Kamal

Reputation: 1

Shell script to get current load status of servers and refresh in every 2 minutes

I have to create a Shell script which would get the latest linux server load status from different-2 clusters for every 2 second into my shell.

What parameters I have to take care while creating this?

a.) server name b.) server password c.) watch command i.e watch -n 2 w

I need to create two tabs like server name and server load against that

I will ssh for connecting servers and also I would appreciate if someone suggest better way to achieve this?

Thanks in advance

Upvotes: 0

Views: 763

Answers (2)

Mark Setchell
Mark Setchell

Reputation: 208052

while : ; do
    ssh host1 uptime
    ssh host2 uptime
    sleep 120
    tput clear
done

Upvotes: 1

Nachiket Kate
Nachiket Kate

Reputation: 8571

Instead of reinventing the wheel why dont you use that.

There are many tools which are doing the same task you need. Below tools will provide you sys stat after specified time and will store that data also for later use

  1. Ganglia,
  2. Munin
  3. Graphite

Writing shell script for such task has many disadvantages like,

  1. shell script modification/maintainance is difficult
  2. credentials are need to provided in script(security reason)
  3. most imp : difficult to interpret the results/stats on screen
  4. data not available for offline analysis

I hope you understand the point I am trying to put here.

Upvotes: 3

Related Questions