前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >普罗米修斯监控openGauss

普罗米修斯监控openGauss

作者头像
全栈程序员站长
发布2022-09-09 11:43:28
1.3K0
发布2022-09-09 11:43:28
举报
文章被收录于专栏:全栈程序员必看

大家好,又见面了,我是你们的朋友全栈君。

1、前期准备

1.1项目依赖链接

依赖开源工程

工程链接

普罗米修斯

https://github.com/prometheus/pushgateway

opengauss_export

https://github.com/enmotech/opengauss_exporter

pushgateway

https://github.com/prometheus/pushgateway

openGauss

https://gitee.com/opengauss/openGauss-server

1.2 工具包准备

系统环境

工具版本

ARM+openEuler

prometheus-2.21.0.linux-arm64.tar.gz、pushgateway-1.2.0.linux-arm64.tar.gz、grafana-7.1.5-1.aarch64.rpm

X86+openEuler

prometheus-2.21.0.linux-amd64.tar.gz、pushgateway-1.3.0.linux-amd64.tar.gz、grafana-7.2.1-1.x86_64.rpm

2、监控系统安装部署

2.1 tpmC采集和发送

代码语言:javascript
复制
''' 功能描述:在benchmarksql工具测试过程的输出信息通过tee命令 固定输出到/tmp/tpcc.log(便于在不同环境上部署),采集函数从/tmp/tpcc.log文件获取到tpmC值,发送函数将值发送到pushgateway服务。 '''
#日志信息采集并转换为tpmC
def collect_tpmc():
    log_file = "/tmp/tpcc.log"
    cmd = "tail -1 %s > /home/tpmc;awk -F ':' '{print $(NF-2)}' /home/tpmc | awk '{print $1}'" % log_file
    tpmc = os.popen(cmd).read().strip()
    tpmc = float(tpmc) * 0.45
    count_tpmc = "count_tpmc{count_tpmc=\"count_tpmc\"} " + str(tpmc) + "\n"
    print("count_tpmc : %s" %count_tpmc)
    return count_tpmc
#向pushgateway发送采集到的数据
def send_data(data_type, node):
    if data_type == "cpu":
        send_cmd = "cat {file_cpu} | curl --data-binary @- pushgateway_ip:port/metrics/job/{node}/instance/{data_type}".format(
            file_cpu=file_cpu, node=node, data_type=data_type)
    os.popen(send_cmd)

2.2 pushgateway的使用

代码语言:javascript
复制
cd pushgateway-1.2.0.linux-arm64
./pushgateway

​ 网页显示效果如下:

在这里插入图片描述
在这里插入图片描述

2.3 opengauss_exporter的使用

代码语言:javascript
复制
GO GET配置
git config --global http.proxy http://域账号:密码
git config --global https.proxy https://域账号:密码
git config --global http.sslverify false
git config --global https.sslverify false
GO MODULE配置
export GO111MODULE=on
export GOPROXY=http://***/
export GONOSUMDB=*

配置数据库白名单
host    all             all             ip      md5

配置启动opengauss_exporter
cd opengauss_exporter-master
make build
export DATA_SOURCE_NAME="postgresql://tpcc:******@ip:port/tpcc?sslmode=disable"
./bin/opengauss_exporter --config="og_exporter_default.yaml"
注:默认端口为9187

​ 启动效果

在这里插入图片描述
在这里插入图片描述

2.4 prometheus的使用

代码语言:javascript
复制
prometheus.yml 文件配置参考
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
    - targets: ['prometheus_ip:9090']

  - job_name: 'pushgateway'
    static_configs:
    - targets: ['pushgateway_ip:9091']
      labels:
        instance: pushgateway

  - job_name: 'opgs_report'
    static_configs:
    - targets: ['opgs_report:9187']
      labels:
        instance: opgs_report
 
 #启动方式
 ./prometheus

​ 启动效果

在这里插入图片描述
在这里插入图片描述

2.5 grafana的使用

代码语言:javascript
复制
yum install grafana-7.1.5-1.aarch64.rpm
service grafana-server start

网访问prometheus_ip:3000
初始用户名密码均为admin

​ 数据源的配置

在这里插入图片描述
在这里插入图片描述

Dashboard的导入

代码语言:javascript
复制
openGauss_exporter工程 界面模板路径如下
opengauss_exporter-master\opengauss_exporter-master\dashboard\
模板也可根据自己需求灵活配置

​ 界面效果如下

在这里插入图片描述
在这里插入图片描述

tpmC显示panel的添加

在这里插入图片描述
在这里插入图片描述

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/161777.html原文链接:https://javaforall.cn

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1、前期准备
    • 1.1项目依赖链接
      • 1.2 工具包准备
      • 2、监控系统安装部署
        • 2.1 tpmC采集和发送
          • 2.2 pushgateway的使用
            • 2.3 opengauss_exporter的使用
              • 2.4 prometheus的使用
                • 2.5 grafana的使用
                相关产品与服务
                Grafana 服务
                Grafana 服务(TencentCloud Managed Service for Grafana,TCMG)是腾讯云基于社区广受欢迎的开源可视化项目 Grafana ,并与 Grafana Lab 合作开发的托管服务。TCMG 为您提供安全、免运维 Grafana 的能力,内建腾讯云多种数据源插件,如 Prometheus 监控服务、容器服务、日志服务 、Graphite 和 InfluxDB 等,最终实现数据的统一可视化。
                领券
                问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档