cloudflare/pint
Publicmirrored fromhttps://github.com/cloudflare/pintAvailable
docs/examples/discovery.hcl
39lines · modecode
| 1 | # Example with Prometheus server discovery. |
| 2 | |
| 3 | discovery { |
| 4 | |
| 5 | # filepath discovery will generate Prometheus servers from files on disk. |
| 6 | # We define a regexp and any file or directory path matching that regexp will |
| 7 | # generate a new Prometheus server. |
| 8 | filepath { |
| 9 | # Directory to scan for files. |
| 10 | directory = "/etc/prometheus/servers" |
| 11 | |
| 12 | # Regexp rule to match, with capture groups to store variables. |
| 13 | match = "(?P<name>\\w+).yaml" |
| 14 | |
| 15 | # Use variables from the regex to generate a new Prometheus configuration block. |
| 16 | template { |
| 17 | name = "prometheus-{{ $name }}" # We can use 'name' regexp capture group as $name. |
| 18 | uri = "https://prometheus-{{ $name }}.example.com" |
| 19 | failover = [ "https://prometheus-{{ $name }}-backup.example.com" ] |
| 20 | headers = { |
| 21 | "X-Auth": "secret", |
| 22 | "X-User": "bob" |
| 23 | "X-Cluster": "{{ $name }}" |
| 24 | } |
| 25 | timeout = "30s" |
| 26 | } |
| 27 | |
| 28 | template { |
| 29 | name = "prometheus-clone-{{ $name }}" |
| 30 | uri = "https://{{ $name }}.example.com" |
| 31 | failover = [ "https://{{ $name }}-backup.example.com" ] |
| 32 | headers = { |
| 33 | "X-Auth": "secret", |
| 34 | "X-User": "bob", |
| 35 | } |
| 36 | timeout = "30s" |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | |