mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
net/vnstat: add multiple interfaces, ready for stable (#874)
This commit is contained in:
+1
-2
@@ -1,8 +1,7 @@
|
||||
PLUGIN_NAME= vnstat
|
||||
PLUGIN_VERSION= 0.1
|
||||
PLUGIN_VERSION= 1.0
|
||||
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"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<field>
|
||||
<id>general.interface</id>
|
||||
<label>Interface</label>
|
||||
<type>dropdown</type>
|
||||
<type>select_multiple</type>
|
||||
<help>Set the interface to listen on.</help>
|
||||
</field>
|
||||
</form>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
</enabled>
|
||||
<interface type="InterfaceField">
|
||||
<Required>N</Required>
|
||||
<multiple>Y</multiple>
|
||||
</interface>
|
||||
</items>
|
||||
</model>
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
{% if helpers.exists('OPNsense.vnstat.general.enabled') and OPNsense.vnstat.general.enabled == '1' %}
|
||||
{% from 'OPNsense/Macros/interface.macro' import physical_interface %}
|
||||
vnstat_var_script="/usr/local/opnsense/scripts/OPNsense/Vnstat/setup.sh"
|
||||
vnstat_enable="YES"
|
||||
{% if helpers.exists('OPNsense.vnstat.general.interface') and OPNsense.vnstat.general.interface != '' %}
|
||||
{% set interfaces = [] %}
|
||||
{% for interface in OPNsense.vnstat.general.interface.split(',') %}
|
||||
{% do interfaces.append(physical_interface(interface)) %}
|
||||
{% endfor %}
|
||||
vnstat_additional_ifaces="{{ interfaces|join(' ') }}"
|
||||
{% endif %}
|
||||
{% else %}
|
||||
vnstat_enable="NO"
|
||||
{% endif %}
|
||||
|
||||
@@ -2,10 +2,14 @@
|
||||
{% from 'OPNsense/Macros/interface.macro' import physical_interface %}
|
||||
|
||||
{% if helpers.exists('OPNsense.vnstat.general.interface') and OPNsense.vnstat.general.interface != '' %}
|
||||
# default interface
|
||||
Interface "{{ physical_interface(OPNsense.vnstat.general.interface) }}"
|
||||
{% set interfaces = [] %}
|
||||
{% for interface in OPNsense.vnstat.general.interface.split(',') %}
|
||||
{% do interfaces.append(physical_interface(interface)) %}
|
||||
{% endfor %}
|
||||
Interface {{ interfaces|join('+') }}
|
||||
{% endif %}
|
||||
|
||||
|
||||
# location of the database directory
|
||||
DatabaseDir "/var/lib/vnstat"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user