diff --git a/roles/systemd_exporter/molecule/alternative/molecule.yml b/roles/systemd_exporter/molecule/alternative/molecule.yml index 1b5c515c..d49f8642 100644 --- a/roles/systemd_exporter/molecule/alternative/molecule.yml +++ b/roles/systemd_exporter/molecule/alternative/molecule.yml @@ -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 diff --git a/roles/systemd_exporter/templates/systemd_exporter.service.j2 b/roles/systemd_exporter/templates/systemd_exporter.service.j2 index 2cb7e588..cd7bc159 100644 --- a/roles/systemd_exporter/templates/systemd_exporter.service.j2 +++ b/roles/systemd_exporter/templates/systemd_exporter.service.j2 @@ -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 }} \