Skip to content

Commit

Permalink
prepare for public
Browse files Browse the repository at this point in the history
  • Loading branch information
lifuzhou committed Feb 23, 2022
0 parents commit 9e3dada
Show file tree
Hide file tree
Showing 38 changed files with 20,354 additions and 0 deletions.
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
- **todis 使用的 grafana 和 prometheus 安装脚本,安装在 todis 主机上;**
- **请勿在已有 grafana 和 prometheus 服务的主机上执行脚本。**
- 操作系统支持centos 8 和阿里云 ecs 系统,其他系统未测试。

# 1、安装
cd install; 执行`sh install.sh`即可完成安装。

配置内容在 config.sh,如下示例:
```
grafana_admin_password=1234567
enable_admin_dashboard=false # false or anything
function server_config() {
# server config
prometheus_port=9090
prometheus_listen_port=9090
prometheus_host=localhost
grafana_host=localhost
grafana_port=3000
todis_host=localhost
todis_port=8000
}
```
- grafana_admin_password 是 grafana 的管理员密码,安装过程会修改 admin 的默认密码 admin 为 grafana_admin_password 的内容;
- enable_admin_dashboard 设置是否安装两个管理员可见的 dashboard,注意是主机状态和进程状态监控,默认不安装,非 false 表示安装;
- prometheus_port 是 prometheus 外部访问端口;
- prometheus_listen_port 是 prometheus 的启动参数设置端口,该设置是为了适应 docker 环境的端口映射,如果是使用一般主机设置和 prometheus_port 相同即可;
- prometheus_host 主机地址;
- grafana_port 监听端口设置;
- **todis_host todis 主机地址;**
- **todis_port todis 主机 http 接口端口号。**

主要是 todis_host 和 todis_port 对应 todis 的相关配置即可。
### 安装过程可能创建目录
```
/usr/local/node-exporter
/usr/local/process-exporter
/usr/local/grafana
/usr/local/prometheus
/data/prometheus
```

