首页 > 其他分享 >openGauss监控之exporter部署

openGauss监控之exporter部署

时间:2024-03-14 17:56:35浏览次数:23  
标签:exporter -- 数据库 监控 openGauss opengauss md5

openGauss 监控之 exporter 部署

概述

opengauss_exporter 是为 openGauss 数据库量身打造的数据采集工具,配合当前最受欢迎的监控报警框架 prometheus + grafana 组合实时展示数据库信息,为 openGauss 数据库的平稳运行保驾护航。opengauss_exporter 同 openGauss 数据库一样是开源的,源码下载地址:https://gitee.com/enmotech/opengauss_exporter。

提示

  • opengauss_exporter 目前只能通过 md5 的加密方式访问 openGauss 数据库。
  • openGauss 出于安全考虑,某些数据非管理员账号无法访问。
  • opengauss_exporter 直接建立连接到你关注的的数据库,否则会获取不到数据。

参数介绍

# ./opengauss_exporter --help
usage: opengauss_exporter_0318 [<flags>]

Flags:
  --help                        Show context-sensitive help (also try --help-long and --help-man).
  --version                     Show application version.
  --url=""                      openGauss database target url
  --config=""                   path to config dir or file.
  --constantLabels=""           A list of label=value separated by comma(,).
  --disable-cache               force not using cache
  --auto-discover-databases     Whether to discover the databases on a server dynamically.
  --exclude-databases="template0,template1"
                                A list of databases to remove when autoDiscoverDatabases is enabled
  --namespace="pg"              prefix of built-in metrics, (og) by default
  --web.listen-address=":9187"  Address to listen on for web interface and telemetry.
  --web.telemetry-path="/metrics"
                                Path under which to expose metrics.
  --time-to-string              convert database timestamp to date string.
  --dry-run                     dry run and print default configs and user config
  --disable-settings-metrics    Do not include pg_settings metrics.
  --explain                     explain server planned queries
  --parallel=5                  Specify the parallelism. the degree of parallelism is now useful query database thread
  --log.level="info"            Only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal]
  --log.format="logger:stderr"  Set the log target and format. Example: "logger:syslog?appname=bob&local=7" or "logger:stdout?json=true"

数据库配置

修改参数

openGauss 默认加密方式是 sha256,需要改成 md5 的密码加密方式。

方式一:直接修改 postgresql.conf 参数文件

password_encryption_type=1

重新加载数据库

gsql -p $port postgres -r -c “select pg_reload_conf();”

方式二:使用集群管理工具

gs_guc reload -I all -N all -c "password_encryption_type=1"

创建数据库

数据库兼容 PG 模式,在 PG 数据库中’’ != null

create database ogexporter DBCOMPATIBILITY='PG';

创建用户

  • 1.0.1 版本的数据库,创建用户需要带有 sysadmin 权限。
  • 1.1.0 版本的数据库,创建用户需要带有 monadmin 权限的。
  • 密码复杂度需要符合数据库密码策略。
CREATE USER opengauss_exporter WITH PASSWORD 'opengauss_exporter123' MONADMIN;

赋权

根据需要采集数据所在的表或视图,给相应的访问权限。

grant usage on schema dbe_perf to opengauss_exporter;
grant select on pg_stat_replication to opengauss_exporter;

访问控制

将 opengauss_exporter 部署服务器的 ip 地址以 md5 的加密方式加入白名单;

如果是部署在本地服务器,需要以 md5 的方式添加在 host all all .../32 trust 前面,

否则会有 FATAL:Forbid remote connection with trust method! 报错

方式一:直接修改 pg_hba.conf 文件,不需要加载

host dbname opengauss_exporter x.x.x.x/32 md5

方式二:使用管理工具

gs_guc reload -I all -N all -h "host dbname opengauss_exporter x.x.x.x/32 md5"

安装部署

配置环境变量

将以下配置添加到~/.bashrc 文件,也可以在每次执行命令前执行。

export DATA_SOURCE_NAME="host=x.x.x.x user=opengauss_exporter password=opengauss_exporter123 port=9832 dbname=og_pg sslmode=disable"

启动 opengauss_exporter

将编译好的二进制文件 opengauss_exporter 放到目录/opt/opengauss_exporter/下,以 nohup 的方式启动。

nohup /opt/opengauss_exporter/opengauss_exporter --config="/opt/opengauss_exporter/default_queries.yaml" --log.level=debug &

检验

确保防火墙关闭,如果防火墙打开,则需要开通 9187 端口。

