-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy path230-pg_downstream.yml
41 lines (38 loc) · 1.13 KB
/
230-pg_downstream.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
##
# SYNOPSIS
# pg_downstream_*
#
# DESCRIPTION
# PostgreSQL replication client count group by state
#
# OPTIONS
# Tags [cluster]
# TTL 10
# Priority 0
# Timeout 100ms
# Fatal false
# Version 90400 ~ higher
# Source 230-pg_downstream.yml
#
# METRICS
# state (LABEL)
# Replication client state, could be one of startup|catchup|streaming|backup|stopping
# count (GAUGE)
# Count of corresponding state
#
pg_downstream:
name: pg_downstream
desc: PostgreSQL replication client count group by state
query: |
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;
ttl: 10
min_version: 090400
tags:
- cluster
metrics:
- state:
usage: LABEL
description: Replication client state, could be one of startup|catchup|streaming|backup|stopping
- count:
usage: GAUGE
description: Count of corresponding state