Closed GoogleCodeExporter closed 9 years ago
Is anyone willing to pay for it? It'll be a couple hours of work.
Original comment by baron.schwartz
on 15 Dec 2009 at 3:11
Sample PHP code to parse /proc/user_beancounters and get into a nice array:
<?php
$cmd = "cat /proc/user_beancounters";
$str = `$cmd`;
$result = array();
foreach ( explode("\n", $str) as $line ) {
if (!preg_match("/^\s+uid/",$line) &&
preg_match("/[0-9]/",$line) &&
!preg_match("/^\s+dummy/i",$line) &&
!preg_match("/^Version/",$line)) {
// kmemsize is a special case
if(preg_match("/^\s+[0-9]/",$line)) {
$words = preg_split('/\s+/', $line);
$result['kmemsize_held'] = $words[3];
$result['kmemsize_maxheld'] = $words[4];
$result['kmemsize_barrier'] = $words[5];
$result['kmemsize_limit'] = $words[6];
$result['kmemsize_failcnt'] = $words[7];
} else {
// The rest are sane
$words = preg_split('/\s+/', $line);
$result[$words[1]."_held"] = $words[2];
$result[$words[1]."_maxheld"] = $words[3];
$result[$words[1]."_barrier"] = $words[4];
$result[$words[1]."_limit"] = $words[5];
$result[$words[1]."_failcnt"] = $words[6];
}
}
}
print_r($result);
?>
Original comment by ryan.a.l...@gmail.com
on 17 Dec 2009 at 1:58
A sample file, for test case:
Version: 2.5
uid resource held maxheld
barrier limit failcnt
200: kmemsize 8906701 25288727
147901640 147901640 0
lockedpages 0 0
256 256 0
privvmpages 39695 61719
262144 262144 0
shmpages 688 1392
21504 21504 0
dummy 0 0
0 0 0
numproc 32 58
240 240 0
physpages 11101 18217
0 9223372036854775807 0
vmguarpages 0 0
33792 9223372036854775807 0
oomguarpages 11101 18217
26112 9223372036854775807 0
numtcpsock 6 32
360 360 0
numflock 6 8
188 206 0
numpty 1 1
16 16 0
numsiginfo 0 20
256 256 0
tcpsndbuf 338656 375920
27033600 27033600 0
tcprcvbuf 98304 218448
1720320 2703360 0
othersockbuf 9280 31136
1126080 2097152 0
dgramrcvbuf 0 9760
262144 262144 0
numothersock 9 26
360 360 0
dcachesize 0 0
3409920 3624960 0
numfile 788 1298
9312 9312 0
dummy 0 0
0 0 0
dummy 0 0
0 0 0
dummy 0 0
0 0 0
numiptent 10 10
128 128 0
Original comment by ryan.a.l...@gmail.com
on 17 Dec 2009 at 2:20
(sample output, as a file)
Original comment by ryan.a.l...@gmail.com
on 17 Dec 2009 at 2:21
Attachments:
Ryan, can you attach the file as an attachment? It's mangled.
Original comment by baron.schwartz
on 17 Dec 2009 at 2:21
another test, as a file
Original comment by ryan.a.l...@gmail.com
on 17 Dec 2009 at 2:23
Attachments:
Documentation: http://wiki.openvz.org/Proc/user_beancounters
When done, we should post a note at http://wiki.openvz.org/Category:Monitoring
Original comment by baron.schwartz
on 10 Jan 2010 at 3:07
And at http://forums.cacti.net/post-161341.html
Original comment by baron.schwartz
on 10 Jan 2010 at 3:17
This issue was closed by revision r400.
Original comment by baron.schwartz
on 10 Jan 2010 at 5:40
Original issue reported on code.google.com by
ryan.a.l...@gmail.com
on 14 Dec 2009 at 11:33