2010
02.14
02.14
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:
- Install dependencies and webstat.
- Create configuration file.
- Create directory structure and database file.
- Configure cron job collecting statistics.
- 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