1 |
# this script requires tools available at: |
2 |
# |
3 |
# http://svn.rot13.org/index.cgi/perl/checkout/trunk/groupby.pl |
4 |
# http://svn.rot13.org/index.cgi/perl/checkout/trunk/sum.pl |
5 |
|
6 |
# and module not available in lenny: |
7 |
# |
8 |
# cpanp i IPC::System::Simple |
9 |
|
10 |
# insert following in /etc/sudoers if you are in staff group on remote machine for this to work: |
11 |
# |
12 |
# %staff ALL=(root) NOPASSWD: /usr/sbin/vzlist |
13 |
|
14 |
if [ ! -z $1 ] ; then |
15 |
echo "# $1" |
16 |
ssh $1 vzps -E axv --no-headers | groupby.pl 'sum:($7+$8+$9*1024),1,count:1' --join "ssh $1 sudo vzlist -H -o veid,hostname" --on 2 | sort -rn | align | sum.pl -h |
17 |
else |
18 |
vzps -E axv --no-headers | groupby.pl 'sum:($7+$8+$9*1024),1,count:1' --join 'sudo vzlist -H -o veid,hostname' --on 2 | sort -rn | align | sum.pl -h |
19 |
fi |