New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
OpenVZ IO accounting spreadsheet
I wrote a little script which is so little and so useful I thought it should be shared
This is to gather the IO reads and writes by container ID and put them in an Excel-friendly format. Just copy and paste the script in and copy and paste the results into Excel.
for CT in $(vzlist -H -o veid) do reads=$(cat /proc/bc/${CT}/ioacct | sed 's/\t//g' | grep ^read | awk '{ print $2 }') writes=$(cat /proc/bc/${CT}/ioacct | sed 's/\t//g' | grep ^write | awk '{ print $2 }') echo -e "${CT}\t${reads}\t${writes}" done
Comments
Hey that's pretty cool.. is this in bytes or in I/O operations?
It's in bytes
Mistook the tittle for a certain high RAM brand
hehe :P
So did I .
You could optimize it a little bit and get rid of grep by using:
awk '/^read/ { print $2 }' awk '/^write/ { print $2 }'
I'm not sure why you need sed, awk can deal with '\t'
And the dead cat is most probably also not needed.
I have no way of testing it now, but there is high chance that this will give you the same results:
for CT in $(vzlist -H -o veid) do reads=$(awk '/^read/ { print $2 }' /proc/bc/${CT}/ioacct) writes=$(awk '^/write/ { print $2 }' /proc/bc/${CT}/ioacct) echo -e "${CT}\t${reads}\t${writes}" done
can someone take this one step further and run it 10 seconds apart and compare the results so we could see who are io hogs?