aboutsummaryrefslogtreecommitdiffstats
path: root/config/vnstat2/vnstat2.inc
diff options
context:
space:
mode:
authorPerry Mason <crazypark2@yahoo.dk>2010-06-30 12:59:15 +0200
committerPerry Mason <crazypark2@yahoo.dk>2010-06-30 12:59:15 +0200
commit3b87bfcae6694fbac7c58f8a177f6d31662fe71e (patch)
treefee7085dc450ba525a8c632fcc2e9d32baccdb0c /config/vnstat2/vnstat2.inc
parentf45d963e3890e2b805b7720e1d242f31c2039b48 (diff)
downloadpfsense-packages-3b87bfcae6694fbac7c58f8a177f6d31662fe71e.tar.gz
pfsense-packages-3b87bfcae6694fbac7c58f8a177f6d31662fe71e.tar.bz2
pfsense-packages-3b87bfcae6694fbac7c58f8a177f6d31662fe71e.zip
[vnstat2] adding monthrotate and vnstati
Diffstat (limited to 'config/vnstat2/vnstat2.inc')
-rw-r--r--config/vnstat2/vnstat2.inc56
1 files changed, 56 insertions, 0 deletions
diff --git a/config/vnstat2/vnstat2.inc b/config/vnstat2/vnstat2.inc
index 75c4f9db..26e9acfd 100644
--- a/config/vnstat2/vnstat2.inc
+++ b/config/vnstat2/vnstat2.inc
@@ -24,6 +24,62 @@ function vnstat_install_deinstall() {
configure_cron();
conf_mount_ro();
}
+function change_vnstat_conf(){
+ conf_mount_rw();
+ global $config;
+ $monthrotate = $_POST['monthrotate'];
+
+// ************ Write new vnstat.conf *****************
+
+ $vnstat_conf_file = <<<EOF
+# vnStat 1.10 config file
+##
+
+# location of the database directory
+# DatabaseDir "/usr/local/pkg/vnstat"
+
+# on which day should months change
+MonthRotate $monthrotate
+
+# vnstati
+##
+
+# image colors
+CBackground "F0F0F0"
+CEdge "AEAEAE"
+CHeader "990000"
+CHeaderTitle "F0F0F0"
+CHeaderDate "FFFFFF"
+CText "000000"
+CLine "B0B0B0"
+CLineL "-"
+CRx "666666"
+CTx "990000"
+CRxD "-"
+CTxD "-"
+EOF;
+
+ $hf2 = fopen("/usr/local/etc/vnstat.conf","w");
+ if(!$hf2) {
+ log_error("could not open /usr/local/etc/vnstat.conf for writing");
+ exit;
+ }
+ fwrite($hf2, $vnstat_conf_file);
+ fclose($hf2);
+ conf_mount_ro();
+}
+
+function create_vnstati_image() {
+ conf_mount_rw();
+ global $config;
+ exec("[ ! -d dir ] && mkdir /usr/local/www/vnstati");
+ $iface = $_POST['vnstat_interface'];
+ $iface2 = $_POST['output_type'];
+ $ifaces_final = convert_friendly_interface_to_real_interface_name($iface);
+// exec("/usr/local/bin/vnstati -i ". $ifaces_final ." -". $iface2 ." -o /usr/local/www/vnstati/". $ifaces_final ."-". $iface2 .".png");
+ exec("/usr/local/bin/vnstati -i ". $ifaces_final ." -". $iface2 ." -o /usr/local/www/vnstati/newpicture.png");
+ conf_mount_ro();
+}
function vnstat_install_config() {
global $config;