在浏览器输入服务器 ip 及 exporter 端口号,如:http://...:9187//metrics

展示效果如下:

标签:exporter,--,数据库,监控,openGauss,opengauss,md5
From: https://www.cnblogs.com/renxyz/p/18073578

相关文章

  • APUE-树莓派温度监控项目-断线重连
    1、说明客户端需要实现一下功能如果网络socket异常(如网络断线、服务器端退出),在网络故障恢复后客户端程序能够自动重连;在网络故障出错期间,定时采样正常进行,在此瞬间所有采样的数据(临时存储到SQLite数据库中;网络故障恢复之后,客户端程序自动将之前暂存到数据库中的数据上报销......
  • 云监控告警2.0:革新传统告警机制,引领智能化监控新时代
    本文分享自天翼云开发者社区《云监控告警2.0:革新传统告警机制,引领智能化监控新时代》,作者:每日知识小分享随着云计算技术的飞速发展,云服务已成为企业IT架构的重要组成部分。为了确保云服务的稳定、高效运行,云监控告警机制扮演着至关重要的角色。传统的云监控告警机制在应对复杂多......
  • MogDB openGauss 角色切换后sequence为什么不连续
    本文出处:https://www.modb.pro/db/569272背景今天在客户现场做高可用切换测试,为了验证数据库节点角色切换后无数据丢失,我单独创建一张使用了自增sequence的表,通过vip方式访问数据库,并1s插入一条数据。因为数据库本身是通过benchmarksql工具加压的,数据库服务器的CPU使......
  • MogDB openGauss wal日志解析工具 mog_xlogdump
    MogDB/openGausswal日志解析工具mog_xlogdump本文出处:https://www.modb.pro/db/398124概述mog_xlogdump是云和恩墨独立开发的wal日志离线解析工具。熟悉PG的小伙伴应该都使用pg_xlogdump/pg_waldump查看过PG数据库的wal文件,解析的wal数据结果是没有办法直接拿......
  • MogDB-openGauss default privileges 使用方法
    MogDB/openGaussdefaultprivileges使用方法权限是用户访问数据库对象的首要条件,每个新增用户默认属于PUBLIC角色组成员,也就是具有PUBLIC角色组的权限,但在日常业务使用中,仅仅具有PUBLIC权限是远远不够的,还需要具有额外的权限,在MogDB/openGauss数据库支持的业务中经常需......
  • openGauss 由于RemoveIPC未关闭导致数据库crash
    openGauss由于RemoveIPC未关闭导致数据库crashsemop引发的数据库crash--主库FATAL:semop(id=xxxxx)failed:IdentifierremovedFATAL:semctl(xxxxxx,11,SETVAL,0)failed:Invalidargument--备库FATAL:semctl(xxxxxx,11,SETVAL,0)failed:InvalidargumentLOG......
  • MogDB openGauss 自定义snmptrapd告警信息
    MogDB/openGauss自定义snmptrapd告警信息本文出处:https://www.modb.pro/db/232391在之前的文章MogDB/openGauss监控告警配置介绍了如何通过alertmanager模块将报警通过snmp推送出去,但是在实际使用中,默认的报警规则信息并不能很好的满足snmp服务端的需求,需要定制化报警......
  • MogDB openGauss常用查询汇总
    MogDB/openGauss常用查询汇总概述在MogDB/openGauss日常运维过程中,会经常通过SQL来获取想要查看的信息,这些SQL可以作为监控指标、巡检指标,也可以临时查询使用。通过系统线程id查对应的query#!/bin/bashsource~/.bashrcthread_sets=`ps-ef|grep-igaussdb|g......
  • MogDB openGauss故障排查流程
    MogDB/openGauss故障排查流程前提如果有反馈说数据库响应慢或者压测过程中数据库有报错,第一步先收集数据库服务器资源使用情况,这一步是处理所有故障的前提。--负载top命令htop命令--cpulscpu命令--内存大小free-g--磁盘大小df-Th--磁盘使用跟踪nohupiostat......
  • MogDB openGauss数据库扩缩容的几种方式
    MogDB/openGauss数据库扩缩容的几种方式文本出处:https://www.modb.pro/db/453105随着业务的发展,业务系统对数据库的架构要求也在变化,比如需要读负载均衡、机房搬迁、服务器硬件替换等等,这需要在原数据库主备架构的基础上进行扩/缩容操作,目前MogDB数据库安装方式有三种,分别是......