Skip to content

Commit 2a4a947

Browse files
committed
Fix variablename in rsyslog and fix the scrape config.
1 parent 8f762f3 commit 2a4a947

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

node_and_vm_agent

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ WantedBy=multi-user.target
117117
EOF
118118

119119
[ -s /etc/rsyslog.d/vm-agent.conf ] || cat << EOF > /etc/rsyslog.d/vm-agent.conf
120-
if $programname == 'vm-agent' then /var/log/vm-agent.log
120+
if \$programname == 'vm-agent' then /var/log/vm-agent.log
121121
& stop
122122
EOF
123123

@@ -131,11 +131,21 @@ EOF
131131
}
132132
EOF
133133
[ -s /opt/victoriametrics/scraper.yml ] || cat << EOF > /opt/victoriametrics/scraper.yml
134+
global:
135+
scrape_interval: 15s
136+
static_configs:
137+
- labels:
138+
hostname: $(hostname)
139+
134140
scrape_configs:
135141
- job_name: node
136-
scrape_interval: 15s
142+
relabel_configs:
143+
- source_labels: [__hostname__]
144+
target_label: instance
145+
replacement: "$(hostname)"
137146
static_configs:
138147
- targets: ['localhost:9100']
148+
139149
EOF
140150

141151
systemctl daemon-reload

0 commit comments

Comments
 (0)