forked from newrelic/nri-flex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostgres-db-example.yml
33 lines (33 loc) · 1.65 KB
/
postgres-db-example.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
# NOTE: 'database' is an experimental API at this time
# ref: https://github.com/newrelic/nri-flex/blob/master/docs/experimental/db.md
---
integrations:
- name: nri-flex
# interval: 30s
config:
name: postgresDbFlex
apis:
- database: postgres
db_conn: user=hithere host=apac.asdasdas.ap-southeast-2.rds.amazonaws.com sslmode=disable password=byethere port=5432
logging:
open: true
custom_attributes: # applies to all queries
host: myDbServer
db_async: true # process queries async
db_queries:
- name: pgStatActivitySample
run: select * FROM pg_stat_activity
custom_attributes: # can apply additional at a nested level
nestedAttr: nestedVal
# - name: pgStatActivitySample
# run: select datid Oid, datname as DatabaseName, usename UserName, to_char(query_start,'YYYY-MM-DD hh:mi:00') query_starttime, substring(query,1,50) query, state, wait_event_type Wait_type, application_name, now() - query_start Diff
# FROM pg_stat_activity
# WHERE now() - query_start between '1 seconds'::interval and '30 seconds'::interval
# AND query NOT ILIKE '%pg_stat_activity%'
# AND query NOT ILIKE '%pg_%'
# AND datname !='postgres';
# - database: postgres
# db_conn: user=hithere host=abc.abcdef.ap-southeast-2.rds.amazonaws.com sslmode=disable password=byethere port=5432 # could be another DB
# queries:
# - name: pgStatDbSample
# run: select * FROM pg_stat_database LIMIT 1