And so we'll see the load avg for VEID 312 as many times as your VPS count is. Replace please 312 with $VEID.
Martin Dobrev Sent from iPhone 4 On 06.03.2012, at 02:21, Dragomir Zhelev <[email protected]> wrote: > > Some fixes to work better : > > #!/bin/bash > > NO_HEADER=0 > NO_COLOR=0 > while getopts "hHC" OPTION; do > case $OPTION in > h) > echo "usage $0 options" > echo "OPTIONS:" > echo " -h Show this help message" > echo " -H Disable the header" > echo " -C Disable colors" > exit 1 > ;; > H) > NO_HEADER=1 > ;; > C) > NO_COLOR=1 > ;; > esac > done > > if [ $NO_HEADER -eq 0 ]; then > printf " %-15s %-20s %-15s %-9s %s\r\n" "VEID" "Hostname" "Load: > 1min" "5min" "15min" > fi > for VEID in `vzlist -H -octid`; do > source /etc/vz/conf/$VEID.conf > #LOADTOTAL=$(cat /vz/root/$VEID/proc/loadavg | awk '{print $1,$2,$3}') > LOADTOTAL=$(vzctl exec 312 cat /proc/loadavg | awk '{print $1,$2,$3}') > LOAD_1MIN=$(echo $LOADTOTAL | awk '{print $1}') > LOAD_5MIN=$(echo $LOADTOTAL | awk '{print $2}') > LOAD_15MIN=$(echo $LOADTOTAL | awk '{print $3}') > LOAD=${LOAD_1MIN/.*} > [ ${#HOSTNAME} -gt 20 ] && HOSTNAME="${HOSTNAME:0:17}..." > if [ $NO_COLOR -eq 0 ]; then > [ $LOAD -lt 3 ] && COLOR="\033[1;32m" > [ $LOAD -ge 3 ] && COLOR="\033[1;33m" > [ $LOAD -ge 7 ] && COLOR="\033[1;31m" > fi > printf "$COLOR %-15s %-20s %10s %9s %10s\033[0m\r\n" $VEID $HOSTNAME > $LOAD_1MIN $LOAD_5MIN $LOAD_15MIN > done > > > > > On 6.03.2012 02:03, Steven Crothers wrote: >> >> Also, as a side note, I'm really really good at reading man pages. >> >> (What I really mean is I'm not) >> >> Thanks guys! >> >> PS: Mine has color :P >> >> On Mon, Mar 5, 2012 at 6:52 PM, Martynas Venckus <[email protected]> wrote: >> vzlist -o veid,hostname,laverage >> >> On 3/6/12, Kir Kolyshkin <[email protected]> wrote: >> > If I am not mistaken (can't check right now), vzlist have a field for that. >> > On Mar 6, 2012 3:27 AM, "Steven Crothers" <[email protected]> >> > wrote: >> > >> >> I needed something to show me load averages of each individual VE quickly. >> >> >> >> Figured I would share it with the community in case someone else was >> >> looking for similar functionality. >> >> >> >> https://gist.github.com/1981920 >> >> >> >> Disclaimer: Yes, I'm aware I probably don't follow bash best practices, >> >> however I don't really care since its under 50 lines anyway :) >> >> >> >> -- >> >> Steven Crothers >> >> [email protected] >> >> >> >> >> >> _______________________________________________ >> >> Users mailing list >> >> [email protected] >> >> https://openvz.org/mailman/listinfo/users >> >> >> >> >> > >> _______________________________________________ >> Users mailing list >> [email protected] >> https://openvz.org/mailman/listinfo/users >> >> >> >> -- >> Steven Crothers >> [email protected] >> >> >> >> _______________________________________________ >> Users mailing list >> [email protected] >> https://openvz.org/mailman/listinfo/users > > > -- > Dragomir Zhelev > CEO > Delta SoftMedia OOD > Cellular: +359 895 66 99 79 > E-mail: [email protected] > Web: Delta.BG > <logo.png> > _______________________________________________ > Users mailing list > [email protected] > https://openvz.org/mailman/listinfo/users
_______________________________________________ Users mailing list [email protected] https://openvz.org/mailman/listinfo/users
