summaryrefslogtreecommitdiff
path: root/src/conf_mode/service_monitoring_telegraf.py
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2022-10-13 10:57:46 +0000
committerViacheslav Hletenko <v.gletenko@vyos.io>2022-10-13 10:57:46 +0000
commit33bf84e66677ea43cc26ae1ebd8b37e6c14ebbb7 (patch)
treef1db6073c10f8d6aa32c52b15f252cccc80e19f8 /src/conf_mode/service_monitoring_telegraf.py
parent74c39157c732605dea6fbe09fd5fc9d3b9229d7e (diff)
downloadvyos-1x-33bf84e66677ea43cc26ae1ebd8b37e6c14ebbb7.tar.gz
vyos-1x-33bf84e66677ea43cc26ae1ebd8b37e6c14ebbb7.zip
monitoring: T4746: Add exception if we do not have firewall rules
Telegraf checks the firewall table 'vyos_filter' but it we don't have any firewall in the system we don't have this table by default It cause commit error for "service monitoring" Add exception if the table "vyos_filter" is not found
Diffstat (limited to 'src/conf_mode/service_monitoring_telegraf.py')
-rwxr-xr-xsrc/conf_mode/service_monitoring_telegraf.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/conf_mode/service_monitoring_telegraf.py b/src/conf_mode/service_monitoring_telegraf.py
index 427cb6911..aafece47a 100755
--- a/src/conf_mode/service_monitoring_telegraf.py
+++ b/src/conf_mode/service_monitoring_telegraf.py
@@ -42,7 +42,11 @@ systemd_override = '/etc/systemd/system/telegraf.service.d/10-override.conf'
def get_nft_filter_chains():
""" Get nft chains for table filter """
- nft = cmd('nft --json list table ip vyos_filter')
+ try:
+ nft = cmd('nft --json list table ip vyos_filter')
+ except Exception:
+ print('nft table ip vyos_filter not found')
+ return []
nft = json.loads(nft)
chain_list = []