diff --git a/cookbooks/prometheus/files/etc/consul.d/service-snmp_exporter.json b/cookbooks/prometheus/files/etc/consul.d/service-snmp_exporter.json new file mode 100644 index 0000000..30553f7 --- /dev/null +++ b/cookbooks/prometheus/files/etc/consul.d/service-snmp_exporter.json @@ -0,0 +1,12 @@ +{ + "service": { + "name": "snmp_exporter", + "port": 9116, + "check":{ + "tcp": "127.0.0.1:9116", + "interval": "60s", + "timeout": "1s", + "success_before_passing": 3 + } + } +} diff --git a/cookbooks/prometheus/snmp_exporter_setup.rb b/cookbooks/prometheus/snmp_exporter_setup.rb index 0962728..8b39c01 100644 --- a/cookbooks/prometheus/snmp_exporter_setup.rb +++ b/cookbooks/prometheus/snmp_exporter_setup.rb @@ -12,6 +12,15 @@ remote_file '/etc/supervisor/conf.d/snmp_exporter.conf' do notifies :restart, 'service[supervisor]' end +# Deploy `consul` config: +remote_file '/etc/consul.d/service-snmp_exporter.json' do + owner 'root' + group 'root' + mode '644' + + notifies :restart, 'service[supervisor]' +end + # Restart the `supervisor`: service 'supervisor' do action :nothing