Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have installed vnstat and now I would like to have statistics in my browser like this:

enter image description here

You can see working script here. Where can I get that cgidemo script?


share|improve this question

Rinzwind is right, vnstati generates images. But there is a script also which is written in Perl and uses vnstati. I have found that script after downloading source code of vnstat from here. It is called vnstat.cgi and is located under the folder called examples. You need just configure webserver to run cgi and it outputs the same images as in page.

share|improve this answer
Excellent.Did not think to download the source :( ah well :D – Rinzwind Feb 14 '12 at 10:07
The author of vnstat has also uploaded its source code to GitHub, so can directly download the script from there: (It is currently still the same version as in the 1.11 tarball you linked to.) – Jul 29 '14 at 18:49

You make the images with the command vnstati. From the link:


The purpose of vnstati is to provide image output support for statistics collected using vnstat(1). The image file format is limited to png. All basic outputs of vnStat are supported excluding live traffic features. The image can be outputted either to a file or to standard output.


vnstati [ -cdhimostv? ] [ --cache time ] [ --config file ] [ --days ] [ --dbdir directory ] 
[ --help ] [ --hours ] [ -hs ] [ --hsummary ] [ -i interface ] [ --iface interface ] 
[ --locale locale ] [ --months ] [ -ne ] [ -nh ] [ --noedge ] [ --noheader ] 
[ --output file ] [ -ru ] [ --rateunit ] [ --style number ] [ --summary ] 
[ --top10 ] [ --transparent ] [ --version ] [ -vs ] [ --vsummary ]


vnstati -s -i eth0 -o /tmp/vnstat.png

Output traffic summary for interface eth0 to file /tmp/vnstat.png.

vnstati -vs -i eth0+eth1+eth2 -o /tmp/vnstat.png

Output traffic summary with hourly data under the normal summary for a merge of interfaces eth0, eth1 and eth2 to file /tmp/vnstat.png.

vnstati -h -c 15 -o /tmp/vnstat_h.png

Output hourly traffic statistics for default interface to file /tmp/vnstat_h.png if the file has not been updated within the last 15 minutes.

vnstati -d -ne -nh -o -

Output daily traffic statistics without displaying the header section and edges for default interface to standard output (stdout).

vnstati -m --config /home/me/vnstat.cfg -i -o -

Output monthly traffic statistics for default interface specified in configuration file /home/me/vnstat.cfg to standard output (stdout).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.