0

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

Kamal
  • 1
  • 2
  • 1
    What do you mean by `into your shell`? Please be more specific! – flazzarini Sep 12 '14 at 09:42
  • i mean to say that it should show the load status to my screen, where I am going to create a bash script – Kamal Sep 12 '14 at 10:05
  • 1
    setup passwordless access with `ssh-keygen`. Don't need care about storing passwords in scripts what is not the best practice... – clt60 Sep 12 '14 at 11:49

2 Answers2

3

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.

Nachiket Kate
  • 8,473
  • 2
  • 27
  • 45
1
while : ; do
    ssh host1 uptime
    ssh host2 uptime
    sleep 120
    tput clear
done
Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
  • +1 nitpicking: `host="myhost";echo "$host: " $(ssh $host uptime)` for the descriptive output ;) – clt60 Sep 12 '14 at 11:45