2010
02.14

webstat

Simple web based server status display using phew, sqlobject, sqlite3 and flot.

To install flot the following packages are required to be installed first:

  • phew
  • python-sysinfo
  • SQLObject
  • simplejson

To configure webstat to run from Apache as an CGI script the following steps can be followed:

  1. Install dependencies and webstat.
  2. Create configuration file.
  3. Create directory structure and database file.
  4. Configure cron job collecting statistics.
  5. Configure apache.

Download and install webstat:

$ wget http://pekdon.net/uploads/2010/03/webstat-0.1.1.tar.gz
$ tar xvzf webstat-0.1.1.tar.gz
$ cd webstat-0.1.1
# python setup.py install

An example configurataion that stores data in /var/lib/webstat and is published in the web server as /webstat:

[database]
dsn = sqlite:///var/lib/webstat/history.sqlite3
[frontend]
cache = /var/lib/webstat/cache
url = /webstat
url_static = /webstat_static
Setup directory structure:
# mkdir -p /var/lib/webstat
# webstat_db.py /etc/webstat.cfg init
# chown -R apache /var/lib/webstat

Create cron script:

# cat >/etc/cron.d/webstat <<EOF
* * * * * apache /usr/bin/webstat_cron.py /etc/webstat.cfg
EOF
# service crond reload

Configure apache by adding the following to your httpd.conf:

# cat >/etc/httpd/conf.d/webstat <<EOF
ScriptAlias /webstat /usr/lib/python2.4/site-packages/phew/handler.py
Alias /webstat_static /usr/lib/python2.4/site-packages/webstat/static
<Location /webstat>
SetEnv PHEW_APP_MODULE webstat
SetEnv PHEW_CONFIG /etc/webstat.cfg
</Location>
EOF
# service httpd reload

No Comment.

Add Your Comment