Grafana MGMT

概述

参考:

Grafana 密码重置

参考:

SQLite3 重置

首先需要安装 sqlite3 命令行工具,然后通过 sqlite3 /PATH/TO/grafana.db 命令进入 Grafana 数据库

通过 select login, password, salt from user where login = 'admin'; 语句可以查询到 admin 的当前密码信息

使用下面的 SQL,可以更新 admin 用户的密码为 admin:

sqlite> update user set password = '59acf18b94d7eb0694c61e60ce44c110c7a683ac6a8f09580d626f90f4a242000746579358d77dd9e570e83fa24faa88a8a6', salt = 'F3FAxVm33R' where login = 'admin';

API 修改密码

前提是没有忘记密码

curl -X PUT -H "Content-Type: application/json" -d '{
  "oldPassword": "旧密码",
  "newPassword": "新密码",
  "confirmNew": "新密码"
}' http://账号:旧密码@IP:PORT/api/user/password

grafana-cli 密码重置

grafana-cli admin reset-admin-password 新密码

常用 Dashboard 推荐

Kubernetes

Node exporter

Nginx

  • 9614
  • 12559 # Loki NGINX Service Mesh - JSON version

如何用 Loki 来绘制 Ingress Nginx 监控大屏

在代理后面使用 Grafana

https://grafana.com/tutorials/run-grafana-behind-a-proxy/

# This is required to proxy Grafana Live WebSocket connections.
map $http_upgrade $connection_upgrade {
  default upgrade;
  '' close;
}

upstream grafana {
  server localhost:3000;
}

server {
  listen 80;
  root /usr/share/nginx/html;
  index index.html index.htm;

  location / {
    proxy_set_header Host $host;
    proxy_pass http://grafana;
  }

  # Proxy Grafana Live WebSocket connections.
  location /api/live/ {
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_set_header Host $host;
    proxy_pass http://grafana;
  }
}

Notes: proxy_pass 字段的值应该替换成真实的 Grafana 地址


最后修改 January 5, 2025: vector, clickhouse (018c1f03)