ccfos / nightingale

An all-in-one observability solution which aims to combine the advantages of Prometheus and Grafana. It manages alert rules and visualizes metrics, logs, traces in a beautiful web UI.
https://flashcat.cloud/docs/
Apache License 2.0
9.8k stars 1.42k forks source link

二进制安装打开部分页面提示404 #1001

Closed fsckzy closed 2 years ago

fsckzy commented 2 years ago

Relevant server.conf | webapi.conf

[root@nacos1 etc]# cat server.conf 
# debug, release
RunMode = "release"

# my cluster name
ClusterName = "Default"

# Default busigroup Key name
# do not change
BusiGroupLabelKey = "busigroup"

# sleep x seconds, then start judge engine
EngineDelay = 120

DisableUsageReport = false

[Log]
# log write dir
Dir = "logs"
# log level: DEBUG INFO WARNING ERROR
Level = "INFO"
# stdout, stderr, file
Output = "stdout"
# # rotate by time
# KeepHours: 4
# # rotate by size
# RotateNum = 3
# # unit: MB
# RotateSize = 256

[HTTP]
# http listening address
Host = "0.0.0.0"
# http listening port
Port = 19000
# https cert file path
CertFile = ""
# https key file path
KeyFile = ""
# whether print access log
PrintAccessLog = false
# whether enable pprof
PProf = false
# http graceful shutdown timeout, unit: s
ShutdownTimeout = 30
# max content length: 64M
MaxContentLength = 67108864
# http server read timeout, unit: s
ReadTimeout = 20
# http server write timeout, unit: s
WriteTimeout = 40
# http server idle timeout, unit: s
IdleTimeout = 120

# [BasicAuth]
# user002 = "ccc26da7b9aba533cbb263a36c07dcc9"

[Heartbeat]
# auto detect if blank
IP = ""
# unit ms
Interval = 1000

[SMTP]
Host = "smtp.163.com"
Port = 994
User = "username"
Pass = "password"
From = "username@163.com"
InsecureSkipVerify = true
Batch = 5

[Alerting]
TemplatesDir = "./etc/template"
NotifyConcurrency = 10
# use builtin go code notify
NotifyBuiltinChannels = ["email", "dingtalk", "wecom", "feishu"]

[Alerting.CallScript]
# built in sending capability in go code
# so, no need enable script sender
Enable = false
ScriptPath = "./etc/script/notify.py"

[Alerting.CallPlugin]
Enable = false
# use a plugin via `go build -buildmode=plugin -o notify.so`
PluginPath = "./etc/script/notify.so"
# The first letter must be capitalized to be exported
Caller = "N9eCaller"

[Alerting.RedisPub]
Enable = false
# complete redis key: ${ChannelPrefix} + ${Cluster}
ChannelPrefix = "/alerts/"

[Alerting.Webhook]
Enable = false
Url = "http://a.com/n9e/callback"
BasicAuthUser = ""
BasicAuthPass = ""
Timeout = "5s"
Headers = ["Content-Type", "application/json", "X-From", "N9E"]

[NoData]
Metric = "target_up"
# unit: second
Interval = 15

[Ibex]
# callback: ${ibex}/${tplid}/${host}
Address = "127.0.0.1:10090"
# basic auth
BasicAuthUser = "ibex"
BasicAuthPass = "ibex"
# unit: ms
Timeout = 3000

[Redis]
# address, ip:port or ip1:port,ip2:port for cluster and sentinel(SentinelAddrs)
Address = "192.168.96.71:6379"
# Username = ""
# Password = ""
# DB = 0
# UseTLS = false
# TLSMinVersion = "1.2"
# standalone cluster sentinel
RedisType = "standalone"
# Mastername for sentinel type
# MasterName = "mymaster"

[DB]
# postgres: host=%s port=%s user=%s dbname=%s password=%s sslmode=%s
DSN="root:P#v#b*7jDHc#AQJa@tcp(localhost:3306)/n9e_v5?charset=utf8mb4&parseTime=True&loc=Local&allowNativePasswords=true"
# enable debug mode or not
Debug = false
# mysql postgres
DBType = "mysql"
# unit: s
MaxLifetime = 7200
# max open connections
MaxOpenConns = 150
# max idle connections
MaxIdleConns = 50
# table prefix
TablePrefix = ""
# enable auto migrate or not
# EnableAutoMigrate = false

[Reader]
# prometheus base url
Url = "http://192.168.96.121:9090"
# Basic auth username
BasicAuthUser = ""
# Basic auth password
BasicAuthPass = ""
# timeout settings, unit: ms
Timeout = 30000
DialTimeout = 10000
TLSHandshakeTimeout = 30000
ExpectContinueTimeout = 1000
IdleConnTimeout = 90000
# time duration, unit: ms
KeepAlive = 30000
MaxConnsPerHost = 0
MaxIdleConns = 100
MaxIdleConnsPerHost = 10

[WriterOpt]
# queue channel count
QueueCount = 100
# queue max size
QueueMaxSize = 200000
# once pop samples number from queue
QueuePopSize = 2000

[[Writers]]
Url = "http://192.168.96.121:9090/api/v1/write"
# Basic auth username
BasicAuthUser = ""
# Basic auth password
BasicAuthPass = ""
# timeout settings, unit: ms
Timeout = 10000
DialTimeout = 3000
TLSHandshakeTimeout = 30000
ExpectContinueTimeout = 1000
IdleConnTimeout = 90000
# time duration, unit: ms
KeepAlive = 30000
MaxConnsPerHost = 0
MaxIdleConns = 100
MaxIdleConnsPerHost = 100

# [[Writers]]
# Url = "http://127.0.0.1:7201/api/v1/prom/remote/write"
# # Basic auth username
# BasicAuthUser = ""
# # Basic auth password
# BasicAuthPass = ""
# # timeout settings, unit: ms
# Timeout = 30000
# DialTimeout = 10000
# TLSHandshakeTimeout = 30000
# ExpectContinueTimeout = 1000
# IdleConnTimeout = 90000
# # time duration, unit: ms
# KeepAlive = 30000
# MaxConnsPerHost = 0
# MaxIdleConns = 100
# MaxIdleConnsPerHost = 100

