@@ -11,6 +11,7 @@ Prometheus exporter for FortiGate® firewalls.
1111
1212 * [ Supported Metrics] ( #supported-metrics )
1313 * [ Usage] ( #usage )
14+ + [ Dynamic configuration] ( #dynamic-configuration )
1415 + [ Available CLI parameters] ( #available-cli-parameters )
1516 + [ Fortigate Configuration] ( #fortigate-configuration )
1617 + [ Prometheus Configuration] ( #prometheus-configuration )
@@ -324,6 +325,39 @@ Special cases:
324325
325326To probe a FortiGate, do something like ` curl 'localhost:9710/probe?target=https://my-fortigate' `
326327
328+ ### Dynamic configuration
329+ In use cases where the Fortigates that is to be scraped through the fortigate-exporter is configured in
330+ Prometheus using some discovery method it becomes problematic that the ` fortigate-key.yaml ` configuration also
331+ has to be updated for each fortigate, and that the fortigate-exporter needs to be restarted on each change.
332+ For that scenario the token can be passed as a query parameter, ` token ` , to the fortigate.
333+
334+ Example:
335+ ``` bash
336+ curl ' localhost:9710/probe?target=https://192.168.2.31&token=ghi6eItWzWewgbrFMsazvBVwDjZzzb'
337+ ```
338+ It is also possible to pass a ` profile ` query parameter. The value will match an entry in the ` fortigate-key.yaml `
339+ file, but only to use the ` probes ` section for include/exclude directives.
340+
341+ Example:
342+ ``` bash
343+ curl ' localhost:9710/probe?target=https://192.168.2.31&token=ghi6eItWzWewgbrFMsazvBVwDjZzzb&profile=fs124e'
344+ ```
345+ The ` profile=fs124e ` would match the following entry in ` fortigate-key.yaml ` .
346+
347+ Example:
348+ ``` yaml
349+ fs124e :
350+ # token: not used
351+ probes :
352+ include :
353+ - System
354+ - Firewall
355+ exclude :
356+ - System/LinkMonitor
357+ ` ` `
358+
359+
360+
327361### Available CLI parameters
328362
329363| flag | default value | description |
@@ -437,6 +471,40 @@ An example configuration for Prometheus looks something like this:
437471 replacement: '[::1]:9710'
438472```
439473
474+ If using [ Dynamic configuration] ( #dynamic-configuration ) :
475+ ``` yaml
476+ - job_name : ' fortigate_exporter'
477+ metrics_path : /probe
478+ file_sd_configs :
479+ - files :
480+ - /etc/prometheus/file_sd/fws/*.yml
481+ params :
482+ profile :
483+ - fs124e
484+ relabel_configs :
485+ - source_labels : [__address__]
486+ target_label : __param_target
487+ - source_labels : [token]
488+ target_label : __param_token
489+ - source_labels : [__param_target]
490+ regex : ' (?:.+)(?::\/\/)([^:]*).*'
491+ target_label : instance
492+ - target_label : __address__
493+ replacement : ' [::1]:9710'
494+ - action : labeldrop
495+ regex : token
496+ ` ` `
497+ > Make sure to use the last labeldrop on the ` token` label so that the tokens is not be part of your time series.
498+
499+ > Since `token` is a label it will be shown in the Prometheus webgui at `http://<your prometheus>:9090/targets`.
500+ >
501+ > **Make sure you protect your Prometheus if you add the token part of your prometheus config**
502+ >
503+ > Some options to protect Prometheus:
504+ > - Only expose UI to localhost --web.listen-address="127.0.0.1:9090"
505+ > - Basic authentication access - https://prometheus.io/docs/guides/basic-auth/
506+ > - **It is your responsibility!**
507+
440508# ## Docker
441509
442510You can either use the automatic builds on
0 commit comments