# 2、grafana 扩展功能
histogram 的 dashboard 使用了我们自己扩展的 grafana 功能,详细内容参见[针对 Grafana 监控效果的一个改进](https://blog.topling.cn/posts/%E9%92%88%E5%AF%B9%20Grafana%20%E7%9B%91%E6%8E%A7%E6%95%88%E6%9E%9C%E7%9A%84%E4%B8%80%E4%B8%AA%E6%94%B9%E8%BF%9B/)

92 changes: 92 additions & 0 deletions install/config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#!/bin/bash

grafana_admin_password=1234567
enable_admin_dashboard=false # false or anything

function server_config() {
#server config
todis_host=localhost
todis_port=8000
prometheus_port=9090
prometheus_listen_port=9090
prometheus_host=localhost
grafana_host=localhost
grafana_port=3000
}

function local_config() {
#local docker config
todis_host=192.168.31.3
todis_port=55001
prometheus_port=55003
prometheus_listen_port=10003
prometheus_host=192.168.31.3
grafana_host=localhost
grafana_port=10005
}

function grafana_install_config() {
#local docker config
todis_host=192.168.31.3
todis_port=55001
prometheus_port=55091
prometheus_listen_port=10001
prometheus_host=192.168.31.3
grafana_host=localhost
grafana_port=10002
}

function toplingdb_config() {
#local docker config
todis_host=192.168.31.3
todis_port=55125
prometheus_port=55121
prometheus_listen_port=10001
prometheus_host=192.168.31.3
grafana_host=localhost
grafana_port=10002
}

function oauth_config() {
#local docker config
todis_host=192.168.31.3
todis_port=55001
prometheus_port=55111
prometheus_listen_port=10001
prometheus_host=192.168.31.3
grafana_host=localhost
grafana_port=10002
}

function dell1_config() {
#local config dell1
todis_host=192.168.100.10
todis_port=2011
prometheus_port=55081
prometheus_listen_port=10001
prometheus_host=192.168.31.3
grafana_host=localhost
grafana_port=10002
}

function check_user() {
if test "$USER" != "root"; then
echo ""
echo "need root"
echo ""
exit
fi
}


#server_config
#local_config
#grafana_install_config
#toplingdb_config
#dell1_config
oauth_config

todis_host_port=${todis_host}:${todis_port}
prometheus_host_port=${prometheus_host}:${prometheus_port}

check_if_include_config="true"
66 changes: 66 additions & 0 deletions install/grafana_rich/dashboard/dashboard-list-base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"dashboard":{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"gnetId": null,
"graphTooltip": 0,
"id": null,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": null,
"gridPos": {
"h": 20,
"w": 24,
"x": 0,
"y": 14
},
"id": 4,
"options": {
"content": "<p><a href='https://topling.cn' target='_black'>Topling Inc.</a>当前是 grafana 展示运行状态的主页,还可修改端口为 8000 查看 web 页面展示的运行状态信息。</p><p>DB Properties 展示存储引擎的 DB::Properties 相关内容,不熟悉当作一般属性信息即可。\n <br />statistics 展示存储引擎运行状态的统计信息,用于分析运行状态。\n <br />todis-to-prometheus 指的是 todis 输出 prometheus 可识别数据格式。\n <br />histogram 展示统计占比信息,概念参考 prometheus 的 <a href='https://prometheus.io/docs/concepts/metric_types/#histogram' target='_black'>histogram</a>。<br />\n <br />展示 histogram 的 dashboard 页面右上角都有一个链接, 可以在两个 dashboard 之间跳转,不同点在于信息展示的浮动窗口内容,效果试一次就明白了。详细信息参见<a href='https://blog.topling.cn/posts/%E9%92%88%E5%AF%B9%20Grafana%20%E7%9B%91%E6%8E%A7%E6%95%88%E6%9E%9C%E7%9A%84%E4%B8%80%E4%B8%AA%E6%94%B9%E8%BF%9B/' target='_black'>针对 Grafana 监控效果的一个改进。</a><br />\n <br />每个 dashboard 对应一个 dashbosrd 页面,点击相应内容完成跳转。\n</p>\n<table>\n <thead>\n <tr>\n <th colspan=\"2\">指标类别</th>\n <th>dashboard</th>\n <th>描述</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td rowspan=\"4\" colspan=\"2\" style=\"text-align: center\">engine<br />DB Properties </td>\n <td><a href='properties-all-url'>properties all</a></td>\n <td>存储引擎的内部属性相关信息,包括一些状态信息</td>\n </tr>\n <tr>\n <td><a href='properties-cfstat-url'>properties cfstat</a></td>\n <td>cfstat 内容,引擎中 Column Family 相关属性信息</td>\n </tr>\n <tr>\n <td><a href='properties-level-url'>properties level</a></td>\n <td>level 相关内容,指定层相关的属性信息</td>\n </tr>\n <tr>\n <td><a href='properties-common-url'>properties common</a></td>\n <td>cfstat、level 之外内容</td>\n </tr>\n <tr>\n <td rowspan=\"5\" colspan=\"1\" style=\"text-align: center\">engine<br />statistics</td>\n <td rowspan=\"3\" colspan=\"1\" style=\"text-align: center\">histogram</td>\n <td><a href='engine-histogram-url'>engine histogram</a></td>\n <td>histogram 内容</td>\n </tr>\n <tr>\n <td><a href='engine-histogram-compaction-flush-url'>engine compaction</a></td>\n <td>histogram 内容中 compaction 和 flush 相关部分</td>\n </tr>\n <tr>\n <td><a href='engine-histogram-common-url'>engine common</a></td>\n <td>histogram 内容中 compaction 和 flush 之外部分</td>\n </tr>\n <tr>\n <td rowspan=\"2\" colspan=\"1\" style=\"text-align: center\">ticker</td>\n <td><a href='ticker-url'>ticker simple</a></td>\n <td>tickers 内容是引擎层的一些实时统计信息,简单展示</td>\n </tr>\n <tr>\n <td><a href='ticker-aggregate-url'>ticker aggregate</a></td>\n <td>tickers 内容,添加了自定义的合并展示</td>\n </tr>\n <tr>\n <td rowspan=\"2\" colspan=\"2\" style=\"text-align: center\">todis</td>\n <td><a href='length-histogram-url'>length histogram</a></td>\n <td>todis 中写入数据长度统计信息</td>\n </tr>\n <tr>\n <td><a href='time-histogram-url'>time histogram</a></td>\n <td>todis 中命令耗时统计信息</td>\n </tr>\n </tbody>\n</table>",
"mode": "html"
},
"pluginVersion": "8.2.4",
"title": "dashboard list",
"type": "text"
}
],
"refresh": "",
"schemaVersion": 32,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "dashboard list",
"uid": "vZDzojN7k",
"version": 13
},
"folderId": 18
}
Loading

0 comments on commit 9e3dada

Please sign in to comment.