k8s grafana

grafana install

dashboards

模板 https://grafana.com/grafana/dashboards/

node-exporter

https://grafana.com/grafana/dashboards/1860-node-exporter-full/

密码

grafana-cli

1
grafana-cli admin reset-admin-password pwd

修改数据库重置

1
2
3
4
update user set password = '59acf18b94d7eb0694c61e60ce44c110c7a683ac6a8f09580d626f90f4a242000746579358d77dd9e570e83fa24faa88a8a6'
,salt = 'F3FAxVm33R'
,rands= 'AmtsbvblVi'
where login = 'admin';

admin admin登陆会要求修改密码

db

默认sqlite3转换成mysql

1
2
pip install sqlite3-to-mysql
❯ sqlite3mysql -f /media/ssd/nfs/k8s/grafana/pv/grafana.db -d k8s_grafana -ugrafana -p -P 3305 -h localhost

….

2023-10-11 23:03:05 INFO Adding unique index to column “title, parent_uid” in table folder
2023-10-11 23:03:05 INFO Adding unique index to column “uid, org_id” in table folder
2023-10-11 23:03:05 INFO Adding index to column “parent_uid, org_id” in table folder

2023-10-11 23:03:05 INFO Done!

import 14518

/api/dashboards/import 接口报 500 Internal Server Error

msg=”Failed to save dashboard” error=”Error 1406 (22001): Data too long for column ‘data’ at row 1” 涉及2个表数据

1
2
3
4
ALTER TABLE dashboard MODIFY data MEDIUMTEXT;
ALTER TABLE dashboard_version MODIFY data MEDIUMTEXT;

select d.title ,d.id ,dv.`data` from dashboard d,dashboard_version dv where d.id =dv.dashboard_id and d.gnet_id ="14518";

Text 最大长度65535个字节(2^16-1

MediumText 最大长度 16777215 个字节(2^24-1

LongText 最大长度4294967295个字节 (2^32-1)

pkg/services/sqlstore/migrations/dashboard_mig.go

pkg/services/sqlstore/migrations/dashboard_version_mig.go

https://github.com/grafana/grafana/pull/35668/files/0bc461905f381d84a831ecace838f26476ccfd90

1
ALTER TABLE alert_configuration MODIFY alertmanager_configuration MEDIUMTEXT;

question

websocket

/api/live/ws → status 400

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
upstream dashboard{
server k8s01:443;
server k8s02:443;
server k8s03:443;
}

map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

server {
listen 443 ssl;
server_name grafana.ui.k8s.cn;

ssl_certificate conf.d/ssl/ui.k8s.cn.crt;
ssl_certificate_key conf.d/ssl/ui.k8s.cn.key;

ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;

ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass https://dashboard;
}
location /api/live/ws {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $http_host;
proxy_pass https://grafana.ui.k8s.cn;
}
}

安装文档配置后

method=GET path=/api/live/ws status=-1

浏览器 101 Switching Protocols

1
traefik.http.routers.grafana.rule: Host(`grafana.ui.k8s.cn`)
点击打赏
文章目录
  1. 1. grafana install
    1. 1.1. dashboards
      1. 1.1.1. node-exporter
    2. 1.2. 密码
    3. 1.3. db
      1. 1.3.1. import 14518
    4. 1.4. question
      1. 1.4.1. websocket
        1. 1.4.1.1. /api/live/ws → status 400
载入天数...载入时分秒... ,