"Fossies" - the Fresh Open Source Software Archive 
Member "vnstat-2.9/INSTALL_BSD" (4 Sep 2021, 5052 Bytes) of package /linux/misc/vnstat-2.9.tar.gz:
As a special service "Fossies" has tried to format the requested text file into HTML format (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
See also the last
Fossies "Diffs" side-by-side code changes report for "INSTALL_BSD":
2.7_vs_2.8.
1
2 # tl;dr
3
4 ./configure && make && make install
5
6
7 # Prerequisites
8
9 - make or gmake
10 - C compiler
11 - user with access to kernel interface statistics
12 - usually available by default but may be restricted by security settings
13 - databases/sqlite3
14 - graphics/gd (optional, image output)
15 - devel/check (optional, test suite)
16 - devel/pkg-config (optional, for check detection)
17 - devel/autotools (optional, for recreating configure and makefiles)
18
19
20 # Compiling the binaries
21
22 This source package contains the required source files for vnStat including
23 the daemon (`vnstatd`) and image output (`vnstati`). Executing
24
25 ./configure && make
26
27 will compile `vnstat` and `vnstatd` without requiring additional libraries.
28 The optional image output capable binary `vnstati` will also be compiled if
29 the required additional libgd2 library is found to be available and
30 `--disable-image-output` isn't given as parameter for `./configure`.
31
32 An example cgi (`vnstat.cgi`) to be used with a http server with the image
33 output support has been provided in the `examples` directory. Configuration
34 options for the cgi are in the beginning of the file. Additional examples
35 for using the json output are also available in the same directory.
36
37 For executing the optional test suite, see the appendix at the end of this
38 file.
39
40
41 # Installing as root
42
43 Login as root and run the following command:
44
45 make install
46
47 If there were no errors, vnStat binaries, man pages and a configuration
48 file should now be installed. The configuration file will be upgraded using
49 previously configured values if it is found already to exist. A backup
50 of the previous configuration file will be named as `vnstat.conf.old` in the
51 current directory.
52
53 The configuration file `/usr/local/etc/vnstat.conf` should be checked at
54 this point. See the `vnstat.conf` man page for documentation about available
55 options.
56
57 Finally make vnStat monitor the selected interface(s). Configure init
58 scripts so that the following command is executed once during system
59 startup:
60
61 /usr/local/sbin/vnstatd -d
62
63 One suitable place is for example `/etc/rc.local`.
64
65 During first startup, the daemon (`vnstatd`) should list and add all
66 available interfaces for monitoring. The command can also be executed
67 manually at this point in order to avoid having to reboot the system
68 Depending on configuration, it may take some minutes for the `vnstat`
69 command to begin showing results as the entries in the database aren't
70 updated constantly.
71
72 Monitoring of unwanted interfaces can be stopped with:
73
74 vnstat --remove -i ethunwanted
75
76
77 # Installing without root access
78
79 Copy all needed binaries to some directory included in your PATH
80 (`~/bin/` is used here as an example) and create the database directory.
81
82 cp -v vnstat vnstatd vnstati ~/bin/
83 cp -v cfg/vnstat.conf ~/.vnstatrc
84 mkdir ~/.vnstat
85
86 Next open the configuration file `~/.vnstatrc` with your favorite text editor
87 and locate the following line:
88
89 DatabaseDir "/var/lib/vnstat"
90
91 and replace it with
92
93 DatabaseDir "/pathtomyhomedir/.vnstat"
94
95 Next, locate the following lines:
96
97 UseLogging 2
98 LogFile "/var/log/vnstat/vnstat.log"
99 PidFile "/var/run/vnstat/vnstat.pid"
100
101 and replace them with
102
103 UseLogging 1
104 LogFile "/pathtomyhomedir/.vnstat/.log"
105 PidFile "/pathtomyhomedir/.vnstat/.pid"
106
107 Finally, save the file. If you are unsure about your home directory path, execute
108
109 cd ; pwd
110
111 The output should tell your home directory.
112
113 Now it's time to add a crontab entry for vnStat. Do that by executing the
114 command `crontab -e` and add the following line (without leading spaces,
115 remember to change the path):
116
117 @reboot ~/bin/vnstatd -d
118
119 If you found yourself using a strange editor then `man vi` may help.
120
121 Make sure the configuration file (`~/.vnstatrc`) has the log option either
122 disabled or set to a file that is located in a place where you have write
123 permissions, such as your home dir. Then try starting the daemon with
124
125 vnstatd -d
126
127 After that wait for (or generate) at least 1 byte of network traffic
128 (and 5 min for the next database file save).
129
130 vnstat
131
132 Now you should get some statistics about your network usage. See the config
133 file `~/.vnstatrc` for interface and other settings.
134
135
136 # Appendix: Running the test suite
137
138 This step isn't mandatory for using vnStat.
139
140 The source package includes a test suite for validating many of the
141 functionalities provided and used by the executables. The test suite requires
142 the Check unit testing framework ( https://libcheck.github.io/check/ ) to
143 be installed and available (usually `devel/check` in ports). The configure
144 script also assumes that the `pkg-config` command is installed. That command
145 is usually part of the `devel/pkgconf` package. After the `./configure` script
146 has been executed the test suite can be executed with:
147
148 make check
149
150 The output should show a non-zero number of tests executed if all the
151 necessary packages were available. A more detailed list of executed tests
152 can be seen from the `check_vnstat.log` file after execution.