aboutsummaryrefslogtreecommitdiffstats
path: root/config/vnstat2
diff options
context:
space:
mode:
authorPerry Mason <crazypark2@yahoo.dk>2010-12-22 09:03:35 +0100
committerPerry Mason <crazypark2@yahoo.dk>2010-12-22 09:03:35 +0100
commit46fbcd64170802436776ad822db94435851e8e2c (patch)
tree58e2dafd65e5cfa65646174379cc20027f7b30f6 /config/vnstat2
parentdfbb5e15dfdcacafbb7544257da252a0c4ea33ed (diff)
downloadpfsense-packages-46fbcd64170802436776ad822db94435851e8e2c.tar.gz
pfsense-packages-46fbcd64170802436776ad822db94435851e8e2c.tar.bz2
pfsense-packages-46fbcd64170802436776ad822db94435851e8e2c.zip
[vnstat2] Change vnstati, fix monthrate on install, add go back link
Diffstat (limited to 'config/vnstat2')
-rw-r--r--config/vnstat2/bin/diag_vnstat.abc2
-rw-r--r--[-rwxr-xr-x]config/vnstat2/bin/diag_vnstat2.abc2
-rw-r--r--config/vnstat2/bin/vnstat2_img.abc6
-rw-r--r--config/vnstat2/bin/vnstati.abc17
-rw-r--r--config/vnstat2/vnstat2.inc16
-rw-r--r--config/vnstat2/vnstat2.xml24
-rw-r--r--config/vnstat2/vnstati.xml18
7 files changed, 54 insertions, 31 deletions
diff --git a/config/vnstat2/bin/diag_vnstat.abc b/config/vnstat2/bin/diag_vnstat.abc
index db683a15..afef3849 100644
--- a/config/vnstat2/bin/diag_vnstat.abc
+++ b/config/vnstat2/bin/diag_vnstat.abc
@@ -44,7 +44,6 @@ require("guiconfig.inc");
$pfSversion = str_replace("\n", "", file_get_contents("/etc/version"));
$pgtitle = gettext("Vnstat2 summary ");
-
if($_REQUEST['getactivity']) {
$text = `vnstat`;
$text .= "<p/>";
@@ -80,6 +79,7 @@ include("head.inc");
include("fbegin.inc");
if(strstr($pfSversion, "1.2"))
echo "<p class=\"pgtitle\">{$pgtitle}</p>";
+ echo "<a href=$myurl/pkg_edit.php?xml=vnstatoutput.xml&id=0>Go Back</a><br />";
if($savemsg) {
echo "<div id='savemsg'>";
print_info_box($savemsg);
diff --git a/config/vnstat2/bin/diag_vnstat2.abc b/config/vnstat2/bin/diag_vnstat2.abc
index e41f9dc1..e4ef0f21 100755..100644
--- a/config/vnstat2/bin/diag_vnstat2.abc
+++ b/config/vnstat2/bin/diag_vnstat2.abc
@@ -44,7 +44,6 @@ $aaaa = $config['installedpackages']['vnstat2']['config'][0]['vnstat_output_nic'
$bbbb = convert_real_interface_to_friendly_descr($aaaa);
$pfSversion = str_replace("\n", "", file_get_contents("/etc/version"));
-
$pgtitle = gettext("Vnstat2 info for $bbbb ($aaaa)");
if($_REQUEST['getactivity']) {
@@ -90,6 +89,7 @@ else
include("fbegin.inc");
if(strstr($pfSversion, "1.2"))
echo "<p class=\"pgtitle\">{$pgtitle}</p>";
+ echo "<a href=$myurl/pkg_edit.php?xml=vnstatoutput.xml&id=0>Go Back</a><br />";
if($savemsg) {
echo "<div id='savemsg'>";
print_info_box($savemsg);
diff --git a/config/vnstat2/bin/vnstat2_img.abc b/config/vnstat2/bin/vnstat2_img.abc
new file mode 100644
index 00000000..85644309
--- /dev/null
+++ b/config/vnstat2/bin/vnstat2_img.abc
@@ -0,0 +1,6 @@
+<?php
+require_once("guiconfig.inc");
+$image = $_GET['image'];
+header("Content-type: image/png");
+readfile("/tmp/$image");
+?>
diff --git a/config/vnstat2/bin/vnstati.abc b/config/vnstat2/bin/vnstati.abc
new file mode 100644
index 00000000..aa76a4b3
--- /dev/null
+++ b/config/vnstat2/bin/vnstati.abc
@@ -0,0 +1,17 @@
+<?php
+require_once("guiconfig.inc");
+global $config;
+include("head.inc");
+include("fbegin.inc");
+$aaaa = $config['installedpackages']['vnstat2']['config'][0]['vnstat_interface'];
+$bbbb = convert_friendly_interface_to_real_interface_name($aaaa);
+$pgtitle = gettext("Vnstati info for $aaaa ($bbbb)");
+echo "<a href=$myurl/pkg_edit.php?xml=vnstati.xml&id=0>Go Back</a><br />";
+echo "<center><p class=\"pgtitle\">{$pgtitle}</p>";
+?>
+<center><img src="vnstat2_img.php?image=newpicture1.png" style="border:1px solid black; center;"><br />
+<center><img src="vnstat2_img.php?image=newpicture2.png" style="border:1px solid black; center;"><br />
+<center><img src="vnstat2_img.php?image=newpicture3.png" style="border:1px solid black; center;"><br />
+<center><img src="vnstat2_img.php?image=newpicture4.png" style="border:1px solid black; center;"><br />
+<?php include("fend.inc"); ?>
+
diff --git a/config/vnstat2/vnstat2.inc b/config/vnstat2/vnstat2.inc
index a8ebe5d5..08c6a28c 100644
--- a/config/vnstat2/vnstat2.inc
+++ b/config/vnstat2/vnstat2.inc
@@ -11,6 +11,8 @@ function vnstat_install_deinstall() {
exec("rm /usr/local/etc/vnstat2.conf");
exec("rm /usr/local/www/diag_vnstat.php");
exec("rm /usr/local/www/diag_vnstat2.php");
+ exec("rm /usr/local/www/vnstati.php");
+ exec("rm /usr/local/www/vnstat2_img.php");
// Remove vnstat cron entry from config.xml
vnstat2_install_cron(false);
conf_mount_ro();
@@ -112,12 +114,13 @@ EOF;
function create_vnstati_image() {
conf_mount_rw();
global $config;
- exec("[ ! -d /usr/local/www/vnstati ] && mkdir /usr/local/www/vnstati");
- $iface = $_POST['vnstat_interface'];
- $iface2 = $_POST['output_type'];
+ $iface = $_POST['vnstat_interface'];
+ $config['installedpackages']['vnstat2']['config'][0]['vnstati_interface'] = $iface;
$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");
+ exec("/usr/local/bin/vnstati -i ". $ifaces_final ." -vs -o /tmp/newpicture1.png");
+ exec("/usr/local/bin/vnstati -i ". $ifaces_final ." -m -o /tmp/newpicture2.png");
+ exec("/usr/local/bin/vnstati -i ". $ifaces_final ." -d -o /tmp/newpicture3.png");
+ exec("/usr/local/bin/vnstati -i ". $ifaces_final ." -t -o /tmp/newpicture4.png");
conf_mount_ro();
}
@@ -140,6 +143,8 @@ function vnstat_install_config() {
exec("[ ! -d /conf/vnstat ] && mkdir /conf/vnstat");
exec("[ ! -f /usr/local/www/diag_vnstat2.php ] && cp /usr/local/pkg/diag_vnstat2.abc /usr/local/www/diag_vnstat2.php");
exec("[ ! -f /usr/local/www/diag_vnstat.php ] && cp /usr/local/pkg/diag_vnstat.abc /usr/local/www/diag_vnstat.php");
+ exec("[ ! -f /usr/local/www/vnstati.php ] && cp /usr/local/pkg/vnstati.abc /usr/local/www/vnstati.php");
+ exec("[ ! -f /usr/local/www/vnstat2_img.php ] && cp /usr/local/pkg/vnstat2_img.abc /usr/local/www/vnstat2_img.php");
// Unpack and move Vnstat frontend
exec("cd ..");
exec("tar -zxovf /usr/local/pkg/vnstat_php_frontend-1.4.1.tar.gz");
@@ -334,6 +339,7 @@ EOF;
}
fwrite($hf, $config_file);
fclose($hf);
+ write_config();
conf_mount_ro();
}
?>
diff --git a/config/vnstat2/vnstat2.xml b/config/vnstat2/vnstat2.xml
index 564bdcfb..31e99890 100644
--- a/config/vnstat2/vnstat2.xml
+++ b/config/vnstat2/vnstat2.xml
@@ -43,37 +43,47 @@
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
<chmod>0644</chmod>
- <item>http://www.pfsense.com/packages/config/vnstat2/vnstat2.inc</item>
+ <item>http://www,pfsense.com/packages/config/vnstat2/vnstat2.inc</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
<chmod>0644</chmod>
- <item>http://www.pfsense.com/packages/config/vnstat2/bin/vnstat_php_frontend-1.4.1.tar.gz</item>
+ <item>http://www,pfsense.com/packages/config/vnstat2/bin/vnstat_php_frontend-1.4.1.tar.gz</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
<chmod>0644</chmod>
- <item>http://www.pfsense.com/packages/config/vnstat2/vnstati.xml</item>
+ <item>http://www,pfsense.com/packages/config/vnstat2/vnstati.xml</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
<chmod>0744</chmod>
- <item>http://www.pfsense.com/packages/config/vnstat2/vnstat2.sh</item>
+ <item>http://www,pfsense.com/packages/config/vnstat2/vnstat2.sh</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
<chmod>0644</chmod>
- <item>http://www.pfsense.com/packages/config/vnstat2/vnstatoutput.xml</item>
+ <item>http://www,pfsense.com/packages/config/vnstat2/vnstatoutput.xml</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
<chmod>0644</chmod>
- <item>http://www.pfsense.com/packages/config/vnstat2/bin/diag_vnstat.abc</item>
+ <item>http://www,pfsense.com/packages/config/vnstat2/bin/diag_vnstat.abc</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
<chmod>0644</chmod>
- <item>http://www.pfsense.com/packages/config/vnstat2/bin/diag_vnstat2.abc</item>
+ <item>http://www,pfsense.com/packages/config/vnstat2/bin/diag_vnstat2.abc</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www,pfsense.com/packages/config/vnstat2/bin/vnstat2_img.abc</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www,pfsense.com/packages/config/vnstat2/bin/vnstati.abc</item>
</additional_files_needed>
<fields>
<field>
diff --git a/config/vnstat2/vnstati.xml b/config/vnstat2/vnstati.xml
index 8c616cc2..e2246ca0 100644
--- a/config/vnstat2/vnstati.xml
+++ b/config/vnstat2/vnstati.xml
@@ -9,7 +9,7 @@
<name>vnstat2</name>
<version>1.0</version>
<title>Vnstat2</title>
- <aftersaveredirect>/vnstati/newpicture.png</aftersaveredirect>
+ <aftersaveredirect>/vnstati.php</aftersaveredirect>
<include_file>/usr/local/pkg/vnstat2.inc</include_file>
<menu>
<name>vnstat2</name>
@@ -47,22 +47,6 @@
<description>Select interface</description>
<type>interfaces_selection</type>
</field>
- <field>
- <description>Select output type</description>
- <fielddescr>Output Type</fielddescr>
- <fieldname>output_type</fieldname>
- <type>select</type>
- <size>7</size>
- <options>
- <option><name>Output traffic for the last 24 hours</name><value>h</value></option>
- <option><name>Output traffic for days</name><value>d</value></option>
- <option><name>Output traffic for months</name><value>m</value></option>
- <option><name>Output traffic summary</name><value>s</value></option>
- <option><name>Output traffic summary including hourly data using a vertical layout</name><value>vs</value></option>
- <option><name>Output traffic summary including hourly data using a horizontal layout</name><value>hs</value></option>
- <option><name>Output all time top10 traffic days</name><value>t</value></option>
- </options>
- </field>
</fields>
<custom_php_global_functions></custom_php_global_functions>
<custom_add_php_command>create_vnstati_image();</custom_add_php_command>