forked from vergoh/vnstat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
INSTALL_BSD
101 lines (65 loc) · 3.31 KB
/
INSTALL_BSD
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
Compiling the binaries
::::::::::::::::::::::
This source package contains the required source files for vnStat including
the daemon (vnstatd) and image output (vnstati). Executing
./configure && make
will compile 'vnstat' and 'vnstatd' without requiring additional libraries.
The optional image output capable binary 'vnstati' will also be compiled if
the required additional libgd2 library is found to be available. In
BSD ports libgd2 is usually named simply 'gd'. Executing
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. Additional examples
for using the json output are also available in the same directory.
Some BSD users may need to provide correct LIBRARY_PATH and CPATH to the
configure script if the image output is wanted but the location of libgd2
isn't automatically detected.
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. The configuration file will be upgraded using
previously configured values if it is found already to exist.
The configuration file /usr/local/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). Configure init
scripts so that the following command is executed once during system
start:
vnstatd -d
One suitable place is for example /etc/rc.local.
During first startup, the daemon (vnstatd) should list and add all
available interfaces for monitoring. Depending on configuration, it may
take some minutes for the 'vnstat' command to begin showing results.
Monitoring of unwanted interfaces can be stopped with:
vnstat --delete -i ethunwanted
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 -v vnstat vnstatd vnstati ~/bin/
cp -v cfg/vnstat.conf ~/.vnstatrc
mkdir ~/.vnstat
Next 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 your home directory path, execute
cd ; pwd
The ouput should tell your home directory.
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):
@reboot ~/bin/vnstatd -d
If you found yourself using a strange editor then 'man vi' should help.
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 try starting the daemon with
vnstat -d
After that wait for (or generate) at least 1024 bytes of network traffic
(and 5 min for the next database file save).
vnstat
Now you should get some stats about your network usage. See the config
file ~/.vnstatrc for interface and other settings.