[Add] confd config files

This commit is contained in:
2024-08-26 15:58:30 +08:00
parent 1628d2b624
commit d6c1ce54d6
4 changed files with 44 additions and 2 deletions

9
confd/conf.d/opcua.toml Normal file
View File

@@ -0,0 +1,9 @@
[template]
src = "opcua.tmpl"
dest = "/data/opcua/opcua.yaml"
keys = [
"/datasource/",
"/metrics/"
]
#reload_cmd = "pkill -f opcua-exporter && cd /home/lamonki/opcua-expoter/build && ./manage_opcua_exporter.sh | tee /dev/tty"

6
confd/confd.toml Normal file
View File

@@ -0,0 +1,6 @@
backend = "etcd"
nodes = [
"http://etcd:2379",
]
watch = true

View File

@@ -0,0 +1,26 @@
datasource:
data_source_type: {{ getv "/datasource/data_source_type" }}
name: {{ getv "/datasource/name" }}
description: {{ getv "/datasource/description" }}
opcua_service_address: {{ getv "/datasource/opcua_service_address" }}
security_policy_address: {{ getv "/datasource/security_policy_address" }}
security_mode: {{ getv "/datasource/security_mode" }}
key_authentication_file: {{ getv "/datasource/key_authentication_file" }}
certificate_authentication_file: {{ getv "/datasource/certificate_authentication_file" }}
trusted_list: {{ getv "/datasource/trusted_list" }}
measurement_point_address: {{ getv "/datasource/measurement_point_address" }}
interface_address: {{ getv "/datasource/interface_address" }}
username: {{ getv "/datasource/username" }}
password: {{ getv "/datasource/password" }}
certificate_identity_file: {{ getv "/datasource/certificate_identity_file" }}
key_identity_file: {{ getv "/datasource/key_identity_file" }}
state: {{ getv "/datasource/state" }}
metrics:
{{ range $index, $element := ls "/metrics" }}
- name: "{{ getv (printf "/metrics/%d/name" $index) }}"
identifier_type: {{ getv (printf "/metrics/%d/identifier_type" $index) }}"
nodeid: {{ getv (printf "/metrics/%d/nodeid" $index) }}
help: "{{ getv (printf "/metrics/%d/help" $index) }}"
{{ end }}

View File

@@ -7,6 +7,7 @@ RUN dnf update -y && \
RUN curl -fsSL https://github.com/abtreece/confd/releases/download/v0.20.0/confd-v0.20.0-linux-amd64.tar.gz | tar -xz -C /usr/local/bin && \ RUN curl -fsSL https://github.com/abtreece/confd/releases/download/v0.20.0/confd-v0.20.0-linux-amd64.tar.gz | tar -xz -C /usr/local/bin && \
chmod +x /usr/local/bin/confd chmod +x /usr/local/bin/confd
RUN mkdir /etc/confd RUN mkdir /etc/confd && \
mkdir /data
CMD [ "confd","-watch", "-backend", "etcd", "-node", "http://etcd:2379"] CMD [ "confd"]