change monogdb exporter collector check in service (#310)

the collectors section within in the systemd service file checks if
mongodb_exporter_collectors is iterable. Since string is iterable the
elif block does not trigger. If I change the if to check if the
variable is from type list, it works.

Signed-off-by: Spirit-act <16631523+Spirit-act@users.noreply.github.com>
This commit is contained in:
Spirit-act 2024-03-07 09:15:39 +01:00 committed by GitHub
parent f2de77e26f
commit 6218fccc64
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View file

@ -11,6 +11,7 @@ mongodb_exporter_web_listen_address: "0.0.0.0:9216"
mongodb_exporter_web_telemetry_path: "/metrics"
mongodb_exporter_uri: "mongodb://127.0.0.1:27017/admin?ssl=false"
# specify a list of collectors or "all"
mongodb_exporter_collectors: []
mongodb_exporter_collstats_colls: []
mongodb_exporter_indexstats_colls: []

View file

@ -12,7 +12,7 @@ User={{ mongodb_exporter_system_user }}
Group={{ mongodb_exporter_system_group }}
ExecStart={{ mongodb_exporter_binary_install_dir }}/mongodb_exporter \
{% if mongodb_exporter_collectors is iterable %}
{% if mongodb_exporter_collectors | type_debug == "list" %}
{% for collector in mongodb_exporter_collectors -%}
--collector.{{ collector }} \
{% endfor %}