Script to check the load of all VPS from the main node:

# for i in `vzlist |egrep -v '(VEID|CTID)' |awk '{print $1}'`; do echo "For VEID $i (`vzctl exec $i hostname`) --->" ; vzctl exec $i w ; echo; done

Instead of "w" replace with the COMMANDS you need to be executed common in ALL of the VPSs and you'll get corresponding results !!! :)

For eg:

[root@vz1 ~]# for i in `vzlist |egrep -v ‘(VEID|CTID)’ |awk ‘{print $1}’`; do echo “For VEID $i (`vzctl exec $i hostname`) —>” ; vzctl exec $i w ; echo; done

For VEID 107 (vpn.xxx.net) —>
04:01:08 up 210 days, 6:01, 0 users, load average: 0.08, 0.02, 0.01
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT

For VEID 109 (xxx.xxx.net) —>
04:01:08 up 210 days, 6:01, 0 users, load average: 0.00, 0.00, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT

For VEID 111 (xxx.xxxx.com) —>
04:01:08 up 210 days, 6:01, 0 users, load average: 0.00, 0.00, 0.02
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT

Leave a Reply