-
Notifications
You must be signed in to change notification settings - Fork 109
/
config.yml.dist
195 lines (195 loc) · 5.2 KB
/
config.yml.dist
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
---
jobs:
- name: "global"
interval: '5m'
connections:
- 'postgres://postgres@localhost/postgres?sslmode=disable'
startup_sql:
- 'SET lock_timeout = 1000'
- 'SET idle_in_transaction_session_timeout = 100'
queries:
- name: "running_queries"
help: "Number of running queries"
labels:
- "datname"
- "usename"
values:
- "count"
query: |
SELECT datname::text, usename::text, COUNT(*)::float AS count
FROM pg_stat_activity GROUP BY datname, usename;
- name: "db_sizes"
help: "Database Sizes"
labels:
- "dbname"
values:
- "dbsize"
query: |
SELECT datname::text AS dbname, pg_database_size(datname)::float AS dbsize
FROM pg_database;
- name: "replication_lag"
help: "Replication Lag"
labels:
- "hostname"
values:
- "replication_lag"
query: |
WITH lag AS (
SELECT
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
)
SELECT
split_part(inet_server_addr()::text, '/', 1) AS hostname,
lag::float AS replication_lag
FROM lag
- name: "mssql"
interval: '5m'
connections:
- 'sqlserver://username:password@host?database=mssqlDB'
queries:
- name: "user_amount"
help: "Count users in Database"
labels:
- "app"
values:
- "users"
query: |
SELECT application as app, count(*) as users
FROM mssqlDB
GROUP by app;
- name: "mydb"
interval: '5m'
connections:
- 'postgres://postgres@localhost/mydb?sslmode=disable'
queries:
- name: "pg_stat_user_tables"
help: "Table stats"
labels:
- "schemaname"
- "relname"
values:
- "seq_scan"
- "seq_tup_read"
- "idx_scan"
- "idx_tup_fetch"
- "n_tup_ins"
- "n_tup_upd"
- "n_tup_del"
- "n_tup_hot_upd"
- "n_live_tup"
- "n_dead_tup"
- "vacuum_count"
- "autovacuum_count"
- "analyze_count"
- "autoanalyze_count"
query: |
SELECT
schemaname::text
, relname::text
, seq_scan::float
, seq_tup_read::float
, idx_scan::float
, idx_tup_fetch::float
, n_tup_ins::float
, n_tup_upd::float
, n_tup_del::float
, n_tup_hot_upd::float
, n_live_tup::float
, n_dead_tup::float
, vacuum_count::float
, autovacuum_count::float
, analyze_count::float
, autoanalyze_count::float
FROM pg_stat_user_tables;
- name: "pg_statio_user_tables"
help: "IO Stats"
labels:
- "schemaname"
- "relname"
values:
- "heap_blks_read"
- "heap_blks_hit"
- "idx_blks_read"
- "idx_blks_hit"
query: |
SELECT
schemaname::text
, relname::text
, heap_blks_read::float
, heap_blks_hit::float
, idx_blks_read::float
, idx_blks_hit::float
FROM pg_statio_user_tables;
- name: "athena"
interval: '5m'
connections:
# see https://godoc.org/github.com/segmentio/go-athena#Driver.Open
- 'athena://HOST_VALUE_IGNORED/<DB_NAME>?db=<DB_NAME>®ion=<AWS_REGION>&output_location=s3://aws-athena-query-results-<ACCOUNT_ID>-<REGION>'
queries:
- name: "athena_query_rows"
help: "Number of rows..."
values:
- "count"
query: |
SELECT COUNT(*) AS count
FROM my_athena_db.some_table
WHERE partition IN
(SELECT max(partition)
FROM my_athena_db.some_table);
- name: "snowflake"
interval: '1m'
connections:
- 'snowflake://username:password@hostname/schema/table'
queries:
- name: "snowflake_dwh_some_table"
help: "Number of rows..."
# Make sure values matches the return value of the query. If alias isn't quoted in the query Snowflake will use uppercase which has to match with the column
# name in values.
values:
- "count"
query: |
select count(1) as "count" from our_data_warehouse limit 1;
- name: "vertica"
interval: '1m'
connections:
- 'vertica://user:password@host:port/database?queryArgs'
queries:
- name: "delete_vector_count"
help: 'Count of delete vectors'
labels:
- node_name
- schema_name
- projection_name
values:
- delete_vector_count
query: |
SELECT
node_name,
schema_name,
projection_name,
COUNT(*) AS delete_vector_count
FROM
delete_vectors
GROUP BY
node_name,
schema_name,
projection_name;
- name: "rds"
interval: '5m'
connections:
- 'rds-postgres://postgres_usr:[email protected]/db_name'
queries:
- name: "running_queries"
help: "Number of running queries"
labels:
- "datname"
- "usename"
values:
- "count"
query: |
SELECT datname::text, usename::text, COUNT(*)::float AS count
FROM pg_stat_activity GROUP BY datname, usename;