通过ssh远程top一次ceph用户的所有进程:
1 |
ssh ceph-14 top -u ceph -b -n 1 |
如果想查看多次(3次):
1 |
ssh ceph-14 top -u ceph -b -n 3 |
如果想以本机的top效果查看,则可以:
1 |
watch ssh ceph-14 top -u ceph -b -n 1 |
其实,根本不用watch :
1 |
ssh -t ceph-14 top -u ceph |
但是如果想在一个机器上查看2个机器的top呢?
1 |
watch "ssh ceph-14 top -u ceph -b -n 1 ; ssh ceph-4 top -u ceph -b -n 1" |
如果如果想在一个机器上查看4个机器的top呢?写4遍ssh好繁琐:
1 |
watch 'for h in ceph-4 ceph-14; do echo -e "$h\n"; ssh $h top -u ceph -b -n 1; printf "=%.0s" {1..80}; echo;done ' |
分割线的打印,参考: https://stackoverflow.com/questions/5349718/how-can-i-repeat-a-character-in-bash