Skip to content

Snippet: Visualize your vnstat output with a PHP frontend

You want some fance graphics instead of boring numbers for your vnstat-statistics? No problem. Bjorge Dijkstra developed some time ago a small php script. You need a running apache (httpd) or another webserver with php-abilities. Get the tar-archive from Bjorges website, extract it and see what happened.

# su -
# cd /sev/http
# wget http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.5.1.tar.gz
# tar xfz vnstat_php_frontend-1.5.1.tar.gz
# mv vnstat_php_frontend-1.5.1.tar.gz vnstat
# cd vnstat
# ls -al
insgesamt 148
-rw-r--r-- 1 5000 5000  2505 15. Jan 20:35 config.php
-rw-r--r-- 1 5000 5000 18038 17. Mär 2010  COPYING
-rw-r--r-- 1 5000 5000 10590 17. Mär 2010  graph.php
-rw-r--r-- 1 5000 5000 12055 17. Mär 2010  graph_svg.php
-rw-r--r-- 1 5000 5000  6095 17. Mär 2010  index.php
drwxr-xr-x 2 5000 5000  4096 15. Jan 20:32 lang
-rw-r--r-- 1 5000 5000   261 17. Mär 2010  localize.php
-rw-r--r-- 1 5000 5000  1624 17. Mär 2010  README
drwxr-xr-x 6 5000 5000  4096 17. Mär 2010  themes
-rw-r--r-- 1 5000 5000 58716 17. Mär 2010  VeraBd.ttf
-rw-r--r-- 1 5000 5000  5954 17. Mär 2010  vera_copyright.txt
-rw-r--r-- 1 5000 5000  6549 17. Mär 2010  vnstat.php

Just one step left:
edit the config.php – look for the following lines and edit that they fit your needs. If you don’t speak netherlands you may change ‘nl’ to ‘en’.
There are some other translations you can use else then nl and en. Check them out within the lang folder.

    $locale = 'en_US.UTF-8';
    $language = 'en';

    // list of network interfaces monitored by vnStat
    $iface_list = array('enp4s0');

I created a german translation [1]. Copy it into the lang-folder extract it and edit your config.php in the parent folder to use the “de”-translation.
[1] de.taz

Post a Comment

You must be logged in to post a comment.