diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-08-25 19:01:21 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2022-08-27 08:03:45 +0200 |
commit | 8a3bc80ca7a3209b045f3e3defc47efe4dc8d1e0 (patch) | |
tree | 532de60c71a6e5f1aa07bf805dbc58ee0bac899d /src/conf_mode/service_monitoring_telegraf.py | |
parent | 4eb4a823ffca7c9ccc5aa437209447efa626b168 (diff) | |
download | vyos-1x-8a3bc80ca7a3209b045f3e3defc47efe4dc8d1e0.tar.gz vyos-1x-8a3bc80ca7a3209b045f3e3defc47efe4dc8d1e0.zip |
telegraf: T3872: replace local get_interfaces() function with Section.interface()
Commit cfde4b49 ("ifconfig: T2223: add vlan switch for Section.interfaces()")
added the functionality of the local get_interfaces() function to the base
class so all other parts in the system can query for interface names of a given
type including or excluding their vlan sub-interfaces.
Diffstat (limited to 'src/conf_mode/service_monitoring_telegraf.py')
-rwxr-xr-x | src/conf_mode/service_monitoring_telegraf.py | 20 |
1 files changed, 1 insertions, 19 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' |