openGauss学习笔记-289 openGauss AI特性-AI4DB数据库自治运维-DBMind的支持组件-Prometheus Exporter组件-

86 阅读7分钟

openGauss学习笔记-289 openGauss AI特性-AI4DB数据库自治运维-DBMind的支持组件-Prometheus Exporter组件-命令参考及其它289.1 获取帮助289.2 命令参考289.3 常见问题处理

openGauss学习笔记-289 openGauss AI特性-AI4DB数据库自治运维-DBMind的支持组件-Prometheus Exporter组件-命令参考及其它

289.1 获取帮助

用户可以通过–help命令获取帮助信息,例如:

gs_dbmind component opengauss_exporter --help
gs_dbmind component reprocessing_exporter --help
gs_dbmind component cmd_exporter --help

289.2 命令参考

reprocessing-exporter的使用帮助详情:

gs_dbmind component reprocessing_exporter --help
usage:  [-h] [--disable-https] [--ssl-keyfile SSL_KEYFILE] [--ssl-certfile SSL_CERTFILE] [--ssl-ca-file SSL_CA_FILE] [--web.listen-address WEB.LISTEN_ADDRESS] [--web.listen-port WEB.LISTEN_PORT]
        [--collector.config COLLECTOR.CONFIG] [--log.filepath LOG.FILEPATH] [--log.level {debug,info,warn,error,fatal}] [-v]
        prometheus_host prometheus_port
​
Reprocessing Exporter: A re-processing module for metrics stored in the Prometheus server.
​
positional arguments:
  prometheus_host       from which host to pull data
  prometheus_port       the port to connect to the Prometheus host
​
optional arguments:
  -h, --help            show this help message and exit
  --disable-https       disable Https scheme
  --ssl-keyfile SSL_KEYFILE
                        set the path of ssl key file
  --ssl-certfile SSL_CERTFILE
                        set the path of ssl certificate file
  --ssl-ca-file SSL_CA_FILE
                        set the path of ssl ca file
  --web.listen-address WEB.LISTEN_ADDRESS
                        address on which to expose metrics and web interface
  --web.listen-port WEB.LISTEN_PORT
                        listen port to expose metrics and web interface
  --collector.config COLLECTOR.CONFIG
                        according to the content of the yaml file for metric collection
  --log.filepath LOG.FILEPATH
                        the path to log
  --log.level {debug,info,warn,error,fatal}
                        only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal]
  -v, --version         show program's version number and exit

表 1 reprocessing-exporter的命令行参数详情表

参数参数说明取值范围
prometheus_hostPrometheus-server的IP地址-
prometheus_portPrometheus-server的服务侦听端口号1024-65535
-h, --help帮助选项-
--disable-https禁用Https协议-
--ssl-keyfileHttps协议使用的证书私钥文件路径-
--ssl-certfileHttps协议使用的证书文件路径-
--ssl-ca-fileHttps协议使用的CA证书文件路径
--web.listen-address该exporter服务的绑定IP-
--web.listen-port该exporter服务的侦听端口1024-65535
--collector.config显性指定的待采集指标配置文件路径-
--log.filepath日志文件保存路径,默认保存在当前目录下-
--log.level日志文件的打印级别,默认为INFO级别debug, info, warn, error, fatal
--version显示版本信息-

openGauss-exporter的使用帮助详情:

gs_dbmind component opengauss_exporter --help
usage:  [-h] --url URL [--config-file CONFIG_FILE] [--include-databases INCLUDE_DATABASES] [--exclude-databases EXCLUDE_DATABASES] [--constant-labels CONSTANT_LABELS]
        [--web.listen-address WEB.LISTEN_ADDRESS] [--web.listen-port WEB.LISTEN_PORT] [--disable-cache] [--disable-settings-metrics]
        [--disable-statement-history-metrics] [--disable-https] [--disable-agent] [--ssl-keyfile SSL_KEYFILE] [--ssl-certfile SSL_CERTFILE] [--ssl-ca-file SSL_CA_FILE] [--parallel PARALLEL]
        [--log.filepath LOG.FILEPATH] [--log.level {debug,info,warn,error,fatal}] [-v]
​
openGauss Exporter (DBMind): Monitoring or controlling for openGauss.
​
optional arguments:
  -h, --help            show this help message and exit
  --url URL             openGauss database target url. It is recommended to connect to the postgres database through this URL, so that the exporter can actively discover and monitor other databases.
  --config-file CONFIG_FILE, --config CONFIG_FILE
                        path to config file.
  --include-databases INCLUDE_DATABASES
                        only scrape metrics from the given database list. a list of label=value separated by comma(,).
  --exclude-databases EXCLUDE_DATABASES
                        scrape metrics from the all auto-discovered databases excluding the list of database. a list of label=value separated by comma(,).
  --constant-labels CONSTANT_LABELS
                        a list of label=value separated by comma(,).
  --web.listen-address WEB.LISTEN_ADDRESS
                        address on which to expose metrics and web interface
  --web.listen-port WEB.LISTEN_PORT
                        listen port to expose metrics and web interface
  --disable-cache       force not using cache.
  --disable-settings-metrics
                        not collect pg_settings.yml metrics.
  --disable-statement-history-metrics
                        not collect statement-history metrics (including slow queries).
  --disable-https       disable Https scheme
  --disable-agent       by default, this exporter also assumes the role of DBMind-Agent, that is, executing database operation and maintenance actions issued by the DBMind service. With this argument,
                        users can disable the agent functionality, thereby prohibiting the DBMind service from making changes to the database.
  --ssl-keyfile SSL_KEYFILE
                        set the path of ssl key file
  --ssl-certfile SSL_CERTFILE
                        set the path of ssl certificate file
  --ssl-ca-file SSL_CA_FILE
                        set the path of ssl ca file
  --parallel PARALLEL   not collect pg_settings.yml metrics.
  --log.filepath LOG.FILEPATH
                        the path to log
  --log.level {debug,info,warn,error,fatal}
                        only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal]
  -v, --version         show program's version number and exit

