forked from newrelic/nri-flex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmysql-database-example.yml
77 lines (77 loc) · 3.94 KB
/
mysql-database-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
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
# 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: MySQLDbFlex
apis:
- database: mysql
# connection string for an rds mysql instance. Be sure to use the writer endpoint here. /sys is the default database. newrelic:Password is the user:pass.
db_conn: newrelic:Password@tcp(rds-name.region.rds.amazonaws.com:3306)/sys
logging:
open: true
# custom_attributes: # applies to all queries
# host: AuroraMySQL # custom host name atribute
db_async: true # process queries async
db_queries:
- name: MySQLShowVars
run: SHOW VARIABLES;
custom_attributes: # can apply additional at a nested level
attype: show-vars
host: AuroraMySQL
- name: MySQLShowStatus
run: SHOW STATUS LIKE 'Max%conn%';
custom_attributes: # can apply additional at a nested level
attype: used-conns
host: AuroraMySQL
- name: MySQLCustomProcessList
run: SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST # grab all processes from MySQL
custom_attributes: # can apply additional at a nested level
attype: info-schema-query
host: AuroraMySQL
- name: MySQLCustomBlocking
run: SELECT r.trx_id waiting_trx_id,r.trx_mysql_thread_id waiting_thread,r.trx_query waiting_query,b.trx_id blocking_trx_id,b.trx_mysql_thread_id blocking_thread,b.trx_query blocking_query
FROM information_schema.innodb_lock_waits w
INNER JOIN information_schema.innodb_trx b
ON b.trx_id = w.blocking_trx_id
INNER JOIN information_schema.innodb_trx r
ON r.trx_id = w.requesting_trx_id;
custom_attributes: # can apply additional at a nested level
attype: blocking-query
host: AuroraMySQL
- database: mysql
# connection string for a local mysql instance. Be sure to use localhost here. /sys is the default database. newrelic:Password is the user:pass.
db_conn: newrelic:Password@tcp(localhost:3306)/sys
logging:
open: true
# custom_attributes: # applies to all queries
# host: UbuntuMySQL # custom host name atribute
db_async: true # process queries async
db_queries:
- name: MySQLShowVars
run: SHOW VARIABLES;
custom_attributes: # can apply additional at a nested level
attype: show-vars
host: LocalMySQL
- name: MySQLShowStatus
run: SHOW STATUS LIKE 'Max%conn%';
custom_attributes: # can apply additional at a nested level
attype: used-conns
host: LocalMySQL
- name: MySQLCustomProcessList
run: SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST # grab all processes from MySQL
custom_attributes: # can apply additional at a nested level
attype: info-schema-query
host: LocalMySQL
- name: MySQLCustomBlocking
run: SELECT r.trx_id waiting_trx_id,r.trx_mysql_thread_id waiting_thread,r.trx_query waiting_query,b.trx_id blocking_trx_id,b.trx_mysql_thread_id blocking_thread,b.trx_query blocking_query
FROM information_schema.innodb_lock_waits w
INNER JOIN information_schema.innodb_trx b
ON b.trx_id = w.blocking_trx_id
INNER JOIN information_schema.innodb_trx r
ON r.trx_id = w.requesting_trx_id;
custom_attributes: # can apply additional at a nested level
attype: blocking-query
host: LocalMySQL