-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
zhangsong
committed
Sep 6, 2018
1 parent
f3cf302
commit bc6bd7c
Showing
12 changed files
with
287 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package hack | ||
|
||
const ( | ||
Version = "2018-06-11 17:46:38 +0800 @d861c77" | ||
Compile = "2018-09-04 19:53:20 +0800 by go version go1.9 darwin/amd64" | ||
Version = "2018-09-05 09:47:25 +0800 @d56c0ec" | ||
Compile = "2018-09-05 20:38:10 +0800 by go version go1.9 darwin/amd64" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# prometheus的使用 | ||
|
||
## 系统架构 | ||
|
||
prometheus系统架构可参考下面这幅图。 | ||
![prometheus系统架构](./prometheus.png) | ||
|
||
## 下载并运行 | ||
|
||
[下载](https://github.com/prometheus/prometheus/releases)Prometheus,然后提取并运行: | ||
|
||
``` | ||
tar xvfz prometheus-*.tar.gz | ||
cd prometheus-* | ||
./prometheus | ||
``` | ||
|
||
## 配置yml | ||
|
||
根据文档进行yml配置文件的配置,此处不再多解释。 | ||
|
||
[完整配置文档](https://prometheus.io/docs/prometheus/latest/configuration/configuration/) | ||
|
||
kingshard暴露了9708端口作为prometheus的抓取地址,因此通过http://localhost:8080/metrics可以获取到相关监控项,端口可在配置文件进行变更。 | ||
|
||
## 启动 | ||
|
||
根据上述的配置文件启动prometheus | ||
|
||
``` | ||
./prometheus -config.file=prometheus.yml | ||
``` | ||
|
||
## 监控项解释 | ||
|
||
除了golang本身的监控项外,主要提供了以下的监控项。 | ||
|
||
### idle监控项 | ||
|
||
标明了当前系统中idle连接的数目,正常为最大连接减去cache连接的数目 | ||
|
||
``` | ||
# HELP idleConn the db idle connection | ||
# TYPE idleConn gauge | ||
idleConn{addr="10.10.60.189:3306",type="master"} 384 | ||
idleConn{addr="10.10.60.189:3307",type="slave"} 384 | ||
idleConn{addr="10.10.60.189:3308",type="slave"} 384 | ||
``` | ||
|
||
### cache监控项 | ||
|
||
标明了当前系统中cache连接的数目,正常为最大连接减去idle连接的数目,负载不大的系统该项变化应该不大 | ||
|
||
``` | ||
# HELP cacheConns the db cache connection | ||
# TYPE cacheConns gauge | ||
cacheConns{addr="10.10.60.189:3306",type="master"} 128 | ||
cacheConns{addr="10.10.60.189:3307",type="slave"} 128 | ||
cacheConns{addr="10.10.60.189:3308",type="slave"} 128 | ||
``` | ||
|
||
### maxConn监控项 | ||
|
||
标明了当前系统中配置的maxConn数量 | ||
|
||
``` | ||
# HELP maxConn the max connection config | ||
# TYPE maxConn gauge | ||
maxConn{addr="10.10.60.189:3306",type="master"} 512 | ||
maxConn{addr="10.10.60.189:3307",type="slave"} 512 | ||
maxConn{addr="10.10.60.189:3308",type="slave"} 512 | ||
``` | ||
|
||
### pushConnCount监控项 | ||
|
||
标明了当前系统中往连接池中推入连接的次数,用于排查异常情况 | ||
|
||
``` | ||
# HELP pushConnCount the db pushConnCount | ||
# TYPE pushConnCount gauge | ||
pushConnCount{addr="10.10.60.189:3306",type="master"} 512 | ||
pushConnCount{addr="10.10.60.189:3307",type="slave"} 512 | ||
pushConnCount{addr="10.10.60.189:3308",type="slave"} 512 | ||
``` | ||
|
||
### popConnCount监控项 | ||
|
||
标明了当前系统中从连接池中取出连接的次数,用于排查异常情况 | ||
|
||
``` | ||
# HELP popConnCount the db popConnCount | ||
# TYPE popConnCount gauge | ||
popConnCount{addr="10.10.60.189:3306",type="master"} 0 | ||
popConnCount{addr="10.10.60.189:3307",type="slave"} 0 | ||
popConnCount{addr="10.10.60.189:3308",type="slave"} 0 | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.