-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy path310-pg_size.yml
43 lines (41 loc) · 1.09 KB
/
310-pg_size.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
40
41
42
##
# SYNOPSIS
# pg_size_*
#
# DESCRIPTION
# PostgreSQL Database, WAL, Log size since v10
#
# OPTIONS
# Tags [cluster]
# TTL 60
# Priority 0
# Timeout 1s
# Fatal false
# Version 100000 ~ higher
# Source 310-pg_size.yml
#
# METRICS
# datname (LABEL)
# Database name, or special category 'wal' , 'log'
# bytes (GAUGE)
# File size in bytes
#
pg_size:
name: pg_size
desc: PostgreSQL Database, WAL, Log size since v10
query: |
SELECT datname, pg_database_size(oid) AS bytes FROM pg_database UNION ALL
SELECT 'log' AS datname, (SELECT (coalesce(sum(size), 0)) AS size FROM pg_catalog.pg_ls_logdir()) AS bytes UNION ALL
SELECT 'wal' AS datname, (SELECT (coalesce(sum(size), 0)) AS size FROM pg_catalog.pg_ls_waldir()) AS bytes;
ttl: 60
timeout: 1
min_version: 100000
tags:
- cluster
metrics:
- datname:
usage: LABEL
description: Database name, or special category 'wal' , 'log'
- bytes:
usage: GAUGE
description: File size in bytes