Deploy `snmp_exporter` service and enable it.

This commit is contained in:
Kazuhiro MUSASHI 2023-02-05 20:40:26 +09:00
parent 44cede10da
commit 83484ff4a5
3 changed files with 15 additions and 11 deletions

View File

@ -1,8 +0,0 @@
[program:snmp_exporter]
command=/usr/local/bin/snmp_exporter --config.file /etc/prometheus_exporters.d/snmp.yml
stdout_logfile=/var/log/supervisor/snmp_exporter.log
redirect_stderr=true
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=5
autorestart=true
stopsignal=HUP

View File

@ -0,0 +1,10 @@
[Unit]
Description=SNMP Exporter
[Service]
User=root
Group=root
ExecStart=/usr/local/bin/snmp_exporter --config.file /etc/prometheus_exporters.d/snmp.yml
[Install]
WantedBy=multi-user.target

View File

@ -3,13 +3,15 @@ link '/etc/prometheus_exporters.d/snmp.yml' do
to "#{node['snmp_exporter']['storage']}snmp.yml"
end
# Deploy `supervisord` config:
remote_file '/etc/supervisor/conf.d/snmp_exporter.conf' do
# Deploy `systemd` config:
remote_file '/etc/systemd/system/snmp_exporter.service' do
owner 'root'
group 'root'
mode '644'
end
notifies :restart, 'service[supervisor]'
service 'snmp_exporter' do
action [:enable, :start]
end
# Deploy `consul` config: