普罗米修斯监控openGauss

普罗米修斯监控openGauss1、前期准备1.1项目依赖链接依赖开源工程工程链接普罗米修斯https://github.com/prometheus/pushgatewayopengauss_exporthttps://github.com/enmotech/opengauss_exporterpushgatewayhttps://github.com/prometheus/pushgatewayopenGausshttps://gitee.com/opengauss/openGauss

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

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采集和发送

''' 功能描述:在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的使用

cd pushgateway-1.2.0.linux-arm64
./pushgateway

​ 网页显示效果如下:
在这里插入图片描述

2.3 opengauss_exporter的使用

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的使用

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的使用

yum install grafana-7.1.5-1.aarch64.rpm
service grafana-server start

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

​ 数据源的配置
在这里插入图片描述
Dashboard的导入

openGauss_exporter工程 界面模板路径如下
opengauss_exporter-master\opengauss_exporter-master\dashboard\
模板也可根据自己需求灵活配置

​ 界面效果如下
在这里插入图片描述
tpmC显示panel的添加
在这里插入图片描述

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

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

(0)
上一篇 2022年7月19日 上午8:16
下一篇 2022年7月19日 上午8:16


相关推荐

  • 亿图图示 mac 激活码【最新永久激活】2022.02.09

    (亿图图示 mac 激活码)这是一篇idea技术相关文章,由全栈君为大家提供,主要知识点是关于2021JetBrains全家桶永久激活码的内容IntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,下面是详细链接哦~https://javaforall.net/100143.html4KDDGND3CI-eyJsaWN…

    2022年4月1日
    2.7K
  • 0X7FFFFFFF,0X80000000「建议收藏」

    #include#include//INT_MAX与INT_MIN的头文件usingnamespacestd;intmain(){cout<<0x7FFFFFFF<

    2022年4月15日
    42
  • TS助手 v3.52 视频网站下载工具,网页视频下载神器

    TS助手 v3.52 视频网站下载工具,网页视频下载神器TS的全称则是TransportStream,即传输流,DVD节目中的MPEG2格式,是MPEG2-PS,MPEG2-TS格式的特点就是要求从视频流的任一片段开始都是可以独立解码的,m3u8是一个TS切片列表文件,它记录视频的每个切片的时长与顺序。现主流视频网站都采用这种模式。正因为如此,很多网友遇到这种TS传输流的视频,就有点束手无策了,今天给大家带来的这款TS助手可以轻松帮大家解决视频…

    2022年7月18日
    21
  • python连接数据库失败_python连接数据库失败怎么解决

    python连接数据库失败_python连接数据库失败怎么解决Python 连接数据库失败怎么解决 什么是 PyMySQL PyMySQL 是在 Python3 x 版本中用于连接 MySQL 服务器的一个库 Python2 中则使用 mysqldb PyMySQL 遵循 Python 数据库 APIv2 0 规范 并包含了 pure PythonMySQL 客户端库 在使用 PyMySQL 之前 我们需要确保 PyMySQL 已安装 PyMySQL 下载地

    2026年3月19日
    2
  • BP 神经网络算法原理[通俗易懂]

    BP 神经网络算法原理[通俗易懂]本篇文章主要根据《神经网络与机器学习》和《人工神经网络原理》两本书,对BP神经网络的数学推导过程做了一个总结,为自己进入深度学习打下一个基础。

    2022年6月23日
    39
  • java获取当前日期时间的方法_java比较日期大小

    java获取当前日期时间的方法_java比较日期大小本文主要简单的介绍一下获取当前日期时间的方法,并不涉及其他~~java中获取当前日期的方法一般有3种1、通过java.util包下的Calendar类获取。2、通过java.util包下的Date类获取。3、通过java.time包下的API。一、通过Calendar获取 Calendarc=Calendar.getInstance(); intyear=

    2025年6月29日
    5

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号