summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/conf_mode/service_monitoring_telegraf.py20
-rwxr-xr-xsrc/etc/telegraf/custom_scripts/show_interfaces_input_filter.py16
2 files changed, 2 insertions, 34 deletions
diff --git a/src/conf_mode/service_monitoring_telegraf.py b/src/conf_mode/service_monitoring_telegraf.py
index 18b32edab..53df006a4 100755
--- a/src/conf_mode/service_monitoring_telegraf.py
+++ b/src/conf_mode/service_monitoring_telegraf.py
@@ -40,23 +40,6 @@ custom_scripts_dir = '/etc/telegraf/custom_scripts'
syslog_telegraf = '/etc/rsyslog.d/50-telegraf.conf'
systemd_override = '/etc/systemd/system/telegraf.service.d/10-override.conf'
-def get_interfaces(type='', vlan=True):
- """
- get_interfaces()
- ['dum0', 'eth0', 'eth1', 'eth1.5', 'lo', 'tun0']
-
- get_interfaces("dummy")
- ['dum0']
- """
- interfaces = []
- ifaces = Section.interfaces(type)
- for iface in ifaces:
- if vlan == False and '.' in iface:
- continue
- interfaces.append(iface)
-
- return interfaces
-
def get_nft_filter_chains():
""" Get nft chains for table filter """
nft = cmd('nft --json list table ip filter')
@@ -70,7 +53,6 @@ def get_nft_filter_chains():
return chain_list
-
def get_config(config=None):
if config:
conf = config
@@ -93,7 +75,7 @@ def get_config(config=None):
monitoring = dict_merge(default_values, monitoring)
monitoring['custom_scripts_dir'] = custom_scripts_dir
- monitoring['interfaces_ethernet'] = get_interfaces('ethernet', vlan=False)
+ monitoring['interfaces_ethernet'] = Section.interfaces('ethernet', vlan=False)
monitoring['nft_chains'] = get_nft_filter_chains()
# Redefine azure group-metrics 'single-table' and 'table-per-metric'
diff --git a/src/etc/telegraf/custom_scripts/show_interfaces_input_filter.py b/src/etc/telegraf/custom_scripts/show_interfaces_input_filter.py
index 0c7474156..6f14d6a8e 100755
--- a/src/etc/telegraf/custom_scripts/show_interfaces_input_filter.py
+++ b/src/etc/telegraf/custom_scripts/show_interfaces_input_filter.py
@@ -5,20 +5,6 @@ from vyos.ifconfig import Interface
import time
-def get_interfaces(type='', vlan=True):
- """
- Get interfaces:
- ['dum0', 'eth0', 'eth1', 'eth1.5', 'lo', 'tun0']
- """
- interfaces = []
- ifaces = Section.interfaces(type)
- for iface in ifaces:
- if vlan == False and '.' in iface:
- continue
- interfaces.append(iface)
-
- return interfaces
-
def get_interface_addresses(iface, link_local_v6=False):
"""
Get IP and IPv6 addresses from interface in one string
@@ -77,7 +63,7 @@ def get_interface_oper_state(iface):
return oper_state
-interfaces = get_interfaces()
+interfaces = Section.interfaces('')
for iface in interfaces:
print(f'show_interfaces,interface={iface} '