1 Star 0 Fork 6

sunbin/openGauss-prometheus-exporter

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
og_exporter_default.yaml 75.35 KB
一键复制 编辑 原始数据 按行查看 历史
travelliu 提交于 2024-01-18 12:00 . Resubmit the code
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253
# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# ┃ pg_stat_database
# ┃ openGauss database statistics
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ TTL ┆ -1
# ┃ Timeout ┆ 1s
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ LABEL datid OID of a database
# ┃ LABEL datname Name of this database
# ┃ GAUGE numbackends Number of backends currently connected to this database. This is the only column in this view that returns a value reflecting current state; all other columns return the accumulated values since the last reset.
# ┃ COUNTER xact_commit Number of transactions in this database that have been committed
# ┃ COUNTER xact_rollback Number of transactions in this database that have been rolled back
# ┃ COUNTER blks_read Number of disk blocks read in this database
# ┃ COUNTER blks_hit Number of times disk blocks were found already in the buffer cache, so that a read was not necessary (this only includes hits in the openGauss buffer cache, not the operating system's file system cache)
# ┃ COUNTER tup_returned Number of rows returned by queries in this database
# ┃ COUNTER tup_fetched Number of rows fetched by queries in this database
# ┃ COUNTER tup_inserted Number of rows inserted by queries in this database
# ┃ COUNTER tup_updated Number of rows updated by queries in this database
# ┃ COUNTER tup_deleted Number of rows deleted by queries in this database
# ┃ COUNTER conflicts Number of queries canceled due to conflicts with recovery in this database. (Conflicts occur only on standby servers; see pg_stat_database_conflicts for details.)
# ┃ COUNTER temp_files Number of temporary files created by queries in this database. All temporary files are counted, regardless of why the temporary file was created (e.g., sorting or hashing), and regardless of the log_temp_files setting.
# ┃ COUNTER temp_bytes Total amount of data written to temporary files by queries in this database. All temporary files are counted, regardless of why the temporary file was created, and regardless of the log_temp_files setting.
# ┃ COUNTER deadlocks Number of deadlocks detected in this database
# ┃ COUNTER blk_read_time Time spent reading data file blocks by backends in this database, in milliseconds
# ┃ COUNTER blk_write_time Time spent writing data file blocks by backends in this database, in milliseconds
# ┃ COUNTER stats_reset Time at which these statistics were last reset
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ pg_stat_database_numbackends{datid,datname} GAUGE Number of backends currently connected to this database. This is the only column in this view that returns a value reflecting current state; all other columns return the accumulated values since the last reset.
# ┃ pg_stat_database_xact_commit{datid,datname} COUNTER Number of transactions in this database that have been committed
# ┃ pg_stat_database_xact_rollback{datid,datname} COUNTER Number of transactions in this database that have been rolled back
# ┃ pg_stat_database_blks_read{datid,datname} COUNTER Number of disk blocks read in this database
# ┃ pg_stat_database_blks_hit{datid,datname} COUNTER Number of times disk blocks were found already in the buffer cache, so that a read was not necessary (this only includes hits in the openGauss buffer cache, not the operating system's file system cache)
# ┃ pg_stat_database_tup_returned{datid,datname} COUNTER Number of rows returned by queries in this database
# ┃ pg_stat_database_tup_fetched{datid,datname} COUNTER Number of rows fetched by queries in this database
# ┃ pg_stat_database_tup_inserted{datid,datname} COUNTER Number of rows inserted by queries in this database
# ┃ pg_stat_database_tup_updated{datid,datname} COUNTER Number of rows updated by queries in this database
# ┃ pg_stat_database_tup_deleted{datid,datname} COUNTER Number of rows deleted by queries in this database
# ┃ pg_stat_database_conflicts{datid,datname} COUNTER Number of queries canceled due to conflicts with recovery in this database. (Conflicts occur only on standby servers; see pg_stat_database_conflicts for details.)
# ┃ pg_stat_database_temp_files{datid,datname} COUNTER Number of temporary files created by queries in this database. All temporary files are counted, regardless of why the temporary file was created (e.g., sorting or hashing), and regardless of the log_temp_files setting.
# ┃ pg_stat_database_temp_bytes{datid,datname} COUNTER Total amount of data written to temporary files by queries in this database. All temporary files are counted, regardless of why the temporary file was created, and regardless of the log_temp_files setting.
# ┃ pg_stat_database_deadlocks{datid,datname} COUNTER Number of deadlocks detected in this database
# ┃ pg_stat_database_blk_read_time{datid,datname} COUNTER Time spent reading data file blocks by backends in this database, in milliseconds
# ┃ pg_stat_database_blk_write_time{datid,datname} COUNTER Time spent writing data file blocks by backends in this database, in milliseconds
# ┃ pg_stat_database_stats_reset{datid,datname} COUNTER Time at which these statistics were last reset
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
pg_stat_database:
name: pg_stat_database
desc: openGauss database statistics
query:
- name: pg_stat_database
sql: select * from pg_stat_database where datname NOT IN ('template0','template1')
version: '>=0.0.0'
timeout: 1
ttl: -1
status: enable
dbRole: ""
metrics:
- name: datid
description: OID of a database
usage: LABEL
- name: datname
description: Name of this database
usage: LABEL
- name: numbackends
description: Number of backends currently connected to this database. This is the only column in this view that returns a value reflecting current state; all other columns return the accumulated values since the last reset.
usage: GAUGE
- name: xact_commit
description: Number of transactions in this database that have been committed
usage: COUNTER
- name: xact_rollback
description: Number of transactions in this database that have been rolled back
usage: COUNTER
- name: blks_read
description: Number of disk blocks read in this database
usage: COUNTER
- name: blks_hit
description: Number of times disk blocks were found already in the buffer cache, so that a read was not necessary (this only includes hits in the openGauss buffer cache, not the operating system's file system cache)
usage: COUNTER
- name: tup_returned
description: Number of rows returned by queries in this database
usage: COUNTER
- name: tup_fetched
description: Number of rows fetched by queries in this database
usage: COUNTER
- name: tup_inserted
description: Number of rows inserted by queries in this database
usage: COUNTER
- name: tup_updated
description: Number of rows updated by queries in this database
usage: COUNTER
- name: tup_deleted
description: Number of rows deleted by queries in this database
usage: COUNTER
- name: conflicts
description: Number of queries canceled due to conflicts with recovery in this database. (Conflicts occur only on standby servers; see pg_stat_database_conflicts for details.)
usage: COUNTER
- name: temp_files
description: Number of temporary files created by queries in this database. All temporary files are counted, regardless of why the temporary file was created (e.g., sorting or hashing), and regardless of the log_temp_files setting.
usage: COUNTER
- name: temp_bytes
description: Total amount of data written to temporary files by queries in this database. All temporary files are counted, regardless of why the temporary file was created, and regardless of the log_temp_files setting.
usage: COUNTER
- name: deadlocks
description: Number of deadlocks detected in this database
usage: COUNTER
- name: blk_read_time
description: Time spent reading data file blocks by backends in this database, in milliseconds
usage: COUNTER
- name: blk_write_time
description: Time spent writing data file blocks by backends in this database, in milliseconds
usage: COUNTER
- name: stats_reset
description: Time at which these statistics were last reset
usage: COUNTER
status: enable
ttl: -1
timeout: 1
public: true
# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# ┃ pg_downstream
# ┃ openGauss replication client count group by state
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ TTL ┆ 60
# ┃ Timeout ┆ 100ms
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ LABEL state downstream state
# ┃ GAUGE count downstream count
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ pg_downstream_count{state} GAUGE downstream count
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
pg_downstream:
name: pg_downstream
desc: openGauss replication client count group by state
query:
- name: pg_downstream
sql: |
SELECT l.state, coalesce(count, 0 ) AS count
FROM unnest(ARRAY ['Streaming','Startup','Catchup', 'Backup', 'Stopping']) l(state)
LEFT JOIN (SELECT state, count(*) AS count FROM pg_stat_replication GROUP BY state)r ON l.state = r.state
version: '>=0.0.0'
timeout: 0.1
ttl: 10
status: enable
dbRole: ""
metrics:
- name: state
description: downstream state
usage: LABEL
- name: count
description: downstream count
usage: GAUGE
status: enable
ttl: 60
timeout: 0.1
public: true
# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# ┃ pg_xact
# ┃ opengauss transaction identifier information
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ TTL ┆ 5
# ┃ Timeout ┆ 1s
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ GAUGE xmin earliest txid that is still active
# ┃ GAUGE xmax first as-yet-unassigned txid. txid >= this are invisible.
# ┃ GAUGE xnum current active transaction count
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ pg_xact_xmin{} GAUGE earliest txid that is still active
# ┃ pg_xact_xmax{} GAUGE first as-yet-unassigned txid. txid >= this are invisible.
# ┃ pg_xact_xnum{} GAUGE current active transaction count
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
pg_xact:
name: pg_xact
desc: opengauss transaction identifier information
query:
- name: pg_xact
sql: |-
WITH snap(v) AS (SELECT txid_current_snapshot()),
xset(v) AS (SELECT txid_snapshot_xip(v) FROM snap),
xnum(v) AS (SELECT count(*) from xset),
xmin(v) AS (SELECT txid_snapshot_xmin(v) FROM snap),
xmax(v) AS (SELECT txid_snapshot_xmin(v) FROM snap)
SELECT xmin.v AS xmin, xmax.v AS xmax, xnum.v AS xnum FROM xmin, xmax, xnum;
version: '>=0.0.0'
timeout: 1
ttl: 5
status: enable
dbRole: ""
metrics:
- name: xmin
description: earliest txid that is still active
usage: GAUGE
- name: xmax
description: first as-yet-unassigned txid. txid >= this are invisible.
usage: GAUGE
- name: xnum
description: current active transaction count
usage: GAUGE
status: enable
ttl: 5
timeout: 1
public: true
# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# ┃ pg_stat_activity
# ┃ openGauss backend activity group by state
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ TTL ┆ 60
# ┃ Timeout ┆ 1s
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ LABEL datname Name of this database
# ┃ LABEL state connection state
# ┃ GAUGE count number of connections in this state
# ┃ GAUGE max_duration max duration since state change among (datname, state)
# ┃ GAUGE max_tx_duration max duration in seconds any active transaction has been running
# ┃ GAUGE max_conn_duration max backend session duration since state change among (datname, state)
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ pg_stat_activity_count{datname,state} GAUGE number of connections in this state
# ┃ pg_stat_activity_max_duration{datname,state} GAUGE max duration since state change among (datname, state)
# ┃ pg_stat_activity_max_tx_duration{datname,state} GAUGE max duration in seconds any active transaction has been running
# ┃ pg_stat_activity_max_conn_duration{datname,state} GAUGE max backend session duration since state change among (datname, state)
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
pg_stat_activity:
name: pg_stat_activity
desc: openGauss backend activity group by state
query:
- name: pg_stat_activity
sql: |-
SELECT datname,
state,
coalesce(count, 0) AS count,
coalesce(max_duration, 0) AS max_duration,
coalesce(max_tx_duration, 0) AS max_tx_duration,
coalesce(max_conn_duration, 0) AS max_conn_duration
FROM (SELECT d.oid AS database, d.datname, a.state
FROM pg_database d,
unnest(ARRAY ['active','idle','idle in transaction','idle in transaction (aborted)','fastpath function call','disabled']) a(state)
WHERE d.datname NOT IN ('template0','template1')) base
LEFT JOIN (
SELECT datname, state,
count(*) AS count,
max(extract(epoch from now() - state_change)) AS max_duration,
max(extract(epoch from now() - xact_start)) AS max_tx_duration,
max(extract(epoch from now() - backend_start)) AS max_conn_duration
FROM pg_stat_activity WHERE pid <> pg_backend_pid()
GROUP BY datname, state
) a USING (datname, state);
version: '>=1.0.0'
timeout: 1
ttl: 60
status: enable
dbRole: ""
metrics:
- name: datname
description: Name of this database
usage: LABEL
- name: state
description: connection state
usage: LABEL
- name: count
description: number of connections in this state
usage: GAUGE
- name: max_duration
description: max duration since state change among (datname, state)
usage: GAUGE
- name: max_tx_duration
description: max duration in seconds any active transaction has been running
usage: GAUGE
- name: max_conn_duration
description: max backend session duration since state change among (datname, state)
usage: GAUGE
status: enable
ttl: 60
timeout: 1
public: true
# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# ┃ pg_replication_slots
# ┃
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ TTL ┆ 60
# ┃ Timeout ┆ 1s
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ LABEL slot_name Slot name
# ┃ LABEL plugin Logical plugin
# ┃ LABEL slot_type Slot type
# ┃ LABEL datoid Database oid
# ┃ LABEL database Database name
# ┃ LABEL active Is active
# ┃ LABEL xmin replication xid
# ┃ LABEL catalog_xmin logical decode xid
# ┃ LABEL restart_lsn Xlog info
# ┃ GAUGE delay_lsn delay lsn from pg_current_xlog_location()
# ┃ DISCARD dummy_standby Is real standby
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ pg_replication_slots_delay_lsn{slot_name,plugin,slot_type,datoid,database,active,xmin,catalog_xmin,restart_lsn} GAUGE delay lsn from pg_current_xlog_location()
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
pg_replication_slots:
name: pg_replication_slots
query:
- name: pg_replication_slots
sql: |-
select slot_name,
database as datname,
coalesce(plugin,'_') as plugin,
slot_type,datoid,coalesce(database,'_') as database,
active,
coalesce(xmin,'_') as xmin,
coalesce(catalog_xmin,'_') as catalog_xmin,
restart_lsn,
pg_xlog_location_diff(pg_current_xlog_location(),restart_lsn) as delay_lsn,
dummy_standby,
pg_xlog_location_diff(restart_lsn ,'0/0'::text) AS restart_lsn,
pg_xlog_location_diff(CASE WHEN pg_is_in_recovery() THEN pg_last_xlog_receive_location()
ELSE pg_current_xlog_location() END , restart_lsn) AS retained_bytes
from pg_replication_slots;
version: '>=1.0.0'
timeout: 1
ttl: 60
status: enable
dbRole: ""
metrics:
- name: slot_name
description: Slot name
usage: LABEL
- name: plugin
description: Logical plugin
usage: LABEL
- name: slot_type
description: Slot type
usage: LABEL
- name: datoid
description: Database oid
usage: LABEL
- name: database
description: Database name
usage: LABEL
- name: active
description: Is active
usage: LABEL
- name: xmin
description: replication xid
usage: LABEL
- name: catalog_xmin
description: logical decode xid
usage: LABEL
- name: restart_lsn
description: Xlog info
usage: LABEL
- name: delay_lsn
description: delay lsn from pg_current_xlog_location()
usage: GAUGE
- name: dummy_standby
description: Is real standby
usage: DISCARD
status: enable
ttl: 60
timeout: 1
public: true
# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# ┃ pg_database
# ┃ openGauss Database size
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ TTL ┆ 60
# ┃ Timeout ┆ 1s
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ LABEL datname Name of this database
# ┃ GAUGE size_bytes Disk space used by the database
# ┃ GAUGE age database age calculated by age(datfrozenxid64)
# ┃ GAUGE is_template 1 for template db and 0 for normal db
# ┃ GAUGE allow_conn 1 allow connection and 0 does not allow
# ┃ GAUGE conn_limit connection limit, -1 for no limit
# ┃ GAUGE frozen_xid tuple with xmin below this will always be visable (until wrap around)
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ pg_database_size_bytes{datname} GAUGE Disk space used by the database
# ┃ pg_database_age{datname} GAUGE database age calculated by age(datfrozenxid64)
# ┃ pg_database_is_template{datname} GAUGE 1 for template db and 0 for normal db
# ┃ pg_database_allow_conn{datname} GAUGE 1 allow connection and 0 does not allow
# ┃ pg_database_conn_limit{datname} GAUGE connection limit, -1 for no limit
# ┃ pg_database_frozen_xid{datname} GAUGE tuple with xmin below this will always be visable (until wrap around)
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
pg_database:
name: pg_database
desc: openGauss Database size
query:
- name: pg_database
sql: |-
SELECT datname,
pg_database_size(pg_database.datname) as size_bytes,
age(datfrozenxid64) AS age,
datistemplate AS is_template,
datallowconn AS allow_conn,
datconnlimit AS conn_limit,
datfrozenxid::TEXT::BIGINT as frozen_xid
FROM pg_database
where datname NOT IN ('template0','template1');
version: '>=0.0.0'
timeout: 1
ttl: 60
status: enable
dbRole: ""
metrics:
- name: datname
description: Name of this database
usage: LABEL
- name: size_bytes
description: Disk space used by the database
usage: GAUGE
- name: age
description: database age calculated by age(datfrozenxid64)
usage: GAUGE
- name: is_template
description: 1 for template db and 0 for normal db
usage: GAUGE
- name: allow_conn
description: 1 allow connection and 0 does not allow
usage: GAUGE
- name: conn_limit
description: connection limit, -1 for no limit
usage: GAUGE
- name: frozen_xid
description: tuple with xmin below this will always be visable (until wrap around)
usage: GAUGE
status: enable
ttl: 60
timeout: 1
public: true
# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# ┃ pg_checkpoint
# ┃ checkpoint information from pg_control_checkpoint since 10
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ TTL ┆ 5
# ┃ Timeout ┆ 1s
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ COUNTER checkpoint_lsn lsn of checkpoint
# ┃ COUNTER redo_lsn redo start LSN
# ┃ GAUGE tli current WAL timeline
# ┃ GAUGE prev_tli previous WAL timeline
# ┃ GAUGE full_page_writes is full page write enabled ?
# ┃ GAUGE next_xid_epoch next xid epoch since this checkpoint
# ┃ GAUGE next_xid next xid since this checkpoint
# ┃ GAUGE next_oid next object id since this checkpoint
# ┃ GAUGE next_multixact_id next multixact id of this checkpoint
# ┃ GAUGE next_multi_offset next multixact id offset of this checkpoint
# ┃ GAUGE oldest_xid oldest existing xid of the checkpoint
# ┃ GAUGE oldest_xid_dbid which db contains the oldest xid
# ┃ GAUGE oldest_active_xid oldest active xid of the checkpoint
# ┃ GAUGE oldest_multi_xid oldest active multi xid of the checkpoint
# ┃ GAUGE oldest_multi_dbid which db contins the oldest multi xid
# ┃ GAUGE oldest_commit_ts_xid xid with oldest commit ts by the checkpoint
# ┃ GAUGE newest_commit_ts_xid xid with newest commit ts by the checkpoint
# ┃ GAUGE time timestamp of this checkpoint
# ┃ GAUGE elapse time elapsed since this checkpoint in seconds
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ pg_checkpoint_checkpoint_lsn{} COUNTER lsn of checkpoint
# ┃ pg_checkpoint_redo_lsn{} COUNTER redo start LSN
# ┃ pg_checkpoint_tli{} GAUGE current WAL timeline
# ┃ pg_checkpoint_prev_tli{} GAUGE previous WAL timeline
# ┃ pg_checkpoint_full_page_writes{} GAUGE is full page write enabled ?
# ┃ pg_checkpoint_next_xid_epoch{} GAUGE next xid epoch since this checkpoint
# ┃ pg_checkpoint_next_xid{} GAUGE next xid since this checkpoint
# ┃ pg_checkpoint_next_oid{} GAUGE next object id since this checkpoint
# ┃ pg_checkpoint_next_multixact_id{} GAUGE next multixact id of this checkpoint
# ┃ pg_checkpoint_next_multi_offset{} GAUGE next multixact id offset of this checkpoint
# ┃ pg_checkpoint_oldest_xid{} GAUGE oldest existing xid of the checkpoint
# ┃ pg_checkpoint_oldest_xid_dbid{} GAUGE which db contains the oldest xid
# ┃ pg_checkpoint_oldest_active_xid{} GAUGE oldest active xid of the checkpoint
# ┃ pg_checkpoint_oldest_multi_xid{} GAUGE oldest active multi xid of the checkpoint
# ┃ pg_checkpoint_oldest_multi_dbid{} GAUGE which db contins the oldest multi xid
# ┃ pg_checkpoint_oldest_commit_ts_xid{} GAUGE xid with oldest commit ts by the checkpoint
# ┃ pg_checkpoint_newest_commit_ts_xid{} GAUGE xid with newest commit ts by the checkpoint
# ┃ pg_checkpoint_time{} GAUGE timestamp of this checkpoint
# ┃ pg_checkpoint_elapse{} GAUGE time elapsed since this checkpoint in seconds
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
pg_checkpoint:
name: pg_checkpoint
desc: checkpoint information from pg_control_checkpoint since 10
query:
- name: pg_checkpoint
sql: |-
SELECT timeline_id AS tli,
full_page_writes,
next_oid::BIGINT,
next_multixact_id::text::BIGINT,
next_multi_offset::text::BIGINT,
oldest_xid::text::BIGINT,
oldest_xid_dbid::text::BIGINT,
oldest_active_xid::text::BIGINT,
checkpoint_time AS time,
extract(epoch from now() - checkpoint_time) AS elapse
FROM pg_control_checkpoint();
version: '>=0.0.0'
timeout: 1
ttl: 5
status: enable
dbRole: ""
metrics:
- name: checkpoint_lsn
description: lsn of checkpoint
usage: COUNTER
- name: redo_lsn
description: redo start LSN
usage: COUNTER
- name: tli
description: current WAL timeline
usage: GAUGE
- name: prev_tli
description: previous WAL timeline
usage: GAUGE
- name: full_page_writes
description: is full page write enabled ?
usage: GAUGE
- name: next_xid_epoch
description: next xid epoch since this checkpoint
usage: GAUGE
- name: next_xid
description: next xid since this checkpoint
usage: GAUGE
- name: next_oid
description: next object id since this checkpoint
usage: GAUGE
- name: next_multixact_id
description: next multixact id of this checkpoint
usage: GAUGE
- name: next_multi_offset
description: next multixact id offset of this checkpoint
usage: GAUGE
- name: oldest_xid
description: oldest existing xid of the checkpoint
usage: GAUGE
- name: oldest_xid_dbid
description: which db contains the oldest xid
usage: GAUGE
- name: oldest_active_xid
description: oldest active xid of the checkpoint
usage: GAUGE
- name: oldest_multi_xid
description: oldest active multi xid of the checkpoint
usage: GAUGE
- name: oldest_multi_dbid
description: which db contins the oldest multi xid
usage: GAUGE
- name: oldest_commit_ts_xid
description: xid with oldest commit ts by the checkpoint
usage: GAUGE
- name: newest_commit_ts_xid
description: xid with newest commit ts by the checkpoint
usage: GAUGE
- name: time
description: timestamp of this checkpoint
usage: GAUGE
- name: elapse
description: time elapsed since this checkpoint in seconds
usage: GAUGE
status: enable
ttl: 5
timeout: 1
public: true
# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# ┃ pg_stat_database_conflicts
# ┃ openGauss database statistics conflicts
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ TTL ┆ 60
# ┃ Timeout ┆ 1s
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ LABEL datid OID of a database
# ┃ LABEL datname Name of this database
# ┃ COUNTER confl_tablespace Number of queries in this database that have been canceled due to dropped tablespaces
# ┃ COUNTER confl_lock Number of queries in this database that have been canceled due to lock timeouts
# ┃ COUNTER confl_snapshot Number of queries in this database that have been canceled due to old snapshots
# ┃ COUNTER confl_bufferpin Number of queries in this database that have been canceled due to pinned buffers
# ┃ COUNTER confl_deadlock Number of queries in this database that have been canceled due to deadlocks
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ pg_stat_database_conflicts_confl_tablespace{datid,datname} COUNTER Number of queries in this database that have been canceled due to dropped tablespaces
# ┃ pg_stat_database_conflicts_confl_lock{datid,datname} COUNTER Number of queries in this database that have been canceled due to lock timeouts
# ┃ pg_stat_database_conflicts_confl_snapshot{datid,datname} COUNTER Number of queries in this database that have been canceled due to old snapshots
# ┃ pg_stat_database_conflicts_confl_bufferpin{datid,datname} COUNTER Number of queries in this database that have been canceled due to pinned buffers
# ┃ pg_stat_database_conflicts_confl_deadlock{datid,datname} COUNTER Number of queries in this database that have been canceled due to deadlocks
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
pg_stat_database_conflicts:
name: pg_stat_database_conflicts
desc: openGauss database statistics conflicts
query:
- name: pg_stat_database_conflicts
sql: select * from pg_stat_database_conflicts where datname NOT IN ('template0','template1');
version: '>=0.0.0'
timeout: 1
ttl: 60
status: enable
dbRole: ""
metrics:
- name: datid
description: OID of a database
usage: LABEL
- name: datname
description: Name of this database
usage: LABEL
- name: confl_tablespace
description: Number of queries in this database that have been canceled due to dropped tablespaces
usage: COUNTER
- name: confl_lock
description: Number of queries in this database that have been canceled due to lock timeouts
usage: COUNTER
- name: confl_snapshot
description: Number of queries in this database that have been canceled due to old snapshots
usage: COUNTER
- name: confl_bufferpin
description: Number of queries in this database that have been canceled due to pinned buffers
usage: COUNTER
- name: confl_deadlock
description: Number of queries in this database that have been canceled due to deadlocks
usage: COUNTER
status: enable
ttl: 60
timeout: 1
public: true
# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# ┃ pg_stat_replication
# ┃
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ TTL ┆ 60
# ┃ Timeout ┆ 1s
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ LABEL pid unique walsender pid
# ┃ LABEL client_addr client address of wal receiver
# ┃ LABEL application_name application name of standby
# ┃ LABEL state replication state startup|catchup|streaming|backup|stopping
# ┃ LABEL sync_state replication sync state async|potential|sync|quorum
# ┃ COUNTER lsn current log position on this server
# ┃ GAUGE sent_diff last log position sent to this standby server diff with current lsn
# ┃ GAUGE write_diff last log position written to disk by this standby server diff with current lsn
# ┃ GAUGE flush_diff last log position flushed to disk by this standby server diff with current lsn
# ┃ GAUGE replay_diff last log position replayed into the database on this standby server diff with current lsn
# ┃ COUNTER sent_lsn last log position sent to this standby server
# ┃ COUNTER write_lsn last log position written to disk by this standby server
# ┃ COUNTER flush_lsn last log position flushed to disk by this standby server
# ┃ COUNTER replay_lsn last log position replayed into the database on this standby server
# ┃ GAUGE write_lag latest ACK lsn diff with write (sync-remote-write lag)
# ┃ GAUGE flush_lag latest ACK lsn diff with flush (sync-remote-flush lag)
# ┃ GAUGE replay_lag latest ACK lsn diff with replay (sync-remote-apply lag)
# ┃ GAUGE backend_uptime how long since standby connect to this server
# ┃ GAUGE backend_xmin this standby's xmin horizon reported by hot_standby_feedback.
# ┃ GAUGE sync_priority priority of being chosen as synchronous standby
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ pg_stat_replication_lsn{pid,client_addr,application_name,state,sync_state} COUNTER current log position on this server
# ┃ pg_stat_replication_sent_diff{pid,client_addr,application_name,state,sync_state} GAUGE last log position sent to this standby server diff with current lsn
# ┃ pg_stat_replication_write_diff{pid,client_addr,application_name,state,sync_state} GAUGE last log position written to disk by this standby server diff with current lsn
# ┃ pg_stat_replication_flush_diff{pid,client_addr,application_name,state,sync_state} GAUGE last log position flushed to disk by this standby server diff with current lsn
# ┃ pg_stat_replication_replay_diff{pid,client_addr,application_name,state,sync_state} GAUGE last log position replayed into the database on this standby server diff with current lsn
# ┃ pg_stat_replication_sent_lsn{pid,client_addr,application_name,state,sync_state} COUNTER last log position sent to this standby server
# ┃ pg_stat_replication_write_lsn{pid,client_addr,application_name,state,sync_state} COUNTER last log position written to disk by this standby server
# ┃ pg_stat_replication_flush_lsn{pid,client_addr,application_name,state,sync_state} COUNTER last log position flushed to disk by this standby server
# ┃ pg_stat_replication_replay_lsn{pid,client_addr,application_name,state,sync_state} COUNTER last log position replayed into the database on this standby server
# ┃ pg_stat_replication_write_lag{pid,client_addr,application_name,state,sync_state} GAUGE latest ACK lsn diff with write (sync-remote-write lag)
# ┃ pg_stat_replication_flush_lag{pid,client_addr,application_name,state,sync_state} GAUGE latest ACK lsn diff with flush (sync-remote-flush lag)
# ┃ pg_stat_replication_replay_lag{pid,client_addr,application_name,state,sync_state} GAUGE latest ACK lsn diff with replay (sync-remote-apply lag)
# ┃ pg_stat_replication_backend_uptime{pid,client_addr,application_name,state,sync_state} GAUGE how long since standby connect to this server
# ┃ pg_stat_replication_backend_xmin{pid,client_addr,application_name,state,sync_state} GAUGE this standby's xmin horizon reported by hot_standby_feedback.
# ┃ pg_stat_replication_sync_priority{pid,client_addr,application_name,state,sync_state} GAUGE priority of being chosen as synchronous standby
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
pg_stat_replication:
name: pg_stat_replication
query:
- name: pg_stat_replication
sql: |-
select
pid,
client_addr,
application_name,
state,
sync_state,
lsn,
lsn - sent_lsn as sent_diff,
lsn - write_lsn as write_diff,
lsn - flush_lsn as flush_diff,
lsn - replay_lsn as replay_diff,
sent_lsn,
write_lsn,
flush_lsn,
replay_lsn,
replay_lag,
backend_uptime,
sync_priority
from
(
select
pr.pid,
client_addr,
application_name,
pr.state,
pr.sync_state,
pg_xlog_location_diff (case when pg_is_in_recovery() then pg_last_xlog_receive_location() else pg_current_xlog_location() end, '0/0') as lsn,
pg_xlog_location_diff(pr.sender_sent_location,'0/0') as sent_lsn,
pg_xlog_location_diff(pr.receiver_write_location,'0/0') as write_lsn,
pg_xlog_location_diff(pr.receiver_flush_location,'0/0') as flush_lsn,
pg_xlog_location_diff(pr.receiver_replay_location,'0/0') as replay_lsn,
pg_xlog_location_diff(pr.receiver_replay_location, pg_current_xlog_location()) as replay_lag,
extract(EPOCH from now() - backend_start) as backend_uptime,
pr.sync_priority
from
pg_stat_replication pr
);
version: '>=1.0.0'
timeout: 1
ttl: 60
status: enable
dbRole: ""
metrics:
- name: pid
description: unique walsender pid
usage: LABEL
- name: client_addr
description: client address of wal receiver
usage: LABEL
- name: application_name
description: application name of standby
usage: LABEL
- name: state
description: replication state startup|catchup|streaming|backup|stopping
usage: LABEL
- name: sync_state
description: replication sync state async|potential|sync|quorum
usage: LABEL
- name: lsn
description: current log position on this server
usage: COUNTER
- name: sent_diff
description: last log position sent to this standby server diff with current lsn
usage: GAUGE
- name: write_diff
description: last log position written to disk by this standby server diff with current lsn
usage: GAUGE
- name: flush_diff
description: last log position flushed to disk by this standby server diff with current lsn
usage: GAUGE
- name: replay_diff
description: last log position replayed into the database on this standby server diff with current lsn
usage: GAUGE
- name: sent_lsn
description: last log position sent to this standby server
usage: COUNTER
- name: write_lsn
description: last log position written to disk by this standby server
usage: COUNTER
- name: flush_lsn
description: last log position flushed to disk by this standby server
usage: COUNTER
- name: replay_lsn
description: last log position replayed into the database on this standby server
usage: COUNTER
- name: write_lag
description: latest ACK lsn diff with write (sync-remote-write lag)
usage: GAUGE
- name: flush_lag
description: latest ACK lsn diff with flush (sync-remote-flush lag)
usage: GAUGE
- name: replay_lag
description: latest ACK lsn diff with replay (sync-remote-apply lag)
usage: GAUGE
- name: backend_uptime
description: how long since standby connect to this server
usage: GAUGE
- name: backend_xmin
description: this standby's xmin horizon reported by hot_standby_feedback.
usage: GAUGE
- name: sync_priority
description: priority of being chosen as synchronous standby
usage: GAUGE
status: enable
ttl: 60
timeout: 1
public: true
# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# ┃ pg_stat_bgwriter
# ┃ openGauss background writer metrics
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ TTL ┆ -1
# ┃ Timeout ┆ 1s
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ COUNTER checkpoints_timed scheduled checkpoints that have been performed
# ┃ COUNTER checkpoints_req requested checkpoints that have been performed
# ┃ COUNTER checkpoint_write_time time spending on writing files to disk, in µs
# ┃ COUNTER checkpoint_sync_time time spending on syncing files to disk, in µs
# ┃ COUNTER buffers_checkpoint buffers written during checkpoints
# ┃ COUNTER buffers_clean buffers written by the background writer
# ┃ COUNTER buffers_backend buffers written directly by a backend
# ┃ COUNTER maxwritten_clean times that bgwriter stopped a cleaning scan
# ┃ COUNTER buffers_backend_fsync times a backend had to execute its own fsync
# ┃ COUNTER buffers_alloc buffers allocated
# ┃ COUNTER stats_reset time when statistics were last reset
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ pg_stat_bgwriter_checkpoints_timed{} COUNTER scheduled checkpoints that have been performed
# ┃ pg_stat_bgwriter_checkpoints_req{} COUNTER requested checkpoints that have been performed
# ┃ pg_stat_bgwriter_checkpoint_write_time{} COUNTER time spending on writing files to disk, in µs
# ┃ pg_stat_bgwriter_checkpoint_sync_time{} COUNTER time spending on syncing files to disk, in µs
# ┃ pg_stat_bgwriter_buffers_checkpoint{} COUNTER buffers written during checkpoints
# ┃ pg_stat_bgwriter_buffers_clean{} COUNTER buffers written by the background writer
# ┃ pg_stat_bgwriter_buffers_backend{} COUNTER buffers written directly by a backend
# ┃ pg_stat_bgwriter_maxwritten_clean{} COUNTER times that bgwriter stopped a cleaning scan
# ┃ pg_stat_bgwriter_buffers_backend_fsync{} COUNTER times a backend had to execute its own fsync
# ┃ pg_stat_bgwriter_buffers_alloc{} COUNTER buffers allocated
# ┃ pg_stat_bgwriter_stats_reset{} COUNTER time when statistics were last reset
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
pg_stat_bgwriter:
name: pg_stat_bgwriter
desc: openGauss background writer metrics
query:
- name: pg_stat_bgwriter
sql: |-
SELECT checkpoints_timed,
checkpoints_req,
checkpoint_write_time,
checkpoint_sync_time,
buffers_checkpoint,
buffers_clean,
buffers_backend,
maxwritten_clean,
buffers_backend_fsync,
buffers_alloc,
stats_reset
FROM pg_stat_bgwriter
version: '>=0.0.0'
timeout: 1
ttl: -1
status: enable
dbRole: ""
metrics:
- name: checkpoints_timed
description: scheduled checkpoints that have been performed
usage: COUNTER
- name: checkpoints_req
description: requested checkpoints that have been performed
usage: COUNTER
- name: checkpoint_write_time
description: time spending on writing files to disk, in µs
usage: COUNTER
- name: checkpoint_sync_time
description: time spending on syncing files to disk, in µs
usage: COUNTER
- name: buffers_checkpoint
description: buffers written during checkpoints
usage: COUNTER
- name: buffers_clean
description: buffers written by the background writer
usage: COUNTER
- name: buffers_backend
description: buffers written directly by a backend
usage: COUNTER
- name: maxwritten_clean
description: times that bgwriter stopped a cleaning scan
usage: COUNTER
- name: buffers_backend_fsync
description: times a backend had to execute its own fsync
usage: COUNTER
- name: buffers_alloc
description: buffers allocated
usage: COUNTER
- name: stats_reset
description: time when statistics were last reset
usage: COUNTER
status: enable
ttl: -1
timeout: 1
public: true
# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# ┃ pg_run_times
# ┃ openGauss database run times
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ TTL ┆ 60
# ┃ Timeout ┆ 1s
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ LABEL run_name Name of cluster
# ┃ GAUGE db_role Role of database
# ┃ GAUGE run_time Run times of cluster
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ pg_run_times_db_role{run_name} GAUGE Role of database
# ┃ pg_run_times_run_time{run_name} GAUGE Run times of cluster
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
pg_run_times:
name: pg_run_times
desc: openGauss database run times
query:
- name: pg_run_times
sql: select 'cluster_runtime' as run_name,(case pg_is_in_recovery() when 'f' then 1 else 0 end) as db_role,extract(epoch from(now() - pg_postmaster_start_time())) as run_time;
version: '>=0.0.0'
timeout: 1
ttl: 60
status: enable
dbRole: ""
metrics:
- name: run_name
description: Name of cluster
usage: LABEL
- name: db_role
description: Role of database
usage: GAUGE
- name: run_time
description: Run times of cluster
usage: GAUGE
status: enable
ttl: 60
timeout: 1
public: true
# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# ┃ pg
# ┃ openGauss basic information
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ TTL ┆ 60
# ┃ Timeout ┆ 100ms
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ GAUGE timestamp current database timestamp in unix epoch
# ┃ GAUGE uptime seconds since postmaster start
# ┃ GAUGE boot_time postmaster boot timestamp in unix epoch
# ┃ COUNTER lsn log sequence number, current write location
# ┃ COUNTER insert_lsn primary only, location of current wal inserting
# ┃ COUNTER write_lsn primary only, location of current wal writing
# ┃ COUNTER flush_lsn primary only, location of current wal syncing
# ┃ COUNTER receive_lsn replica only, location of wal synced to disk
# ┃ COUNTER replay_lsn replica only, location of wal applied
# ┃ GAUGE conf_reload_time seconds since last configuration reload
# ┃ GAUGE last_replay_time time when last transaction been replayed
# ┃ GAUGE lag replica only, replication lag in seconds
# ┃ GAUGE is_in_recovery 1 if in recovery mode
# ┃ GAUGE is_wal_replay_paused 1 if wal play is paused
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ pg_timestamp{} GAUGE current database timestamp in unix epoch
# ┃ pg_uptime{} GAUGE seconds since postmaster start
# ┃ pg_boot_time{} GAUGE postmaster boot timestamp in unix epoch
# ┃ pg_lsn{} COUNTER log sequence number, current write location
# ┃ pg_insert_lsn{} COUNTER primary only, location of current wal inserting
# ┃ pg_write_lsn{} COUNTER primary only, location of current wal writing
# ┃ pg_flush_lsn{} COUNTER primary only, location of current wal syncing
# ┃ pg_receive_lsn{} COUNTER replica only, location of wal synced to disk
# ┃ pg_replay_lsn{} COUNTER replica only, location of wal applied
# ┃ pg_conf_reload_time{} GAUGE seconds since last configuration reload
# ┃ pg_last_replay_time{} GAUGE time when last transaction been replayed
# ┃ pg_lag{} GAUGE replica only, replication lag in seconds
# ┃ pg_is_in_recovery{} GAUGE 1 if in recovery mode
# ┃ pg_is_wal_replay_paused{} GAUGE 1 if wal play is paused
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
pg:
name: pg
desc: openGauss basic information
query:
- name: pg
desc: 'primary database '
sql: |
SELECT extract(EPOCH FROM CURRENT_TIMESTAMP) AS timestamp,
extract(EPOCH FROM now() - pg_postmaster_start_time()) AS uptime,
extract(EPOCH FROM pg_postmaster_start_time()) AS boot_time,
pg_xlog_location_diff(pg_current_xlog_location() , '0/0') AS lsn,
pg_xlog_location_diff(pg_current_xlog_insert_location(),'0/0') AS insert_lsn,
pg_xlog_location_diff(pg_current_xlog_location() , '0/0') AS write_lsn,
pg_xlog_location_diff(pg_current_xlog_location() , '0/0') AS flush_lsn,
NULL::BIGINT AS receive_lsn,
NULL::BIGINT AS replay_lsn,
extract(EPOCH FROM now() - pg_conf_load_time()) AS conf_reload_time,
NULL::FLOAT AS last_replay_time,
0::FLOAT AS lag,
pg_is_in_recovery() AS is_in_recovery,
FALSE AS is_wal_replay_paused
-- ,
--pg_is_in_backup() AS is_in_backup,
--extract(EPOCH FROM now() - pg_backup_start_time()) AS backup_time
;
version: '>=0.0.0'
timeout: 0.1
ttl: 10
status: enable
dbRole: primary
- name: pg
desc: 'standby database '
sql: |
SELECT extract(EPOCH FROM CURRENT_TIMESTAMP) AS timestamp,
extract(EPOCH FROM now() - pg_postmaster_start_time()) AS uptime,
extract(EPOCH FROM pg_postmaster_start_time()) AS boot_time,
pg_xlog_location_diff(pg_last_xlog_receive_location() , '0/0') AS lsn,
NULL::BIGINT AS insert_lsn,
NULL::BIGINT AS write_lsn,
NULL::BIGINT AS flush_lsn,
pg_xlog_location_diff(pg_last_xlog_receive_location() , '0/0') AS receive_lsn,
pg_xlog_location_diff(pg_last_xlog_receive_location() , '0/0') AS replay_lsn,
extract(EPOCH FROM now() - pg_conf_load_time()) AS conf_reload_time,
extract(EPOCH FROM pg_last_xact_replay_timestamp()) AS last_replay_time,
--CASE
-- WHEN pg_last_xlog_receive_location() = pg_last_xlog_replay_location() THEN 0
-- ELSE EXTRACT(EPOCH FROM now() - pg_last_xact_replay_timestamp()) END AS lag,
pg_is_in_recovery() AS is_in_recovery
--pg_is_wal_replay_paused() AS is_wal_replay_paused
--,
--pg_is_in_backup() AS is_in_backup,
--extract(EPOCH FROM now() - pg_backup_start_time()) AS backup_time
;
version: '>=0.0.0'
timeout: 0.1
ttl: 10
status: enable
dbRole: standby
metrics:
- name: timestamp
description: current database timestamp in unix epoch
usage: GAUGE
- name: uptime
description: seconds since postmaster start
usage: GAUGE
- name: boot_time
description: postmaster boot timestamp in unix epoch
usage: GAUGE
- name: lsn
description: log sequence number, current write location
usage: COUNTER
- name: insert_lsn
description: primary only, location of current wal inserting
usage: COUNTER
- name: write_lsn
description: primary only, location of current wal writing
usage: COUNTER
- name: flush_lsn
description: primary only, location of current wal syncing
usage: COUNTER
- name: receive_lsn
description: replica only, location of wal synced to disk
usage: COUNTER
- name: replay_lsn
description: replica only, location of wal applied
usage: COUNTER
- name: conf_reload_time
description: seconds since last configuration reload
usage: GAUGE
- name: last_replay_time
description: time when last transaction been replayed
usage: GAUGE
- name: lag
description: replica only, replication lag in seconds
usage: GAUGE
- name: is_in_recovery
description: 1 if in recovery mode
usage: GAUGE
- name: is_wal_replay_paused
description: 1 if wal play is paused
usage: GAUGE
status: enable
ttl: 60
timeout: 0.1
public: true
# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# ┃ pg_sync_standby
# ┃ openGauss synchronous standby status and names
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ TTL ┆ 60
# ┃ Timeout ┆ 100ms
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ LABEL names a list of standby servers that can support synchronous replication, empty if not enabled
# ┃ GAUGE disabled 1 if disabled, 0 if enabled
# ┃ GAUGE enabled 1 if enabled, 0 if disabled
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ pg_sync_standby_disabled{names} GAUGE 1 if disabled, 0 if enabled
# ┃ pg_sync_standby_enabled{names} GAUGE 1 if enabled, 0 if disabled
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
pg_sync_standby:
name: pg_sync_standby
desc: openGauss synchronous standby status and names
query:
- name: pg_sync_standby
sql: |
SELECT CASE names WHEN NULL THEN '""' WHEN '' THEN 'null' ELSE names END AS names,
CASE names WHEN NULL THEN 1 WHEN '' THEN 1 ELSE 0 END AS disabled,
CASE names WHEN NULL THEN 0 WHEN '' THEN 0 ELSE 1 END AS enabled
FROM (SELECT current_setting('synchronous_standby_names') AS names) t;
version: '>=0.0.0'
timeout: 0.1
ttl: 10
status: enable
dbRole: ""
metrics:
- name: names
description: a list of standby servers that can support synchronous replication, empty if not enabled
usage: LABEL
- name: disabled
description: 1 if disabled, 0 if enabled
usage: GAUGE
- name: enabled
description: 1 if enabled, 0 if disabled
usage: GAUGE
status: enable
ttl: 60
timeout: 0.1
public: true
# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# ┃ pg_lock
# ┃ openGauss lock distribution by mode
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ TTL ┆ 60
# ┃ Timeout ┆ 1s
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ LABEL datname Name of this database
# ┃ LABEL mode Type of Lock
# ┃ GAUGE count Number of locks
# ┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
# ┃ pg_lock_count{datname,mode} GAUGE Number of locks
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
pg_lock:
name: pg_lock
desc: openGauss lock distribution by mode
query:
- name: pg_lock
sql: |-
SELECT datname, mode, coalesce(count, 0) AS count
FROM (
SELECT d.oid AS database, d.datname, l.mode
FROM pg_database d,unnest(ARRAY ['AccessShareLock','RowShareLock','RowExclusiveLock','ShareUpdateExclusiveLock','ShareLock','ShareRowExclusiveLock','ExclusiveLock','AccessExclusiveLock']) l(mode)
WHERE d.datname NOT IN ('template0','template1')) base
LEFT JOIN (SELECT database, mode, count(1) AS count
FROM pg_locks
WHERE database IS NOT NULL GROUP BY database, mode) cnt
USING (database, mode);
version: '>=0.0.0'
timeout: 1
ttl: 60
status: enable
dbRole: ""
metrics:
- name: datname
description: Name of this database
usage: LABEL
- name: mode
description: Type of Lock
usage: LABEL
- name: count
description: Number of locks
usage: GAUGE
status: enable
ttl: 60
timeout: 1
public: true
pg_sql_history:
name: pg_sql_history
desc: openGauss history query statement
query:
- name: pg_sql_history
sql: select unique_sql_id,n_calls,cpu_time,min_elapse_time,max_elapse_time,total_elapse_time,query from dbe_perf.statement where n_calls > 1 order by total_elapse_time desc limit 10;
version: '>=0.0.0'
timeout: 1
status: enable
metrics:
- name: unique_sql_id
description: Name of database
usage: LABEL
- name: n_calls
description: Name of user
usage: GAUGE
- name: cpu_time
description: Client address
usage: GAUGE
- name: min_elapse_time
description: Query start time
usage: LABEL
- name: max_elapse_time
description: Query running time
usage: GAUGE
- name: total_elapse_time
description: Start time of transaction
usage: GAUGE
- name: query
description: transaction running time
usage: LABEL
status: enable
ttl: -1
timeout: 1
public: true
pg_active_slowsql:
name: pg_active_slowsql
desc: openGauss active slow query
query:
- name: pg_active_slowsql
sql: select datname,usename,client_addr,pid,query_start::text,extract(epoch from (now() - query_start)) as query_runtime,xact_start::text,extract(epoch from(now() - xact_start)) as xact_runtime,state,query from pg_stat_activity where state not in('idle') and query_start is not null;
version: '>=0.0.0'
timeout: 1
status: enable
metrics:
- name: datname
description: Name of database
usage: LABEL
- name: usename
description: Name of user
usage: LABEL
- name: client_addr
description: Client address
usage: LABEL
- name: pid
description: Client address
usage: LABEL
- name: query_start
description: Query start time
usage: LABEL
- name: query_runtime
description: Query running time
usage: GAUGE
- name: xact_start
description: Start time of transaction
usage: LABEL
- name: xact_runtime
description: transaction running time
usage: LABEL
- name: state
description: Query state
usage: LABEL
- name: query
description: Query sql
usage: LABEL
status: enable
ttl: -1
timeout: 1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sunbinlc/opengauss-prometheus-exporter.git
git@gitee.com:sunbinlc/opengauss-prometheus-exporter.git
sunbinlc
opengauss-prometheus-exporter
openGauss-prometheus-exporter
master

搜索帮助