summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interface-definitions/service-monitoring-zabbix-agent.xml.in184
-rw-r--r--interface-definitions/service-zabbix-agent.xml.in181
-rwxr-xr-xsmoketest/scripts/cli/test_service_monitoring_zabbix-agent.py (renamed from smoketest/scripts/cli/test_service_zabbix-agent.py)2
-rwxr-xr-xsrc/conf_mode/service_monitoring_zabbix-agent.py (renamed from src/conf_mode/service_zabbix_agent.py)2
-rwxr-xr-xsrc/init/vyos-router24
-rwxr-xr-xsrc/migration-scripts/firewall/5-to-646
6 files changed, 254 insertions, 185 deletions
diff --git a/interface-definitions/service-monitoring-zabbix-agent.xml.in b/interface-definitions/service-monitoring-zabbix-agent.xml.in
new file mode 100644
index 000000000..cfeb02ce0
--- /dev/null
+++ b/interface-definitions/service-monitoring-zabbix-agent.xml.in
@@ -0,0 +1,184 @@
+<?xml version="1.0"?>
+<interfaceDefinition>
+ <node name="service">
+ <children>
+ <node name="monitoring">
+ <children>
+ <node name="zabbix-agent" owner="${vyos_conf_scripts_dir}/service_monitoring_zabbix-agent.py">
+ <properties>
+ <help>Zabbix-agent settings</help>
+ </properties>
+ <children>
+ <leafNode name="directory">
+ <properties>
+ <help>Folder containing individual Zabbix-agent configuration files</help>
+ <constraint>
+ <validator name="file-path" argument="--directory"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <node name="limits">
+ <properties>
+ <help>Limit settings</help>
+ </properties>
+ <children>
+ <leafNode name="buffer-flush-interval">
+ <properties>
+ <help>Do not keep data longer than N seconds in buffer</help>
+ <valueHelp>
+ <format>u32:1-3600</format>
+ <description>Seconds</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-3600"/>
+ </constraint>
+ <constraintErrorMessage>buffer-flush-interval must be between 1 and 3600 seconds</constraintErrorMessage>
+ </properties>
+ <defaultValue>5</defaultValue>
+ </leafNode>
+ <leafNode name="buffer-size">
+ <properties>
+ <help>Maximum number of values in a memory buffer</help>
+ <valueHelp>
+ <format>u32:2-65535</format>
+ <description>Maximum number of values in a memory buffer</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 2-65535"/>
+ </constraint>
+ <constraintErrorMessage>Buffer-size must be between 2 and 65535</constraintErrorMessage>
+ </properties>
+ <defaultValue>100</defaultValue>
+ </leafNode>
+ </children>
+ </node>
+ <node name="log">
+ <properties>
+ <help>Log settings</help>
+ </properties>
+ <children>
+ <leafNode name="debug-level">
+ <properties>
+ <help>Debug level</help>
+ <completionHelp>
+ <list>basic critical error warning debug extended-debug</list>
+ </completionHelp>
+ <valueHelp>
+ <format>basic</format>
+ <description>Basic information</description>
+ </valueHelp>
+ <valueHelp>
+ <format>critical</format>
+ <description>Critical information</description>
+ </valueHelp>
+ <valueHelp>
+ <format>error</format>
+ <description>Error information</description>
+ </valueHelp>
+ <valueHelp>
+ <format>warning</format>
+ <description>Warnings</description>
+ </valueHelp>
+ <valueHelp>
+ <format>debug</format>
+ <description>Debug information</description>
+ </valueHelp>
+ <valueHelp>
+ <format>extended-debug</format>
+ <description>Extended debug information</description>
+ </valueHelp>
+ <constraint>
+ <regex>(basic|critical|error|warning|debug|extended-debug)</regex>
+ </constraint>
+ </properties>
+ <defaultValue>warning</defaultValue>
+ </leafNode>
+ <leafNode name="remote-commands">
+ <properties>
+ <help>Enable logging of executed shell commands as warnings</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="size">
+ <properties>
+ <help>Log file size in megabytes</help>
+ <valueHelp>
+ <format>u32:0-1024</format>
+ <description>Megabytes</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-1024"/>
+ </constraint>
+ <constraintErrorMessage>Size must be between 0 and 1024 Megabytes</constraintErrorMessage>
+ </properties>
+ <defaultValue>0</defaultValue>
+ </leafNode>
+ </children>
+ </node>
+ #include <include/listen-address.xml.i>
+ <leafNode name="listen-address">
+ <defaultValue>0.0.0.0</defaultValue>
+ </leafNode>
+ #include <include/port-number.xml.i>
+ <leafNode name="port">
+ <defaultValue>10050</defaultValue>
+ </leafNode>
+ <leafNode name="server">
+ <properties>
+ <help>Remote server to connect to</help>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>Server IPv4 address</description>
+ </valueHelp>
+ <valueHelp>
+ <format>ipv6</format>
+ <description>Server IPv6 address</description>
+ </valueHelp>
+ <valueHelp>
+ <format>hostname</format>
+ <description>Server hostname/FQDN</description>
+ </valueHelp>
+ <multi/>
+ </properties>
+ </leafNode>
+ <tagNode name="server-active">
+ <properties>
+ <help>Remote server address to get active checks from</help>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>Server IPv4 address</description>
+ </valueHelp>
+ <valueHelp>
+ <format>ipv6</format>
+ <description>Server IPv6 address</description>
+ </valueHelp>
+ <valueHelp>
+ <format>hostname</format>
+ <description>Server hostname/FQDN</description>
+ </valueHelp>
+ </properties>
+ <children>
+ #include <include/port-number.xml.i>
+ </children>
+ </tagNode>
+ <leafNode name="timeout">
+ <properties>
+ <help>Item processing timeout in seconds</help>
+ <valueHelp>
+ <format>u32:1-30</format>
+ <description>Item processing timeout</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-30"/>
+ </constraint>
+ <constraintErrorMessage>Timeout must be between 1 and 30 seconds</constraintErrorMessage>
+ </properties>
+ <defaultValue>3</defaultValue>
+ </leafNode>
+ </children>
+ </node>
+ </children>
+ </node>
+ </children>
+ </node>
+</interfaceDefinition>
diff --git a/interface-definitions/service-zabbix-agent.xml.in b/interface-definitions/service-zabbix-agent.xml.in
deleted file mode 100644
index 1f93790f5..000000000
--- a/interface-definitions/service-zabbix-agent.xml.in
+++ /dev/null
@@ -1,181 +0,0 @@
-<?xml version="1.0"?>
-<interfaceDefinition>
- <node name="service">
- <children>
- <node name="zabbix-agent" owner="${vyos_conf_scripts_dir}/service_zabbix_agent.py">
- <properties>
- <help>Zabbix-agent settings</help>
- <priority>380</priority>
- </properties>
- <children>
- <leafNode name="directory">
- <properties>
- <help>Folder containing individual Zabbix-agent configuration files</help>
- <constraint>
- <validator name="file-path" argument="--directory"/>
- </constraint>
- </properties>
- </leafNode>
- <node name="limits">
- <properties>
- <help>Limit settings</help>
- </properties>
- <children>
- <leafNode name="buffer-flush-interval">
- <properties>
- <help>Do not keep data longer than N seconds in buffer</help>
- <valueHelp>
- <format>u32:1-3600</format>
- <description>Seconds</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-3600"/>
- </constraint>
- <constraintErrorMessage>buffer-flush-interval must be between 1 and 3600 seconds</constraintErrorMessage>
- </properties>
- <defaultValue>5</defaultValue>
- </leafNode>
- <leafNode name="buffer-size">
- <properties>
- <help>Maximum number of values in a memory buffer</help>
- <valueHelp>
- <format>u32:2-65535</format>
- <description>Maximum number of values in a memory buffer</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 2-65535"/>
- </constraint>
- <constraintErrorMessage>Buffer-size must be between 2 and 65535</constraintErrorMessage>
- </properties>
- <defaultValue>100</defaultValue>
- </leafNode>
- </children>
- </node>
- <node name="log">
- <properties>
- <help>Log settings</help>
- </properties>
- <children>
- <leafNode name="debug-level">
- <properties>
- <help>Debug level</help>
- <completionHelp>
- <list>basic critical error warning debug extended-debug</list>
- </completionHelp>
- <valueHelp>
- <format>basic</format>
- <description>Basic information</description>
- </valueHelp>
- <valueHelp>
- <format>critical</format>
- <description>Critical information</description>
- </valueHelp>
- <valueHelp>
- <format>error</format>
- <description>Error information</description>
- </valueHelp>
- <valueHelp>
- <format>warning</format>
- <description>Warnings</description>
- </valueHelp>
- <valueHelp>
- <format>debug</format>
- <description>Debug information</description>
- </valueHelp>
- <valueHelp>
- <format>extended-debug</format>
- <description>Extended debug information</description>
- </valueHelp>
- <constraint>
- <regex>(basic|critical|error|warning|debug|extended-debug)</regex>
- </constraint>
- </properties>
- <defaultValue>warning</defaultValue>
- </leafNode>
- <leafNode name="remote-commands">
- <properties>
- <help>Enable logging of executed shell commands as warnings</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="size">
- <properties>
- <help>Log file size in megabytes</help>
- <valueHelp>
- <format>u32:0-1024</format>
- <description>Megabytes</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-1024"/>
- </constraint>
- <constraintErrorMessage>Size must be between 0 and 1024 Megabytes</constraintErrorMessage>
- </properties>
- <defaultValue>0</defaultValue>
- </leafNode>
- </children>
- </node>
- #include <include/listen-address.xml.i>
- <leafNode name="listen-address">
- <defaultValue>0.0.0.0</defaultValue>
- </leafNode>
- #include <include/port-number.xml.i>
- <leafNode name="port">
- <defaultValue>10050</defaultValue>
- </leafNode>
- <leafNode name="server">
- <properties>
- <help>Remote server to connect to</help>
- <valueHelp>
- <format>ipv4</format>
- <description>Server IPv4 address</description>
- </valueHelp>
- <valueHelp>
- <format>ipv6</format>
- <description>Server IPv6 address</description>
- </valueHelp>
- <valueHelp>
- <format>hostname</format>
- <description>Server hostname/FQDN</description>
- </valueHelp>
- <multi/>
- </properties>
- </leafNode>
- <tagNode name="server-active">
- <properties>
- <help>Remote server address to get active checks from</help>
- <valueHelp>
- <format>ipv4</format>
- <description>Server IPv4 address</description>
- </valueHelp>
- <valueHelp>
- <format>ipv6</format>
- <description>Server IPv6 address</description>
- </valueHelp>
- <valueHelp>
- <format>hostname</format>
- <description>Server hostname/FQDN</description>
- </valueHelp>
- </properties>
- <children>
- #include <include/port-number.xml.i>
- </children>
- </tagNode>
- <leafNode name="timeout">
- <properties>
- <help>Item processing timeout in seconds</help>
- <valueHelp>
- <format>u32:1-30</format>
- <description>Item processing timeout</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-30"/>
- </constraint>
- <constraintErrorMessage>Timeout must be between 1 and 30 seconds</constraintErrorMessage>
- </properties>
- <defaultValue>3</defaultValue>
- </leafNode>
- </children>
- </node>
- </children>
- </node>
-</interfaceDefinition>
diff --git a/smoketest/scripts/cli/test_service_zabbix-agent.py b/smoketest/scripts/cli/test_service_monitoring_zabbix-agent.py
index 2a125bec6..7cc661688 100755
--- a/smoketest/scripts/cli/test_service_zabbix-agent.py
+++ b/smoketest/scripts/cli/test_service_monitoring_zabbix-agent.py
@@ -25,7 +25,7 @@ from vyos.utils.file import read_file
PROCESS_NAME = 'zabbix_agent2'
ZABBIX_AGENT_CONF = '/run/zabbix/zabbix-agent2.conf'
-base_path = ['service', 'zabbix-agent']
+base_path = ['service', 'monitoring', 'zabbix-agent']
class TestZabbixAgent(VyOSUnitTestSHIM.TestCase):
diff --git a/src/conf_mode/service_zabbix_agent.py b/src/conf_mode/service_monitoring_zabbix-agent.py
index 47de8f2ec..98d8a32ca 100755
--- a/src/conf_mode/service_zabbix_agent.py
+++ b/src/conf_mode/service_monitoring_zabbix-agent.py
@@ -35,7 +35,7 @@ def get_config(config=None):
else:
conf = Config()
- base = ['service', 'zabbix-agent']
+ base = ['service', 'monitoring', 'zabbix-agent']
if not conf.exists(base):
return None
diff --git a/src/init/vyos-router b/src/init/vyos-router
index 7b752b84b..96f163213 100755
--- a/src/init/vyos-router
+++ b/src/init/vyos-router
@@ -101,6 +101,16 @@ load_bootfile ()
)
}
+# restore if missing pre-config script
+restore_if_missing_preconfig_script ()
+{
+ if [ ! -x ${vyatta_sysconfdir}/config/scripts/vyos-preconfig-bootup.script ]; then
+ cp ${vyos_rootfs_dir}/opt/vyatta/etc/config/scripts/vyos-preconfig-bootup.script ${vyatta_sysconfdir}/config/scripts/
+ chgrp ${GROUP} ${vyatta_sysconfdir}/config/scripts/vyos-preconfig-bootup.script
+ chmod 750 ${vyatta_sysconfdir}/config/scripts/vyos-preconfig-bootup.script
+ fi
+}
+
# execute the pre-config script
run_preconfig_script ()
{
@@ -109,6 +119,16 @@ run_preconfig_script ()
fi
}
+# restore if missing post-config script
+restore_if_missing_postconfig_script ()
+{
+ if [ ! -x ${vyatta_sysconfdir}/config/scripts/vyos-postconfig-bootup.script ]; then
+ cp ${vyos_rootfs_dir}/opt/vyatta/etc/config/scripts/vyos-postconfig-bootup.script ${vyatta_sysconfdir}/config/scripts/
+ chgrp ${GROUP} ${vyatta_sysconfdir}/config/scripts/vyos-postconfig-bootup.script
+ chmod 750 ${vyatta_sysconfdir}/config/scripts/vyos-postconfig-bootup.script
+ fi
+}
+
# execute the post-config scripts
run_postconfig_scripts ()
{
@@ -360,6 +380,8 @@ start ()
log_daemon_msg "Starting VyOS router"
disabled migrate || migrate_bootfile
+ restore_if_missing_preconfig_script
+
run_preconfig_script
run_postupgrade_script
@@ -384,6 +406,8 @@ start ()
telinit q
chmod g-w,o-w /
+ restore_if_missing_postconfig_script
+
run_postconfig_scripts
}
diff --git a/src/migration-scripts/firewall/5-to-6 b/src/migration-scripts/firewall/5-to-6
index 3fa07a0a1..e1eaea7a1 100755
--- a/src/migration-scripts/firewall/5-to-6
+++ b/src/migration-scripts/firewall/5-to-6
@@ -46,12 +46,54 @@ for interface in config.list_nodes(base):
if config.exists(base + [interface, 'adjust-mss']):
section = Section.section(interface)
tmp = config.return_value(base + [interface, 'adjust-mss'])
- config.set(['interfaces', section, interface, 'ip', 'adjust-mss'], value=tmp)
+
+ vlan = interface.split('.')
+ base_interface_path = ['interfaces', section, vlan[0]]
+
+ if len(vlan) == 1:
+ # Normal interface, no VLAN
+ config.set(base_interface_path + ['ip', 'adjust-mss'], value=tmp)
+ elif len(vlan) == 2:
+ # Regular VIF or VIF-S interface - we need to check the config
+ vif = vlan[1]
+ if config.exists(base_interface_path + ['vif', vif]):
+ config.set(base_interface_path + ['vif', vif, 'ip', 'adjust-mss'], value=tmp)
+ elif config.exists(base_interface_path + ['vif-s', vif]):
+ config.set(base_interface_path + ['vif-s', vif, 'ip', 'adjust-mss'], value=tmp)
+ elif len(vlan) == 3:
+ # VIF-S interface with VIF-C subinterface
+ vif_s = vlan[1]
+ vif_c = vlan[2]
+ config.set(base_interface_path + ['vif-s', vif_s, 'vif-c', vif_c, 'ip', 'adjust-mss'], value=tmp)
+ config.set_tag(base_interface_path + ['vif-s'])
+ config.set_tag(base_interface_path + ['vif-s', vif_s, 'vif-c'])
if config.exists(base + [interface, 'adjust-mss6']):
section = Section.section(interface)
tmp = config.return_value(base + [interface, 'adjust-mss6'])
- config.set(['interfaces', section, interface, 'ipv6', 'adjust-mss'], value=tmp)
+
+ vlan = interface.split('.')
+ base_interface_path = ['interfaces', section, vlan[0]]
+
+ if len(vlan) == 1:
+ # Normal interface, no VLAN
+ config.set(['interfaces', section, interface, 'ipv6', 'adjust-mss'], value=tmp)
+ elif len(vlan) == 2:
+ # Regular VIF or VIF-S interface - we need to check the config
+ vif = vlan[1]
+ if config.exists(base_interface_path + ['vif', vif]):
+ config.set(base_interface_path + ['vif', vif, 'ipv6', 'adjust-mss'], value=tmp)
+ config.set_tag(base_interface_path + ['vif'])
+ elif config.exists(base_interface_path + ['vif-s', vif]):
+ config.set(base_interface_path + ['vif-s', vif, 'ipv6', 'adjust-mss'], value=tmp)
+ config.set_tag(base_interface_path + ['vif-s'])
+ elif len(vlan) == 3:
+ # VIF-S interface with VIF-C subinterface
+ vif_s = vlan[1]
+ vif_c = vlan[2]
+ config.set(base_interface_path + ['vif-s', vif_s, 'vif-c', vif_c, 'ipv6', 'adjust-mss'], value=tmp)
+ config.set_tag(base_interface_path + ['vif-s'])
+ config.set_tag(base_interface_path + ['vif-s', vif_s, 'vif-c'])
config.delete(['firewall', 'options'])