diff --git a/deb/opt/vyatta-node_exporter/config.py b/deb/opt/vyatta-node_exporter/config.py index 618304e..38d52c6 100644 --- a/deb/opt/vyatta-node_exporter/config.py +++ b/deb/opt/vyatta-node_exporter/config.py @@ -44,13 +44,11 @@ def generate(node_exporter): return None # merge web/listen-address with subelement web/listen-address/port - if 'web' in node_exporter: - # {'listen-address': {'0.0.0.0': {'port': '8080'}} - if 'listen-address' in node_exporter['web']: - address = list(node_exporter['web']['listen-address'].keys())[0] - port = node_exporter['web']['listen-address'][address].get("port", 9100) - node_exporter['web']['listen-address'] = f"{address}:{port}" - del node_exporter['web']['listen-address']['port'] + # {'web': {'listen-address': {'0.0.0.0': {'port': '8080'}}} + if 'web' in node_exporter and 'listen-address' in node_exporter['web']: + address = list(node_exporter['web']['listen-address'].keys())[0] + port = node_exporter['web']['listen-address'][address].get("port", 9100) + node_exporter['web']['listen-address'] = f"{address}:{port}" with open('/opt/vyatta-node_exporter/config.j2', 'r') as tmpl, open(config_file, 'w') as out: template = Template(tmpl.read()).render(data=node_exporter) diff --git a/deb/opt/vyatta/share/vyatta-cfg/templates/service/monitoring/node-exporter/log/format/node.def b/deb/opt/vyatta/share/vyatta-cfg/templates/service/monitoring/node-exporter/log/format/node.def index 85e58a3..a52bf7b 100644 --- a/deb/opt/vyatta/share/vyatta-cfg/templates/service/monitoring/node-exporter/log/format/node.def +++ b/deb/opt/vyatta/share/vyatta-cfg/templates/service/monitoring/node-exporter/log/format/node.def @@ -1,2 +1,6 @@ type: txt help: Output format of log messages. One of: [logfmt, json] (default: logfmt) +val_help: logfmt; Prometheus logging format (default) +val_help: json; JSON +allowed: echo "logfmt json" +syntax:expression: exec "${vyos_libexec_dir}/validate-value --regex \'^(logfmt|json)$\' --value \'$VAR(@)\'"; "Invalid value" \ No newline at end of file diff --git a/deb/opt/vyatta/share/vyatta-cfg/templates/service/monitoring/node-exporter/log/level/node.def b/deb/opt/vyatta/share/vyatta-cfg/templates/service/monitoring/node-exporter/log/level/node.def index 149b112..67964b3 100644 --- a/deb/opt/vyatta/share/vyatta-cfg/templates/service/monitoring/node-exporter/log/level/node.def +++ b/deb/opt/vyatta/share/vyatta-cfg/templates/service/monitoring/node-exporter/log/level/node.def @@ -1,2 +1,8 @@ type: txt help: Only log messages with the given severity or above. One of: [debug, info, warn, error] (default: info) +val_help: debug; Debug +val_help: info; Info (default) +val_help: warn; Warning +val_help: error; Error +allowed: echo "debug info warn error" +syntax:expression: exec "${vyos_libexec_dir}/validate-value --regex \'^(debug|info|warn|error)$\' --value \'$VAR(@)\'"; "Invalid value" diff --git a/deb/opt/vyatta/share/vyatta-cfg/templates/service/monitoring/node-exporter/web/telemetry-path/node.def b/deb/opt/vyatta/share/vyatta-cfg/templates/service/monitoring/node-exporter/web/telemetry-path/node.def index 187bcf0..257d9ea 100644 --- a/deb/opt/vyatta/share/vyatta-cfg/templates/service/monitoring/node-exporter/web/telemetry-path/node.def +++ b/deb/opt/vyatta/share/vyatta-cfg/templates/service/monitoring/node-exporter/web/telemetry-path/node.def @@ -1,3 +1,3 @@ type: txt -help: Path under which to expose metrics. -default: "/metrics" +help: Path under which to expose metrics. (default: "/metrics") +syntax:expression: exec "${vyos_libexec_dir}/validate-value --regex \'^/.*$\' --value \'$VAR(@)\'"; "Invalid value" \ No newline at end of file