安装教程
第一种
参考官网安装
第二种
便捷安装
prometheus:
纯文本
1
apt install prometheusgrafana:
纯文本
1
2
3
4
sudo apt-get install -y adduser libfontconfig1
wget https://cdn.jansora.com/lib/grafana/9.1.7/grafana-enterprise_9.1.7_amd64.deb
sudo dpkg -i grafana-enterprise_9.1.7_amd64.deb
配置
vim /etc/grafana/grafana.ini纯文本
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
# 配置 grafana mysql 为后端
[database]
# You can configure the database connection by specifying type, host, name, user and password
# as separate properties or as on string using the url properties.
# Either "mysql", "postgres" or "sqlite3", it's your choice
;type = sqlite3
;host = 127.0.0.1:3306
;name = grafana
;user = root
# If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;"""
;password =
type = mysql
host = 127.0.0.1:3306
name = grafana
user = grafana
password = 111
# 配置服务
[server]
# Protocol (http, https, h2, socket)
;protocol = http
# The ip address to bind to, empty will bind to all interfaces
;http_addr =
# The http port to use
http_port = 3000重启 grafana
systemctl restart grafana-server.servicegrafana 默认的用户名和密码都是 admin
配置 nginx 转发
需要注意的是 grafana 转发的proxy_set_header Host $http_host;一定要配置
纯文本
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
38
39
40
41
42
server {
listen 443 ssl http2;
server_name prometheus.jansora.com;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate /etc/nginx/certs/lets-encrypt-jansora.com/jansora.com.cer;
ssl_certificate_key /etc/nginx/certs/lets-encrypt-jansora.com/jansora.com.key;
auth_basic "请输入用户和密码"; # 验证时的提示信息
auth_basic_user_file /etc/nginx/passwd/jansora; # 认证文件
location / {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://127.0.0.1:9090;
}
}
server {
listen 443 ssl http2;
server_name grafana.jansora.com;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate /etc/nginx/certs/lets-encrypt-jansora.com/jansora.com.cer;
ssl_certificate_key /etc/nginx/certs/lets-encrypt-jansora.com/jansora.com.key;
location / {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://127.0.0.1:3000;
}
}

评论栏
分享你的想法,或参与下面的讨论。
参与讨论
支持 Markdown、代码和图片
友善交流,让讨论更有价值。
更多留言
加载中…