diff --git a/README.md b/README.md index e8d349d06..4f588d96e 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ net/relayd -- Relayd Load Balancer net/shadowsocks -- Secure socks5 proxy net/siproxd -- Siproxd is a proxy daemon for the SIP protocol net/upnp -- Universal Plug and Play Service +net/vnstat -- vnStat is a console-based network traffic monitor net/wireguard -- WireGuard VPN service net/wol -- Wake on LAN Service net/zerotier -- Virtual Networks That Just Work diff --git a/net/vnstat/Makefile b/net/vnstat/Makefile new file mode 100644 index 000000000..0993d08e6 --- /dev/null +++ b/net/vnstat/Makefile @@ -0,0 +1,8 @@ +PLUGIN_NAME= vnstat +PLUGIN_VERSION= 0.1 +PLUGIN_COMMENT= vnStat is a console-based network traffic monitor +PLUGIN_DEPENDS= vnstat +PLUGIN_MAINTAINER= m.muenz@gmail.com +PLUGIN_DEVEL= yes + +.include "../../Mk/plugins.mk" diff --git a/net/vnstat/pkg-descr b/net/vnstat/pkg-descr new file mode 100644 index 000000000..7e2b955c5 --- /dev/null +++ b/net/vnstat/pkg-descr @@ -0,0 +1,8 @@ +vnStat is a console-based network traffic monitor for Linux +and BSD that keeps a log of network traffic for the selected +interface(s). It uses the network interface statistics +provided by the kernel as information source. This means +that vnStat won't actually be sniffing any traffic and also +ensures light use of system resources. + +WWW: https://humdi.net/vnstat/ diff --git a/net/vnstat/src/etc/inc/plugins.inc.d/vnstat.inc b/net/vnstat/src/etc/inc/plugins.inc.d/vnstat.inc new file mode 100644 index 000000000..9c0521acc --- /dev/null +++ b/net/vnstat/src/etc/inc/plugins.inc.d/vnstat.inc @@ -0,0 +1,55 @@ +enabled == '1'; +} + +function vnstat_services() +{ + $services = array(); + + if (!vnstat_enabled()) { + return $services; + } + + $services[] = array( + 'description' => gettext('vnStat Daemon'), + 'configd' => array( + 'restart' => array('vnstat restart'), + 'start' => array('vnstat start'), + 'stop' => array('vnstat stop'), + ), + 'name' => 'vnstatd', + 'pidfile' => '/var/run/vnstat/vnstat.pid' + ); + + return $services; +} diff --git a/net/vnstat/src/opnsense/mvc/app/controllers/OPNsense/Vnstat/Api/GeneralController.php b/net/vnstat/src/opnsense/mvc/app/controllers/OPNsense/Vnstat/Api/GeneralController.php new file mode 100644 index 000000000..d2858311e --- /dev/null +++ b/net/vnstat/src/opnsense/mvc/app/controllers/OPNsense/Vnstat/Api/GeneralController.php @@ -0,0 +1,39 @@ +configdRun("vnstat hourly"); + return array("response" => $response); + } + + /** + * list daily statistics + * @return array + */ + public function dailyAction() + { + $backend = new Backend(); + $response = $backend->configdRun("vnstat daily"); + return array("response" => $response); + } + + /** + * list weekly statistics + * @return array + */ + public function weeklyAction() + { + $backend = new Backend(); + $response = $backend->configdRun("vnstat weekly"); + return array("response" => $response); + } + + /** + * list monthly statistics + * @return array + */ + public function monthlyAction() + { + $backend = new Backend(); + $response = $backend->configdRun("vnstat monthly"); + return array("response" => $response); + } +} diff --git a/net/vnstat/src/opnsense/mvc/app/controllers/OPNsense/Vnstat/GeneralController.php b/net/vnstat/src/opnsense/mvc/app/controllers/OPNsense/Vnstat/GeneralController.php new file mode 100644 index 000000000..1e71fd2a5 --- /dev/null +++ b/net/vnstat/src/opnsense/mvc/app/controllers/OPNsense/Vnstat/GeneralController.php @@ -0,0 +1,38 @@ +view->generalForm = $this->getForm("general"); + $this->view->pick('OPNsense/Vnstat/general'); + } +} diff --git a/net/vnstat/src/opnsense/mvc/app/controllers/OPNsense/Vnstat/forms/general.xml b/net/vnstat/src/opnsense/mvc/app/controllers/OPNsense/Vnstat/forms/general.xml new file mode 100644 index 000000000..dd8a6c910 --- /dev/null +++ b/net/vnstat/src/opnsense/mvc/app/controllers/OPNsense/Vnstat/forms/general.xml @@ -0,0 +1,14 @@ +
diff --git a/net/vnstat/src/opnsense/mvc/app/models/OPNsense/Vnstat/ACL/ACL.xml b/net/vnstat/src/opnsense/mvc/app/models/OPNsense/Vnstat/ACL/ACL.xml new file mode 100644 index 000000000..ee1163bf1 --- /dev/null +++ b/net/vnstat/src/opnsense/mvc/app/models/OPNsense/Vnstat/ACL/ACL.xml @@ -0,0 +1,9 @@ +