
401 Unauthorized。curl -v -X POST ${RemoteWriteURL}
Asia/Shanghai, Europe/Berlin 或者 Local (默认是 "UTC")。mkdir /etc/prometheustouch /etc/prometheus/scrape-config.yamldocker run -d --name vmagent --restart always --net host -v /etc/prometheus:/etc/prometheus victoriametrics/vmagent:latest \\-promscrape.noStaleMarkers \\-loggerTimezone=Local \\-remoteWrite.url="${RemoteWriteURL}" \\-remoteWrite.basicAuth.username="${APPID}" \\-remoteWrite.basicAuth.password='${Token}' \\-remoteWrite.tmpDataPath=/var/lib/vmagent \\-promscrape.config=/etc/prometheus/scrape-config.yaml \\-promscrape.configCheckInterval=5s
docker psdocker logs vmagent
OK。curl localhost:8429/health
mkdir /etc/prometheustouch /etc/prometheus/scrape-config.yamlcat >/usr/lib/systemd/system/vmagent.service <<EOF[Unit]Description=VictoriaMetrics AgentAfter=network.target[Service]LimitNOFILE=10240ExecStart=/usr/bin/vmagent \\-promscrape.noStaleMarkers \\-loggerTimezone=Local \\-remoteWrite.url="${RemoteWriteURL}" \\-remoteWrite.basicAuth.username="${APPID}" \\-remoteWrite.basicAuth.password="${Token}" \\-remoteWrite.tmpDataPath=/var/lib/vmagent \\-promscrape.config=/etc/prometheus/scrape-config.yaml \\-promscrape.configCheckInterval=5sRestart=alwaysRestartSec=10s[Install]WantedBy=multi-user.targetEOFsystemctl daemon-reloadsystemctl enable vmagentsystemctl start vmagentsleep 3systemctl status vmagent
journalctl -u vmagent
OK。curl localhost:8429/health
global:scrape_interval: 30sscrape_configs:- job_name: agent-monitorstatic_configs:- targets:- localhost:8429
-promscrape.configCheckInterval 设置时间才会生效。curl localhost:8429/api/v1/targets
文档反馈