From f6f354115d1eefb17bf91e023c2945d2236ccdfc Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Tue, 7 Feb 2023 23:02:24 +0900 Subject: [PATCH] Deploy `systemd` config for `filestat_exporter`. --- .../etc/systemd/system/filestat_exporter.service | 11 +++++++++++ .../prometheus-exporters/filestat_exporter_setup.rb | 8 +++++--- 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 cookbooks/prometheus-exporters/files/etc/systemd/system/filestat_exporter.service diff --git a/cookbooks/prometheus-exporters/files/etc/systemd/system/filestat_exporter.service b/cookbooks/prometheus-exporters/files/etc/systemd/system/filestat_exporter.service new file mode 100644 index 0000000..6136353 --- /dev/null +++ b/cookbooks/prometheus-exporters/files/etc/systemd/system/filestat_exporter.service @@ -0,0 +1,11 @@ +[Unit] +Description=Filestat Exporter + +[Service] +User=root +Group=root +ExecStart=/usr/local/bin/filestat_exporter --config.file=/etc/prometheus_exporters.d/filestat.yml + +[Install] +WantedBy=multi-user.target + diff --git a/cookbooks/prometheus-exporters/filestat_exporter_setup.rb b/cookbooks/prometheus-exporters/filestat_exporter_setup.rb index 71b2a9f..690e316 100644 --- a/cookbooks/prometheus-exporters/filestat_exporter_setup.rb +++ b/cookbooks/prometheus-exporters/filestat_exporter_setup.rb @@ -7,13 +7,15 @@ remote_file '/etc/prometheus_exporters.d/filestat.yml' do notifies :restart, 'service[supervisor]' end -# Deploy the `supervisord` configuration: -remote_file '/etc/supervisor/conf.d/filestat_exporter.conf' do +# Deploy the `systemd` configuration: +remote_file '/etc/systemd/system/filestat_exporter.service' do owner 'root' group 'root' mode '644' +end - notifies :restart, 'service[supervisor]' +service 'filestat_exporter' do + action [:enable, :start] end # Deploy `consul` config for `node_exporter`: