master
json 125 lines 4.24 KB
Raw
1 {
2 "jsonSchema": {
3 "$schema": "http://json-schema.org/draft-07/schema#",
4 "title": "Docker Service Discovery",
5 "description": "Discovers services running in Docker containers.",
6 "type": "object",
7 "properties": {
8 "discoverer": {
9 "title": "Discoverer",
10 "type": "object",
11 "properties": {
12 "docker": {
13 "title": "Docker",
14 "type": "object",
15 "properties": {
16 "address": {
17 "title": "Docker address",
18 "description": "Docker daemon address.",
19 "type": "string",
20 "default": "unix:///var/run/docker.sock"
21 },
22 "timeout": {
23 "title": "Timeout",
24 "description": "Timeout for Docker API calls, in seconds.",
25 "type": "number",
26 "minimum": 0.1,
27 "default": 2
28 }
29 }
30 }
31 },
32 "required": [
33 "docker"
34 ]
35 },
36 "services": {
37 "title": "Service rules",
38 "description": "- Match discovered Docker containers and generate collector configurations.\n- Each rule specifies match criteria and a config template.\n- When a container matches, a data collection job is created.",
39 "type": "array",
40 "minItems": 1,
41 "items": {
42 "type": "object",
43 "properties": {
44 "id": {
45 "title": "Rule ID",
46 "description": "Unique identifier for this rule. Used in logs to identify which rule matched a container.",
47 "type": "string"
48 },
49 "match": {
50 "title": "Match expression",
51 "description": "Go template expression that must evaluate to 'true' for the rule to match the discovered container.",
52 "type": "string"
53 },
54 "config_template": {
55 "title": "Config template",
56 "description": "**Uses the same fields as match expression**. Go template that generates the data collection job configuration in YAML format. **Must include 'module' and 'name' fields**, plus any module-specific settings.",
57 "type": "string"
58 }
59 },
60 "required": [
61 "id",
62 "match"
63 ]
64 }
65 }
66 },
67 "required": [
68 "discoverer",
69 "services"
70 ]
71 },
72 "uiSchema": {
73 "uiOptions": {
74 "fullPage": true
75 },
76 "ui:flavour": "tabs",
77 "ui:options": {
78 "tabs": [
79 {
80 "title": "Base",
81 "fields": [
82 "discoverer"
83 ]
84 },
85 {
86 "title": "Services",
87 "fields": [
88 "services"
89 ]
90 }
91 ]
92 },
93 "discoverer": {
94 "docker": {
95 "address": {
96 "ui:placeholder": "unix:///var/run/docker.sock",
97 "ui:help": "Examples: unix:///var/run/docker.sock, tcp://localhost:2375"
98 },
99 "timeout": {
100 "ui:placeholder": "2",
101 "ui:help": "Value in seconds. Examples: 2, 5, 0.5"
102 }
103 }
104 },
105 "services": {
106 "ui:descriptionPosition": "top",
107 "ui:listFlavour": "list",
108 "items": {
109 "id": {
110 "ui:placeholder": "nginx-container",
111 "ui:help": "Use descriptive names like 'nginx-container', 'mysql-db', 'redis-cache'"
112 },
113 "match": {
114 "ui:widget": "textarea",
115 "ui:placeholder": "{{ glob .Image \"*nginx*\" }}",
116 "ui:help": "| Field | Description |\n|-------|-------------|\n| `.ID` | Container ID |\n| `.Name` | Container name |\n| `.Image` | Image name |\n| `.Command` | Container command |\n| `.Labels` | Labels (map) |\n| `.PrivatePort` | Container port |\n| `.PublicPort` | Host port |\n| `.PublicPortIP` | Host IP |\n| `.PortProtocol` | Port protocol |\n| `.NetworkMode` | Network mode |\n| `.NetworkDriver` | Network driver |\n| `.IPAddress` | Container IP |\n| `.Address` | IP:Port combined |\n\n**Functions:** eq, ne, glob, regexp, and, or, not\n\n**Labels access:** {{ index .Labels \"key\" }}"
117 },
118 "config_template": {
119 "ui:widget": "textarea",
120 "ui:placeholder": "module: nginx\nname: {{.Name}}\nurl: http://{{.Address}}/stub_status"
121 }
122 }
123 }
124 }
125 }