summaryrefslogtreecommitdiffstats
path: root/src/go/collectors/go.d.plugin/config/go.d/sd/docker.conf
blob: c63cfa55a6951f8650e0926c949d55b85586f014 (plain)
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
disabled: no

name: 'docker'

discover:
  - discoverer: docker
    docker:
      tags: "unknown"
      address: "unix:///var/run/docker.sock"

classify:
  - name: "Skip"
    selector: "unknown"
    tags: "skip"
    match:
      - tags: "skip"
        expr: |
          {{ $netNOK := eq .NetworkMode "host" -}}
          {{ $protoNOK := not (eq .PortProtocol "tcp") -}}
          {{ $portNOK := empty .PrivatePort -}}
          {{ $addrNOK := or (empty .IPAddress) (glob .PublicPortIP "*:*") -}}
          {{ or $netNOK $protoNOK $portNOK $addrNOK }}
  - name: "Applications"
    selector: "!skip unknown"
    tags: "-unknown app"
    match:
      - tags: "apache"
        expr: '{{ match "sp" .Image "httpd httpd:* */apache */apache:* */apache2 */apache2:*" }}'
      - tags: "cockroachdb"
        expr: '{{ match "sp" .Image "cockroachdb/cockroach cockroachdb/cockroach:*" }}'
      - tags: "consul"
        expr: '{{ match "sp" .Image "consul consul:* */consul */consul:*" }}'
      - tags: "coredns"
        expr: '{{ match "sp" .Image "*/coredns */coredns:*" }}'
      - tags: "couchbase"
        expr: '{{ or (eq .PrivatePort "8091") (match "sp" .Image "couchbase couchbase:*") }}'
      - tags: "couchdb"
        expr: '{{ or (eq .PrivatePort "5984") (match "sp" .Image "couchdb couchdb:*") }}'
      - tags: "elasticsearch"
        expr: '{{ or (eq .PrivatePort "9200") (match "sp" .Image "elasticsearch elasticsearch:* */elasticsearch */elasticsearch:* */opensearch */opensearch:*") }}'
      - tags: "lighttpd"
        expr: '{{ match "sp" .Image "*/lighttpd */lighttpd:*" }}'
      - tags: "mongodb"
        expr: '{{ or (eq .PrivatePort "27017") (match "sp" .Image "mongo mongo:* */mongodb */mongodb:* */mongodb-community-server */mongodb-community-server:*") }}'
      - tags: "mysql"
        expr: '{{ or (eq .PrivatePort "3306") (match "sp" .Image "mysql mysql:* */mysql */mysql:* mariadb mariadb:* */mariadb */mariadb:* percona percona:* */percona-mysql */percona-mysql:*") }}'
      - tags: "nginx"
        expr: '{{ match "sp" .Image "nginx nginx:*" }}'
      - tags: "pgbouncer"
        expr: '{{ or (eq .PrivatePort "6432") (match "sp" .Image "*/pgbouncer */pgbouncer:*") }}'
      - tags: "pika"
        expr: '{{ match "sp" .Image "pikadb/pika pikadb/pika:*" }}'
      - tags: "postgres"
        expr: '{{ or (eq .PrivatePort "5432") (match "sp" .Image "postgres postgres:* */postgres */postgres:* */postgresql */postgresql:*") }}'
      - tags: "proxysql"
        expr: '{{ or (eq .PrivatePort "6032") (match "sp" .Image "*/proxysql */proxysql:*") }}'
      - tags: "rabbitmq"
        expr: '{{ or (eq .PrivatePort "15672") (match "sp" .Image "rabbitmq rabbitmq:* */rabbitmq */rabbitmq:*") }}'
      - tags: "redis"
        expr: '{{ or (eq .PrivatePort "6379") (match "sp" .Image "redis redis:* */redis */redis:*") }}'
      - tags: "tengine"
        expr: '{{ match "sp" .Image "*/tengine */tengine:*" }}'
      - tags: "vernemq"
        expr: '{{ match "sp" .Image "*/vernemq */vernemq:*" }}'
      - tags: "zookeeper"
        expr: '{{ or (eq .PrivatePort "2181") (match "sp" .Image "*/zookeeper */zookeeper:*") }}'
compose:
  - name: "Applications"
    selector: "app"
    config:
      - selector: "apache"
        template: |
          module: apache
          name: docker_{{.Name}}
          url: http://{{.Address}}/server-status?auto
      - selector: "cockroachdb"
        template: |
          module: cockroachdb
          name: docker_{{.Name}}
          url: http://{{.Address}}/_status/vars
      - selector: "consul"
        template: |
          module: consul
          name: docker_{{.Name}}
          url: http://{{.Address}}
      - selector: "coredns"
        template: |
          module: coredns
          name: docker_{{.Name}}
          url: http://{{.Address}}/metrics
      - selector: "coredns"
        template: |
          module: coredns
          name: docker_{{.Name}}
          url: http://{{.Address}}/metrics
      - selector: "couchbase"
        template: |
          module: couchbase
          name: docker_{{.Name}}
          url: http://{{.Address}}
      - selector: "couchdb"
        template: |
          module: couchdb
          name: docker_{{.Name}}
          url: http://{{.Address}}
      - selector: "elasticsearch"
        template: |
          module: elasticsearch
          name: docker_{{.Name}}
          {{ if glob .Image "*elastic*" -}}
          url: http://{{.Address}}
          {{ else -}}
          url: https://{{.Address}}
          tls_skip_verify: yes
          username: admin
          password: admin
          {{ end -}}
      - selector: "lighttpd"
        template: |
          module: lighttpd
          name: docker_{{.Name}}
          url: http://{{.Address}}/server-status?auto
      - selector: "mongodb"
        template: |
          module: mongodb
          name: docker_{{.Name}}
          uri: mongodb://{{.Address}}
      - selector: "mysql"
        template: |
          module: mysql
          name: docker_{{.Name}}
          dsn: netdata@tcp({{.IPAddress}}:{{.PrivatePort}})/
      - selector: "nginx"
        template: |
          module: nginx
          name: docker_{{.Name}}
          url: http://{{.Address}}/stub_status
      - selector: "pgbouncer"
        template: |
          module: pgbouncer
          name: docker_{{.Name}}
          dsn: postgres://netdata:postgres@{{.IPAddress}}:{{.PrivatePort}}/pgbouncer
      - selector: "pika"
        template: |
          module: pika
          name: docker_{{.Name}}
          address: redis://@{{.IPAddress}}:{{.PrivatePort}}
      - selector: "postgres"
        template: |
          module: postgres
          name: docker_{{.Name}}
          dsn: postgres://netdata:postgres@{{.IPAddress}}:{{.PrivatePort}}/postgres
      - selector: "proxysql"
        template: |
          module: proxysql
          name: docker_{{.Name}}
          dsn: stats:stats@tcp({{.IPAddress}}:{{.PrivatePort}})/
      - selector: "rabbitmq"
        template: |
          module: rabbitmq
          name: docker_{{.Name}}
          url: http://{{.Address}}
      - selector: "redis"
        template: |
          module: redis
          name: docker_{{.Name}}
          address: redis://@{{.IPAddress}}:{{.PrivatePort}}
      - selector: "tengine"
        template: |
          module: tengine
          name: docker_{{.Name}}
          url: http://{{.Address}}/us
      - selector: "vernemq"
        template: |
          module: vernemq
          name: docker_{{.Name}}
          url: http://{{.Address}}/metrics
      - selector: "zookeeper"
        template: |
          module: vernemq
          name: docker_{{.Name}}
          address: {{.Address}}