May 21st, 2011

nepal

vzubc v.3

This is a third version of vzubc script. I kinda start to like it, it is really helpful. I will probably finish the TODO, write the man page and will include the tool to vzctl.

The script parses /proc/bc/resources (or /proc/user_beancounters) and outputs it in a more human-readable format.

FEATURES:
1. Held, maxheld, barrier, limit, and fail counter are shown for every beancounter.
2. Values that are in pages are converted to bytes
3. Long values are converted to kilo-, mega-, gigabytes etc.
4. For held and maxheld it shows how close the value to the barrier and the limit, in per cent
5. Can be used both inside CT and on HN
6. User can specify CTIDs or CT names to output info about
7. Optional top-like autoupdate mode (using "watch")
8. Optional "relative failcnt" mode (show increase in UBC fail counters since last run)
9. Optional quiet mode (only shows "worth to look at" UBCs (ie ones close to limits and/or with failcnt))

CHANGES from v.2:
* Added lots of options/features (watch mode, relative failcnt, quiet), TODO list is times

Script: vzubc

Example output:
vzubc -c 111 -q
-------------------------------------------------------------------
CT 111       | HELD  Bar%  Lim%| MAXH  Bar%  Lim%| BAR | LIM |+FAIL
-------------+-----------------+-----------------+-----+-----+-----
     kmemsize|13.6M   99%   96%|13.7M  100%   97%|13.7M|14.1M|   19 
      numproc| 170    70%   70%| 172    71%   71%| 240 | 240 |    - 
-------------------------------------------------------------------


TODO:
* colors
* recognize vSwap
* add UBC consistency check a la vzcfgvalidate (helpful for CT owner!)
* rewrite in C??