grafana-ui教程

grafana-uigrafana 公司的 UI 展示组件.

参考官网 Install Grafana on Debian or Ubuntu | Grafana documentation,这个下载很慢, 建议挂上 apt代理

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# 安装必要的包和签名key
apt install -y apt-transport-https software-properties-common wget
wget -q -O /usr/share/keyrings/grafana.key https://apt.grafana.com/gpg.key
# 添加repo
echo "deb [signed-by=/usr/share/keyrings/grafana.key] https://apt.grafana.com stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
# 安装, grafana-enterprise是企业版
apt update -y; apt install grafana -y

# 启动
systemctl enable grafana-server --now
# 默认密码 admin/admin
curl 127.0.0.1:3000

配置 nginx 转发访问

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
server {
    listen 80;
    server_name om-grafana.chinnshi.com;
    return 301 https://$server_name$request_uri;
    access_log /usr/local/nginx/conf/hosts/logs/om-grafana.kentxxq.com.log k-json;
}

server {
    listen 443 ssl http2;
    server_name om-grafana.chinnshi.com;
    access_log /usr/local/nginx/conf/hosts/logs/om-grafana.kentxxq.com.log k-json;

    include /usr/local/nginx/conf/options/normal.conf;
    include /usr/local/nginx/conf/options/ssl_chinnshi.conf;

    location / {
        proxy_pass http://127.0.0.1:3000;
    }
}
1
2
# 如果报错找不到默认配置 --homepath "/usr/share/grafana" <new_password>
grafana-cli admin reset-admin-password <new password>