Welcome to
LabradorData INTERNET SERVICES
Exclusive Provider of
MyWebMaker
beanc helper app for vpsinfo & loadavg
beanc is a tiny helper application required by the vpsinfo and loadavg scripts when run on a Linux Virtuozzo v.3 or OpenVZ VPS (Virtual Private Server).

Statistics reflecting the current status of a Linux Virtuozzo or OpenVZ VPS are recorded in the file /proc/user_beancounters. On a Virtuozzo v. 2.6 server this file is globally accessible, meaning any user can read it. The vpsinfo and loadavg scripts can readily access this status information.

This changed with Virtuozzo v. 3 and OpenVZ. In these new releases the beancounters file is accessible only by the root user, hence web-based scripts cannot read the information.

To work around this issue, vpsinfo & loadavg are now rewritten to use a small 'helper' application ('beanc') that is able to access the beancounters file. beanc is a tiny C application that does nothing but print the contents of /proc/user_beancounters, which then can be processed by a web-based script. It is installed setuid so that it always runs as root.

You may quickly install beanc from a shell prompt as the root user:

[root@vps]# wget http://www.labradordata.ca/downloads/install_beanc.sh 
[root@vps]# sh install_beanc.sh

The installation script will:

  1. Fetch the beanc source code (beanc.c) from this server;
  2. Compile the code into an executable;
  3. Install the executable setuid at /bin/beanc.

Once beanc is installed vpsinfo & loadavg will automatically use it. No further configuration of the helper app is required.

If you would like to view the source code or the installation script source prior to proceeding, you may do so here:


Thanks go to 'mkhs' for the idea behind this approach and the C source code.

If you have any trouble with the installation script please let me know: drobbinslabradordataca

-- Doug Robbins

© 2008 LabradorData

Powered by MyWebMaker CMS

Cached · 3 MySQL queries · Generated in 0.0017 sec

Webmaster Login