File: INSTALL

package info (click to toggle)
vnstat 1.10-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 572 kB
  • ctags: 398
  • sloc: ansic: 6,490; sh: 336; perl: 150; makefile: 85
file content (160 lines) | stat: -rw-r--r-- 5,449 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
(Updated 2.1.2010 for version 1.10)


Compiling the binaries
::::::::::::::::::::::

 This source package contains the required sources for vnStat including
 the daemon (vnstatd) and image output (vnstati). Executing

     make

 will compile 'vnstat' and 'vnstatd' without requiring additional libraries.
 The optional image output however requires libgd2 to be available. The
 required extra packages are usually named libgd2 and libgd2-dev (or
 libgd2-noxpm and libgd2-noxpm-dev in Debian/Ubuntu, xpm version can also
 be used). Executing

     make all

 will compile everything including the image output support. An example
 cgi ('vnstat.cgi') to be used with http server with the image output
 support has been provided in the 'examples' directory. Configuration
 options for the cgi are in the beginning of the file.


Installing as root
::::::::::::::::::

 Login as root and run the following command:

     make install

 If there were no errors, vnStat binaries, man pages and a config file
 should now be installed. Next the used kernel should be checked that it
 is able to provide static information about the system boot time.

     vnstat --testkernel

 The only way to fix a faulty kernel (afaik) is to compile/install a newer
 one. Next every interface that should be monitored needs to be introduced
 to vnStat. Replace 'eth0' in the command with any available interface if
 needed.

     vnstat -u -i eth0

 Repeat that for every other interface you wish to use. If you are unsure
 of available interface names then run

     vnstat --iflist

 and select a suitable looking interface from the provided list. Usually
 'lo' isn't the one you are looking for.

 The configuration file /etc/vnstat.conf should also be checked at this
 point. See the vnstat.conf man page for documentation about available
 options.

 Finally make vnStat monitor the selected interface(s). There are two way
 for updating interface data, daemon and cron. It is suggested to use daemon
 based updating because it generated less disk access and is more accurate
 especially when monitoring interfaces that aren't always available. Select
 ONLY ONE of these two:


 1) daemon based updating
 ::::::::::::::::::::::::

   Configure init scripts so that the following command is executed once
   during system start:

       vnstatd -d

   The examples/init.d directory contains suitable init.d scripts for
   some commonly used distributions. An alternative option is to just add
   the command to an already existing script that gets executed during 
   startup. In many distributions /etc/rc.local can be used for that.


 2) cron based updating
 ::::::::::::::::::::::

   Copy the example cron file to /etc/cron.d

       cp examples/vnstat.cron /etc/cron.d/vnstat

   and edit the cron file if the default 5 minute update interval is too
   long. See the vnStat man page 'restrictions' section for limitations
   regarding fast interfaces and 32 bit interface traffic counters. Devices
   like ppp0 also require vnStat enable and disable commands to be added
   to suitable script file when cron based updating is used. Example scripts
   can be found in the 'examples' directory.


Installing without root access
::::::::::::::::::::::::::::::

 Copy all needed binaries to some directory included in your $PATH
 (~/bin/ is an example) and make the database directory.

     cp src/vnstat src/vnstatd src/vnstati ~/bin/
     cp cfg/vnstat.conf ~/.vnstatrc
     mkdir ~/.vnstat

 During version 1.0 it became clear that some kernels are broken and don't
 provide to correct boot time for the system. vnStat requires this information
 so there's a test to see if the kernel is working correctly.

     vnstat --testkernel

 If this gives 'command not found' then check your $PATH. The only way to fix
 a faulty kernel (afaik) is to compile/install a newer one. This can't be done
 without the root account so you'll have to solve this problem with your
 sysadmin if the kernel is broken.

 Now open the config file ~/.vnstatrc with your favorite text editor and locate
 the following line:
 
     DatabaseDir "/var/lib/vnstat"

 and replace it with
 
     DatabaseDir "/pathtomyhomedir/.vnstat"

 and save the file. If you are unsure about you homedir path execute
 
     cd ; pwd

 The ouput should tell your homedir. 

 Next every interface that should be monitored needs to be introduced
 to vnStat. Replace 'eth0' in the command with any available interface if
 needed.

     vnstat -u -i eth0

 Repeat that for every other interface you wish to use. Now it's time to add
 a crontab entry for vnStat. Do that by executing the command 'crontab -e'
 and add the following line (without leading spaces, remember to change the
 path):

     */5 * * * * ~/bin/vnstat -u

 OR if the daemon can be used

     @reboot ~/bin/vnstatd -d

 If you found yourself using a strange editor then 'man vi' should help.

 If you choose to use the daemon then make sure the configuration file
 (~/.vnstatrc) has the log option either disabled or set to a file that
 is located in a place where you have write permissions, such as your
 home dir. Then (if using the daemon) try starting it with 'vnstat -d'.

 After that wait for (or generate) at least 1024 bytes of network traffic
 (and 5 min for the next cron/daemon update).

     vnstat

 Now you should get some stats about your network usage. See the config
 file ~/.vnstatrc for interface and other settings.