Merge pull request #208 from haavard/haavard/collector-flags

fix(systemd_exporter): Fix collector flags for older versions
This commit is contained in:
gardar 2023-08-29 13:58:59 +00:00 committed by GitHub
commit e3b15634b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View file

@ -7,3 +7,4 @@ provisioner:
systemd_exporter_web_listen_address: "127.0.0.1:9000"
go_arch: amd64
systemd_exporter_version: 0.4.0
systemd_exporter_enable_file_descriptor_size: true

View file

@ -10,13 +10,25 @@ User={{ systemd_exporter_system_user }}
Group={{ systemd_exporter_system_group }}
ExecStart={{ systemd_exporter_binary_install_dir }}/systemd_exporter \
{% if systemd_exporter_enable_restart_count %}
{% if systemd_exporter_version is version('0.5.0', '>=') %}
--systemd.collector.enable-restart-count \
{% else %}
--collector.enable-restart-count \
{% endif %}
{% endif %}
{% if systemd_exporter_enable_file_descriptor_size %}
{% if systemd_exporter_version is version('0.5.0', '>=') %}
--systemd.collector.enable-file-descriptor-size \
{% else %}
--collector.enable-file-descriptor-size \
{% endif %}
{% endif %}
{% if systemd_exporter_enable_ip_accounting %}
{% if systemd_exporter_version is version('0.5.0', '>=') %}
--systemd.collector.enable-ip-accounting \
{% else %}
--collector.enable-ip-accounting \
{% endif %}
{% endif %}
{% if systemd_exporter_unit_include != ""%}
--systemd.collector.unit-include={{ systemd_exporter_unit_include }} \