我尝试通过此命令安装 grafana-agent,并得到 grafana.net 仪表板:
ARCH="amd64" GCLOUD_HOSTED_METRICS_URL="https://prometheus-prod-24-prod-eu-west-2.grafana.net/api/prom/push" GCLOUD_HOSTED_METRICS_ID="1033967" GCLOUD_SCRAPE_INTERVAL="60s" GCLOUD_HOSTED_LOGS_URL="https://logs-prod-012.grafana.net/loki/api/v1/push" GCLOUD_HOSTED_LOGS_ID="618877" GCLOUD_RW_API_KEY="glc_eyJvIjoiODc2MDkxIiwibiI6ImNvbnRhYm8tc3Vlbm90LTEiLCJrIjoiMHdHMmJYYzVaRmdzOTcyNXdxM0ZGNThpIiwibSI6eyJyIjoicHJvZC1ldS13ZXN0LTIifX0=" /bin/sh -c "$(curl -fsSL https://storage.googleapis.com/cloud-onboarding/agent/scripts/grafanacloud-install.sh)"
但服务未能正确启动。
sudo systemctl status grafana-agent.service
● grafana-agent.service - Monitoring system and forwarder
Loaded: loaded (/usr/lib/systemd/system/grafana-agent.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2023-06-12 11:19:00 CEST; 1min 5s ago
Docs: https://grafana.com/docs/agent/latest/
Process: 907 ExecStart=/usr/bin/grafana-agent --config.file $CONFIG_FILE $CUSTOM_ARGS (code=exited, status=1/FAILURE)
Main PID: 907 (code=exited, status=1/FAILURE)
Jun 12 11:19:00 vmi865508.contaboserver.net systemd[1]: grafana-agent.service: Service hold-off time over, scheduling restart.
Jun 12 11:19:00 vmi865508.contaboserver.net systemd[1]: grafana-agent.service: Scheduled restart job, restart counter is at 5.
Jun 12 11:19:00 vmi865508.contaboserver.net systemd[1]: Stopped Monitoring system and forwarder.
Jun 12 11:19:00 vmi865508.contaboserver.net systemd[1]: grafana-agent.service: Start request repeated too quickly.
Jun 12 11:19:00 vmi865508.contaboserver.net systemd[1]: grafana-agent.service: Failed with result 'exit-code'.
Jun 12 11:19:00 vmi865508.contaboserver.net systemd[1]: Failed to start Monitoring system and forwarder.
我试过了systemctl reset-failed grafana-agent.service
。没用。
环境:
Ubuntu 18.04.6 LTS
root user
答案1
也许问题就在这里:grafana-agent.service: Start request repeated too quickly.
要解决此问题,请编辑该/etc/systemd/system.conf
文件。您可以使用以下方式进行设置:
StartLimitIntervalSec=30s
StartLimitBurst=10
RestartSec=500ms
此后,使用以下命令重新加载 systemctl 守护进程systemctl daemon-reload
您可以在此处找到更多详细信息回答。