表 2 openGauss-exporter的命令行参数详情表

参数参数说明取值范围
--url数据库server的连接地址,例如 postgres://user:pwd@host:port/dbname如果该url涉及到的各字段URL包含特殊字符(如@, /等),则需要通过URL编码进行转义,例如密码中的"@"应转义为%40, "/"应转义为%2F. 否则各字段的含义会被错误识别和切分,具体转义规则可以参考URL编码的转义规则, 该URL地址规则遵循RFC-1738标准。
--constant-labels常量列表,k=v格式,用逗号隔开,表明该exporter自带的常量标签格式如cluster_name=demo,cluster_id=1
-h, --help帮助选项-
--disable-https禁用Https协议-
--ssl-keyfileHttps协议使用的证书私钥文件路径-
--ssl-certfileHttps协议使用的证书文件路径-
--ssl-ca-fileHttps协议使用的CA证书文件路径-
--web.listen-address该exporter服务的绑定IP-
--web.listen-port该exporter服务的侦听端口1024-65535
--config, --config-file显性指定的待采集指标配置文件路径-
--log.filepath日志文件保存路径,默认保存在当前目录下-
--log.level日志文件的打印级别,默认为INFO级别debug, info, warn, error, fatal
--version显示版本信息-
--disable-cache禁止使用缓存-
--disable-settings-metrics禁止采集pg_settings表的值-
--disable-statement-history-metrics禁止收集statement_history表中的慢SQL信息-
--disable-agent禁止agent行为-
--include-databases显性表明仅采集的数据库名,指定多个数据库时用逗号(,)隔开-
--exclude-databases显性表明不监控的数据库名,指定多个数据库时用逗号(,)隔开-
--parallel连接到openGauss的数据库连接池的大小正整数

cmd-exporter的使用帮助详情:

usage:  [-h] [--constant-labels CONSTANT_LABELS]
                   [--web.listen-address WEB.LISTEN_ADDRESS]
                   [--web.listen-port WEB.LISTEN_PORT]
                   [--disable-https]
                   [--config CONFIG] [--ssl-keyfile SSL_KEYFILE]
                   [--ssl-certfile SSL_CERTFILE] [--ssl-ca-file SSL_CA_FILE]
                   [--parallel PARALLEL] [--log.filepath LOG.FILEPATH]
                   [--log.level {debug,info,warn,error,fatal}] [-v]
​
Command Exporter (DBMind): scrape metrics by performing shell commands.
​
optional arguments:
  -h, --help            show this help message and exit
  --constant-labels CONSTANT_LABELS
                        a list of label=value separated by comma(,).
  --web.listen-address WEB.LISTEN_ADDRESS
                        address on which to expose metrics and web interface
  --web.listen-port WEB.LISTEN_PORT
                        listen port to expose metrics and web interface
  --disable-https       disable Https scheme
  --config CONFIG       path to config dir or file.
  --ssl-keyfile SSL_KEYFILE
                        set the path of ssl key file
  --ssl-certfile SSL_CERTFILE
                        set the path of ssl certificate file
  --ssl-ca-file SSL_CA_FILE
                        set the path of ssl ca file
  --parallel PARALLEL   performing shell command in parallel.
  --log.filepath LOG.FILEPATH
                        the path to log
  --log.level {debug,info,warn,error,fatal}
                        only log messages with the given severity or above.
                        Valid levels: [debug, info, warn, error, fatal]
  -v, --version         show program's version number and exit

表 3 cmd-exporter的命令行参数详情表

参数参数说明取值范围
-h, --help帮助选项-
--disable-https禁用Https协议-
--ssl-keyfileHttps协议使用的证书私钥文件路径-
--ssl-certfileHttps协议使用的证书文件路径-
--ssl-ca-fileHttps协议使用的CA证书文件路径
--web.listen-address该exporter服务的绑定IP-
--web.listen-port该exporter服务的侦听端口1024-65535
--config显性指定的待采集指标配置文件路径默认是该功能yamls目录下的default.yml文件,可以参考该配置文件格式,错误配置会报错
--log.filepath日志文件保存路径,默认保存在当前目录下-
--log.level日志文件的打印级别,默认为INFO级别debug, info, warn, error, fatal
--parallel并行执行shell命令的并发度正整数
--constant-labels常量列表,k=v格式,用逗号隔开,表明该exporter自带的常量标签格式如cluster_name=demo,cluster_id=1
--version显示版本信息-

289.3 常见问题处理

  1. 提示需要用户提供–ssl-keyfile与–ssl-certfile选项:

    上述exporter默认采用Https模式通信,因此需要用户指定证书及其私钥文件的路径。相反,如果用户只想采用Http模式,则需要显性给定–disable-https选项,从而禁用Https协议。

  2. 提示用户需要输入PEM密码(Enter PEM pass phrase):

    如果用户采用Https模式,并给定了证书及其秘钥文件的路径,且该秘钥文件是经过加密的,则需要用户输入该加密私钥证书文件的密码。该密码也可以通过标准输入流传递。

👍 点赞,你的认可是我创作的动力!

⭐️ 收藏,你的青睐是我努力的方向!

✏️ 评论,你的意见是我进步的财富!

img