| 1 | { |
| 2 | "jsonSchema": { |
| 3 | "$schema": "http://json-schema.org/draft-07/schema#", |
| 4 | "title": "HTTP Service Discovery", |
| 5 | "description": "Fetches JSON or YAML service discovery items from an HTTP endpoint.", |
| 6 | "type": "object", |
| 7 | "properties": { |
| 8 | "discoverer": { |
| 9 | "title": "Discoverer", |
| 10 | "type": "object", |
| 11 | "properties": { |
| 12 | "http": { |
| 13 | "title": "HTTP", |
| 14 | "type": "object", |
| 15 | "properties": { |
| 16 | "url": { |
| 17 | "title": "URL", |
| 18 | "description": "HTTP endpoint that returns a bare array or an object with an items array.", |
| 19 | "type": "string", |
| 20 | "format": "uri" |
| 21 | }, |
| 22 | "method": { |
| 23 | "title": "Method", |
| 24 | "description": "HTTP method used to fetch discovery items.", |
| 25 | "type": "string" |
| 26 | }, |
| 27 | "headers": { |
| 28 | "title": "Headers", |
| 29 | "description": "HTTP request headers.", |
| 30 | "type": "object", |
| 31 | "additionalProperties": { |
| 32 | "type": "string" |
| 33 | } |
| 34 | }, |
| 35 | "body": { |
| 36 | "title": "Body", |
| 37 | "description": "Optional HTTP request body.", |
| 38 | "type": "string" |
| 39 | }, |
| 40 | "username": { |
| 41 | "title": "Username", |
| 42 | "description": "Basic authentication username.", |
| 43 | "type": "string" |
| 44 | }, |
| 45 | "password": { |
| 46 | "title": "Password", |
| 47 | "description": "Basic authentication password.", |
| 48 | "type": "string" |
| 49 | }, |
| 50 | "bearer_token_file": { |
| 51 | "title": "Bearer token file", |
| 52 | "description": "Path to a file containing a bearer token. The file is read for each request.", |
| 53 | "type": "string" |
| 54 | }, |
| 55 | "interval": { |
| 56 | "title": "Poll interval", |
| 57 | "description": "How often to fetch the endpoint. Set to 0 for a one-shot fetch.", |
| 58 | "type": "string", |
| 59 | "pattern": "^[0-9]+(\\.[0-9]+)?(ms|s|m|h|d|w|mo|y)?$", |
| 60 | "default": "1m" |
| 61 | }, |
| 62 | "timeout": { |
| 63 | "title": "Timeout", |
| 64 | "description": "HTTP request timeout, in seconds.", |
| 65 | "type": "number", |
| 66 | "minimum": 0.1, |
| 67 | "default": 2 |
| 68 | }, |
| 69 | "format": { |
| 70 | "title": "Response format", |
| 71 | "description": "Response format. Auto uses Content-Type when clear, then tries JSON before YAML.", |
| 72 | "type": "string", |
| 73 | "enum": [ |
| 74 | "auto", |
| 75 | "json", |
| 76 | "yaml" |
| 77 | ], |
| 78 | "default": "auto" |
| 79 | }, |
| 80 | "not_follow_redirects": { |
| 81 | "title": "Do not follow redirects", |
| 82 | "type": "boolean" |
| 83 | }, |
| 84 | "proxy_url": { |
| 85 | "title": "Proxy URL", |
| 86 | "type": "string" |
| 87 | }, |
| 88 | "proxy_username": { |
| 89 | "title": "Proxy username", |
| 90 | "type": "string" |
| 91 | }, |
| 92 | "proxy_password": { |
| 93 | "title": "Proxy password", |
| 94 | "type": "string" |
| 95 | }, |
| 96 | "tls_ca": { |
| 97 | "title": "TLS CA", |
| 98 | "description": "Path to CA certificate used to verify the endpoint.", |
| 99 | "type": "string" |
| 100 | }, |
| 101 | "tls_cert": { |
| 102 | "title": "TLS certificate", |
| 103 | "description": "Path to client TLS certificate.", |
| 104 | "type": "string" |
| 105 | }, |
| 106 | "tls_key": { |
| 107 | "title": "TLS key", |
| 108 | "description": "Path to client TLS key.", |
| 109 | "type": "string" |
| 110 | }, |
| 111 | "tls_skip_verify": { |
| 112 | "title": "Skip TLS verification", |
| 113 | "type": "boolean" |
| 114 | }, |
| 115 | "force_http2": { |
| 116 | "title": "Force HTTP/2", |
| 117 | "type": "boolean" |
| 118 | } |
| 119 | }, |
| 120 | "required": [ |
| 121 | "url" |
| 122 | ] |
| 123 | } |
| 124 | }, |
| 125 | "required": [ |
| 126 | "http" |
| 127 | ] |
| 128 | }, |
| 129 | "services": { |
| 130 | "title": "Service rules", |
| 131 | "description": "- Match fetched HTTP discovery items and generate collector configurations.\n- Generated job configs must include `name` and `module`; `module` is the collector name, for example `httpcheck` or `ping`.\n- If a generated config omits `module`, the rule ID is used as `module`; rely on this only for curated rules where the rule ID is the intended collector.\n- `.Item` contains the fetched item. String items expose the string as `.Item`; object items expose fields under `.Item`.", |
| 132 | "type": "array", |
| 133 | "minItems": 1, |
| 134 | "items": { |
| 135 | "type": "object", |
| 136 | "properties": { |
| 137 | "id": { |
| 138 | "title": "Rule ID", |
| 139 | "description": "Unique identifier for this rule. If config_template omits module, this value is used as the module. Use that fallback only when the rule ID is the intended collector name.", |
| 140 | "type": "string" |
| 141 | }, |
| 142 | "match": { |
| 143 | "title": "Match expression", |
| 144 | "description": "Go template expression that must evaluate to 'true' for the rule to match the fetched item.", |
| 145 | "type": "string" |
| 146 | }, |
| 147 | "config_template": { |
| 148 | "title": "Config template", |
| 149 | "description": "Go template that generates the data collection job configuration in YAML format. Generated configs must include name and module unless module is intentionally filled from the rule ID.", |
| 150 | "type": "string" |
| 151 | } |
| 152 | }, |
| 153 | "required": [ |
| 154 | "id", |
| 155 | "match" |
| 156 | ] |
| 157 | } |
| 158 | } |
| 159 | }, |
| 160 | "required": [ |
| 161 | "discoverer", |
| 162 | "services" |
| 163 | ] |
| 164 | }, |
| 165 | "uiSchema": { |
| 166 | "uiOptions": { |
| 167 | "fullPage": true |
| 168 | }, |
| 169 | "ui:flavour": "tabs", |
| 170 | "ui:options": { |
| 171 | "tabs": [ |
| 172 | { |
| 173 | "title": "Discovery", |
| 174 | "fields": [ |
| 175 | "discoverer" |
| 176 | ] |
| 177 | }, |
| 178 | { |
| 179 | "title": "Services", |
| 180 | "fields": [ |
| 181 | "services" |
| 182 | ] |
| 183 | } |
| 184 | ] |
| 185 | }, |
| 186 | "discoverer": { |
| 187 | "http": { |
| 188 | "ui:flavour": "tabs", |
| 189 | "ui:options": { |
| 190 | "tabs": [ |
| 191 | { |
| 192 | "title": "Request", |
| 193 | "fields": [ |
| 194 | "url", |
| 195 | "format", |
| 196 | "not_follow_redirects", |
| 197 | "interval", |
| 198 | "timeout", |
| 199 | "method", |
| 200 | "body" |
| 201 | ] |
| 202 | }, |
| 203 | { |
| 204 | "title": "Auth", |
| 205 | "fields": [ |
| 206 | "username", |
| 207 | "password", |
| 208 | "bearer_token_file" |
| 209 | ] |
| 210 | }, |
| 211 | { |
| 212 | "title": "TLS", |
| 213 | "fields": [ |
| 214 | "tls_ca", |
| 215 | "tls_cert", |
| 216 | "tls_key", |
| 217 | "tls_skip_verify" |
| 218 | ] |
| 219 | }, |
| 220 | { |
| 221 | "title": "Proxy", |
| 222 | "fields": [ |
| 223 | "proxy_url", |
| 224 | "proxy_username", |
| 225 | "proxy_password", |
| 226 | "force_http2" |
| 227 | ] |
| 228 | }, |
| 229 | { |
| 230 | "title": "Headers", |
| 231 | "fields": [ |
| 232 | "headers" |
| 233 | ] |
| 234 | } |
| 235 | ] |
| 236 | }, |
| 237 | "url": { |
| 238 | "ui:placeholder": "https://example.com/netdata/go.d/jobs.yaml" |
| 239 | }, |
| 240 | "method": { |
| 241 | "ui:widget": "hidden" |
| 242 | }, |
| 243 | "body": { |
| 244 | "ui:widget": "hidden" |
| 245 | }, |
| 246 | "interval": { |
| 247 | "ui:placeholder": "1m", |
| 248 | "ui:help": "Examples: 30s, 1m, 5m. Use 0 for one-shot fetch." |
| 249 | }, |
| 250 | "format": { |
| 251 | "ui:placeholder": "auto", |
| 252 | "ui:widget": "radio", |
| 253 | "ui:options": { |
| 254 | "inline": true |
| 255 | } |
| 256 | }, |
| 257 | "password": { |
| 258 | "ui:widget": "password" |
| 259 | }, |
| 260 | "proxy_password": { |
| 261 | "ui:widget": "password" |
| 262 | }, |
| 263 | "force_http2": { |
| 264 | "ui:widget": "hidden" |
| 265 | } |
| 266 | } |
| 267 | }, |
| 268 | "services": { |
| 269 | "ui:descriptionPosition": "top", |
| 270 | "ui:listFlavour": "list", |
| 271 | "items": { |
| 272 | "id": { |
| 273 | "ui:placeholder": "httpcheck" |
| 274 | }, |
| 275 | "match": { |
| 276 | "ui:widget": "textarea", |
| 277 | "ui:placeholder": "{{ true }}", |
| 278 | "ui:help": "| Field | Description |\n|-------|-------------|\n| `.Item` | Fetched item. Object fields are under `.Item`, for example `.Item.url`. String items expose the string itself. |\n| `.TUID` | Stable target unique ID. |\n| `.Hash` | Stable content-sensitive target hash. |" |
| 279 | }, |
| 280 | "config_template": { |
| 281 | "ui:widget": "textarea", |
| 282 | "ui:placeholder": "name: {{ .TUID }}\nmodule: httpcheck\nurl: {{ .Item }}" |
| 283 | } |
| 284 | } |
| 285 | } |
| 286 | } |
| 287 | } |