1533 |
richard |
1 |
<?php
|
|
|
2 |
//
|
|
|
3 |
// vnStat PHP frontend (c)2006-2010 Bjorge Dijkstra (bjd@jooz.net)
|
|
|
4 |
//
|
|
|
5 |
// This program is free software; you can redistribute it and/or modify
|
|
|
6 |
// it under the terms of the GNU General Public License as published by
|
|
|
7 |
// the Free Software Foundation; either version 2 of the License, or
|
|
|
8 |
// (at your option) any later version.
|
|
|
9 |
//
|
|
|
10 |
// This program is distributed in the hope that it will be useful,
|
|
|
11 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
12 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
13 |
// GNU General Public License for more details.
|
|
|
14 |
//
|
|
|
15 |
// You should have received a copy of the GNU General Public License
|
|
|
16 |
// along with this program; if not, write to the Free Software
|
|
|
17 |
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
18 |
//
|
|
|
19 |
//
|
1675 |
richard |
20 |
// see file COPYING or at http://www.gnu.org/licenses/gpl.html
|
1533 |
richard |
21 |
// for more information.
|
|
|
22 |
//
|
|
|
23 |
error_reporting(E_ALL | E_NOTICE);
|
|
|
24 |
|
|
|
25 |
//
|
|
|
26 |
// configuration parameters
|
|
|
27 |
//
|
|
|
28 |
// edit these to reflect your particular situation
|
|
|
29 |
//
|
1675 |
richard |
30 |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
|
|
|
31 |
{
|
|
|
32 |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
|
|
33 |
$Language = strtolower(substr(chop($Langue[0]),0,2));
|
|
|
34 |
}
|
|
|
35 |
if($Language == 'fr')
|
|
|
36 |
{
|
|
|
37 |
$locale = 'fr_FR.UTF-8';
|
|
|
38 |
$language = 'fr';
|
|
|
39 |
$title = 'Traffic Internet sortant';
|
|
|
40 |
date_default_timezone_set("Europe/Paris");
|
|
|
41 |
}
|
|
|
42 |
else
|
|
|
43 |
{
|
|
|
44 |
$locale = 'en_US.UTF-8';
|
|
|
45 |
$language = 'en';
|
|
|
46 |
$title = 'Internet outbound';
|
|
|
47 |
date_default_timezone_set("Europe/London");
|
|
|
48 |
}
|
1533 |
richard |
49 |
|
|
|
50 |
// list of network interfaces monitored by vnStat
|
1675 |
richard |
51 |
$iface_list = array('enp0s3');
|
1533 |
richard |
52 |
|
|
|
53 |
//
|
|
|
54 |
// optional names for interfaces
|
|
|
55 |
// if there's no name set for an interface then the interface identifier
|
|
|
56 |
// will be displayed instead
|
1675 |
richard |
57 |
//
|
|
|
58 |
$iface_title['enp0s3'] = $title;
|
1533 |
richard |
59 |
|
|
|
60 |
//
|
|
|
61 |
// There are two possible sources for vnstat data. If the $vnstat_bin
|
|
|
62 |
// variable is set then vnstat is called directly from the PHP script
|
1675 |
richard |
63 |
// to get the interface data.
|
1533 |
richard |
64 |
//
|
|
|
65 |
// The other option is to periodically dump the vnstat interface data to
|
|
|
66 |
// a file (e.g. by a cronjob). In that case the $vnstat_bin variable
|
|
|
67 |
// must be cleared and set $data_dir to the location where the dumps
|
|
|
68 |
// are stored. Dumps must be named 'vnstat_dump_$iface'.
|
|
|
69 |
//
|
|
|
70 |
// You can generate vnstat dumps with the command:
|
|
|
71 |
// vnstat --dumpdb -i $iface > /path/to/data_dir/vnstat_dump_$iface
|
1675 |
richard |
72 |
//
|
1533 |
richard |
73 |
$vnstat_bin = '/usr/bin/vnstat';
|
|
|
74 |
$data_dir = './dumps';
|
|
|
75 |
|
|
|
76 |
// graphics format to use: svg or png
|
|
|
77 |
$graph_format='svg';
|
1675 |
richard |
78 |
|
|
|
79 |
// preferred byte notation. null auto chooses. otherwise use one of
|
|
|
80 |
// 'TB','GB','MB','KB'
|
|
|
81 |
$byte_notation = null;
|
|
|
82 |
|
1533 |
richard |
83 |
// Font to use for PNG graphs
|
|
|
84 |
define('GRAPH_FONT',dirname(__FILE__).'/VeraBd.ttf');
|
|
|
85 |
|
|
|
86 |
// Font to use for SVG graphs
|
|
|
87 |
define('SVG_FONT', 'Verdana');
|
|
|
88 |
|
|
|
89 |
// Default theme
|
2281 |
tom.houday |
90 |
define('DEFAULT_COLORSCHEME', 'alcasar');
|
1675 |
richard |
91 |
|
|
|
92 |
// SVG Depth scaling factor
|
|
|
93 |
define('SVG_DEPTH_SCALING', 1);
|
1533 |
richard |
94 |
|
|
|
95 |
?>
|