Delete `promtail` config for `snmp_exporter`.

This commit is contained in:
Kazuhiro MUSASHI 2023-02-22 23:52:02 +09:00
parent b21253be8c
commit e9a1480351
5 changed files with 0 additions and 112 deletions

View File

@ -12,28 +12,3 @@ include_recipe './alertmanager_webhook_setup.rb'
include_recipe './snmp_exporter_install.rb'
include_recipe './snmp_exporter_setup.rb'
# Deploy /etc/hosts file:
HOSTNAME = run_command('uname -n').stdout.chomp
template '/etc/promtail/prometheus.yaml' do
owner 'root'
group 'root'
mode '644'
variables(HOSTNAME: HOSTNAME, LOKIENDPOINT: node['promtail']['lokiendpoint'])
notifies :restart, 'service[promtail-prometheus]'
end
# Deploy the `systemd` configuration:
remote_file '/lib/systemd/system/promtail-prometheus.service' do
owner 'root'
group 'root'
mode '644'
end
# Service setting:
service 'promtail-prometheus' do
action [ :enable, :restart ]
end

View File

@ -1,12 +0,0 @@
[Unit]
Description=Grafana Promtail for Prometheus
Documentation=https://github.com/grafana/loki
After=network-online.target
[Service]
User=root
Restart=always
ExecStart=/usr/local/bin/promtail --config.file=/etc/promtail/prometheus.yaml
[Install]
WantedBy=multi-user.target

View File

@ -1,12 +0,0 @@
[Unit]
Description=Grafana Promtail for snmp_exporter
Documentation=https://github.com/grafana/loki
After=network-online.target
[Service]
User=root
Restart=always
ExecStart=/usr/local/bin/promtail --config.file=/etc/promtail/snmp_exporter.yaml
[Install]
WantedBy=multi-user.target

View File

@ -64,26 +64,3 @@ end
service 'consul' do
action :nothing
end
# Deploy /etc/hosts file:
template '/etc/promtail/snmp_exporter.yaml' do
owner 'root'
group 'root'
mode '644'
variables(HOSTNAME: node[:hostname], LOKIENDPOINT: node['promtail']['lokiendpoint'])
notifies :restart, 'service[promtail-snmp_exporter]'
end
# Deploy the `systemd` configuration:
remote_file '/lib/systemd/system/promtail-snmp_exporter.service' do
owner 'root'
group 'root'
mode '644'
end
# Service setting:
service 'promtail-snmp_exporter' do
action [ :enable, :restart ]
end

View File

@ -1,40 +0,0 @@
server:
disable: true
positions:
filename: /var/opt/promtail/promtail_snmp_exporter_position.yaml
clients:
- url: http://<%= @LOKIENDPOINT %>/loki/api/v1/push
scrape_configs:
- job_name: snmp_exporter
static_configs:
- targets:
- localhost
labels:
job: snmp_exporter
hostname: <%= @HOSTNAME %>
__path__: /var/log/supervisor/snmp_exporter.log
pipeline_stages:
- match:
selector: '{job="snmp_exporter"}'
stages:
- regex:
expression: '^level=(?P<level>[^ ]+) ts=(?P<timestamp>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z) (?P<message>.+)$'
- timestamp:
source: timestamp
format: 2006-01-02T15:04:05.000Z
location: Etc/GMT
- template:
source: level
template: '{{ regexReplaceAllLiteral "warn" .Value "warning" }}'
- labels:
level:
- output:
source: message