```shell
[root@nacos1 etc]# egrep -v "^#|^$"  webapi.conf 
RunMode = "release"
MetricsYamlFile = "./etc/metrics.yaml"
BuiltinAlertsDir = "./etc/alerts"
BuiltinDashboardsDir = "./etc/dashboards"
ClustersFrom = "config"
ClustersFromAPIs = []
[[NotifyChannels]]
Label = "邮箱"
Key = "email"
[[NotifyChannels]]
Label = "钉钉机器人"
Key = "dingtalk"
[[NotifyChannels]]
Label = "企微机器人"
Key = "wecom"
[[NotifyChannels]]
Label = "飞书机器人"
Key = "feishu"
[[ContactKeys]]
Label = "Wecom Robot Token"
Key = "wecom_robot_token"
[[ContactKeys]]
Label = "Dingtalk Robot Token"
Key = "dingtalk_robot_token"
[[ContactKeys]]
Label = "Feishu Robot Token"
Key = "feishu_robot_token"
[Log]
Dir = "logs"
Level = "DEBUG"
Output = "stdout"
[HTTP]
Host = "0.0.0.0"
Port = 18000
CertFile = ""
KeyFile = ""
PrintAccessLog = true
PProf = false
ShutdownTimeout = 30
MaxContentLength = 67108864
ReadTimeout = 20
WriteTimeout = 40
IdleTimeout = 120
[JWTAuth]
SigningKey = "5b94a0fd640fe2765af826acfe42d151"
AccessExpired = 1500
RefreshExpired = 10080
RedisKeyPrefix = "/jwt/"
[BasicAuth]
user001 = "ccc26da7b9aba533cbb263a36c07dcc5"
[AnonymousAccess]
PromQuerier = false
AlertDetail = false
[LDAP]
Enable = false
Host = "ldap.example.org"
Port = 389
BaseDn = "dc=example,dc=org"
BindUser = "cn=manager,dc=example,dc=org"
BindPass = "*******"
AuthFilter = "(&(uid=%s))"
CoverAttributes = true
TLS = false
StartTLS = true
DefaultRoles = ["Standard"]
[LDAP.Attributes]
Nickname = "cn"
Phone = "mobile"
Email = "mail"
[OIDC]
Enable = false
RedirectURL = "http://n9e.com/callback"
SsoAddr = "http://sso.example.org"
ClientId = ""
ClientSecret = ""
CoverAttributes = true
DefaultRoles = ["Standard"]
[OIDC.Attributes]
Nickname = "nickname"
Phone = "phone_number"
Email = "email"
[Redis]
Address = "192.168.96.71:6379"
RedisType = "standalone"
[DB]
DSN="root:P#v#b*7jDHc#AQJa@tcp(localhost:3306)/n9e_v5?charset=utf8mb4&parseTime=True&loc=Local&allowNativePasswords=true"
Debug = false
DBType = "mysql"
MaxLifetime = 7200
MaxOpenConns = 150
MaxIdleConns = 50
TablePrefix = ""
[[Clusters]]
Name = "Default"
Prom = "http://192.168.96.121:9090"
BasicAuthUser = ""
BasicAuthPass = ""
Timeout = 30000
DialTimeout = 3000
MaxIdleConnsPerHost = 100
[Ibex]
Address = "http://127.0.0.1:10090"
BasicAuthUser = "ibex"
BasicAuthPass = "ibex"
Timeout = 3000

### Relevant logs

```text
[mysql] 2022/06/29 09:08:25 packets.go:123: closing bad idle connection: unexpected read from socket
[mysql] 2022/06/29 09:08:25 connection.go:173: driver: bad connection
[mysql] 2022/06/29 09:08:25 packets.go:123: closing bad idle connection: unexpected read from socket
[mysql] 2022/06/29 09:08:25 connection.go:173: driver: bad connection


### System info

centos7,n9e v5.9.3

### Steps to reproduce

1.浏览器打开夜莺,点开监控看图,出现404.
<img width="781" alt="80346d1692b544d3259a07fa6f41f64" src="https://user-images.githubusercontent.com/34021474/176331612-7c131b08-932f-4899-ae8a-5410c6bc0979.png">

### Expected behavior

出现正常的界面

### Actual behavior

出现404

### Additional info

Redis 6.0.16,MySQL8.0.27 
UlricQin commented 2 years ago

你用的什么时序库?Prometheus?还是VictoriaMetrics?

fsckzy commented 2 years ago

你用的什么时序库?Prometheus?还是VictoriaMetrics?

Prometheus。已开启--enable-feature=remote-write-receiver,看这个报错像是go的MySQL驱动有问题。

fsckzy commented 2 years ago

https://blog.csdn.net/csdnhsh/article/details/116077848

UlricQin commented 2 years ago

MySQL如果有问题,理论上你连登录都登录不了,因为登录就要连数据库去检验用户名和密码。

1,打开chrome开发者工具,看看哪个接口404了 2,请求你的prometheus的接口看看返回什么,贴一下 curl http://prom-server:9090/api/v1/label/__name__/values

fsckzy commented 2 years ago

返回404,我手上两个Prometheus都是404 image

c35a5dc0db71df765862dec0ca26575

image

fsckzy commented 2 years ago

我们的Prometheus是ip:9090/prometheus,而配置文件里默认的是ip:9090,所以当n9e去调取Prometheus的时候,就会调不到,需要把地址修改正常并重启n9e