├── mariadb ├── conf.d │ ├── docker.cnf │ ├── mysqld_safe_syslog.cnf │ └── mariadb.cnf ├── Dockerfile └── my.cnf ├── nginx ├── Dockerfile ├── conf.d │ ├── nginx_status.conf │ └── kibana.happygod.cn.conf └── nginx.conf ├── redis └── Dockerfile ├── metricbeat ├── Dockerfile ├── modules.d │ ├── kibana.yml.disabled │ ├── memcached.yml.disabled │ ├── uwsgi.yml.disabled │ ├── zookeeper.yml.disabled │ ├── etcd.yml.disabled │ ├── haproxy.yml.disabled │ ├── apache.yml.disabled │ ├── couchbase.yml.disabled │ ├── elasticsearch.yml.disabled │ ├── aerospike.yml.disabled │ ├── php_fpm.yml.disabled │ ├── logstash.yml.disabled │ ├── ceph.yml.disabled │ ├── prometheus.yml.disabled │ ├── rabbitmq.yml.disabled │ ├── dropwizard.yml.disabled │ ├── windows.yml.disabled │ ├── golang.yml.disabled │ ├── nginx.yml │ ├── jolokia.yml.disabled │ ├── graphite.yml.disabled │ ├── vsphere.yml.disabled │ ├── docker.yml │ ├── http.yml.disabled │ ├── mongodb.yml.disabled │ ├── kubernetes.yml.disabled │ ├── mysql.yml │ ├── system.yml │ ├── kafka.yml.disabled │ ├── postgresql.yml.disabled │ └── redis.yml └── metricbeat.yml ├── elasticsearch ├── config │ └── elasticsearch.yml └── Dockerfile ├── kibana ├── config │ └── kibana.yml └── Dockerfile ├── logstash ├── pipeline │ ├── default.conf │ └── mysql.slow.conf ├── Dockerfile └── config │ ├── pipelines.yml │ └── logstash.yml ├── README.md ├── mac-docker-compose.yml ├── docker-compose.yml └── dao-docker-compose.yml /mariadb/conf.d/docker.cnf: -------------------------------------------------------------------------------- 1 | [mysqld] 2 | skip-host-cache 3 | skip-name-resolve -------------------------------------------------------------------------------- /mariadb/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mariadb 2 | 3 | LABEL maintainer="genius840215@163.com" 4 | -------------------------------------------------------------------------------- /mariadb/conf.d/mysqld_safe_syslog.cnf: -------------------------------------------------------------------------------- 1 | [mysqld_safe] 2 | skip_log_error 3 | syslog 4 | # -------------------------------------------------------------------------------- /nginx/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx:alpine 2 | 3 | LABEL maintainer="genius840215@163.com" 4 | -------------------------------------------------------------------------------- /redis/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM redis:alpine 2 | 3 | LABEL maintainer="genius840215@163.com" 4 | 5 | -------------------------------------------------------------------------------- /metricbeat/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM docker.elastic.co/beats/metricbeat:6.2.2 2 | 3 | LABEL maintainer="genius840215@163.com" 4 | -------------------------------------------------------------------------------- /metricbeat/modules.d/kibana.yml.disabled: -------------------------------------------------------------------------------- 1 | - module: kibana 2 | metricsets: ["status"] 3 | period: 10s 4 | hosts: ["localhost:5601"] 5 | -------------------------------------------------------------------------------- /metricbeat/modules.d/memcached.yml.disabled: -------------------------------------------------------------------------------- 1 | - module: memcached 2 | metricsets: ["stats"] 3 | period: 10s 4 | hosts: ["localhost:11211"] 5 | -------------------------------------------------------------------------------- /metricbeat/modules.d/uwsgi.yml.disabled: -------------------------------------------------------------------------------- 1 | - module: uwsgi 2 | metricsets: ["status"] 3 | period: 10s 4 | hosts: ["tcp://127.0.0.1:9191"] 5 | -------------------------------------------------------------------------------- /metricbeat/modules.d/zookeeper.yml.disabled: -------------------------------------------------------------------------------- 1 | - module: zookeeper 2 | metricsets: ["mntr"] 3 | period: 10s 4 | hosts: ["localhost:2181"] 5 | -------------------------------------------------------------------------------- /metricbeat/modules.d/etcd.yml.disabled: -------------------------------------------------------------------------------- 1 | - module: etcd 2 | metricsets: ["leader", "self", "store"] 3 | period: 10s 4 | hosts: ["localhost:2379"] 5 | 6 | -------------------------------------------------------------------------------- /metricbeat/modules.d/haproxy.yml.disabled: -------------------------------------------------------------------------------- 1 | - module: haproxy 2 | metricsets: ["info", "stat"] 3 | period: 10s 4 | hosts: ["tcp://127.0.0.1:14567"] 5 | -------------------------------------------------------------------------------- /metricbeat/modules.d/apache.yml.disabled: -------------------------------------------------------------------------------- 1 | - module: apache 2 | metricsets: ["status"] 3 | period: 10s 4 | 5 | # Apache hosts 6 | hosts: ["http://127.0.0.1"] 7 | -------------------------------------------------------------------------------- /metricbeat/modules.d/couchbase.yml.disabled: -------------------------------------------------------------------------------- 1 | - module: couchbase 2 | metricsets: ["bucket", "cluster", "node"] 3 | period: 10s 4 | hosts: ["localhost:8091"] 5 | -------------------------------------------------------------------------------- /metricbeat/modules.d/elasticsearch.yml.disabled: -------------------------------------------------------------------------------- 1 | - module: elasticsearch 2 | metricsets: ["node", "node_stats"] 3 | period: 10s 4 | hosts: ["localhost:9200"] 5 | -------------------------------------------------------------------------------- /metricbeat/modules.d/aerospike.yml.disabled: -------------------------------------------------------------------------------- 1 | - module: aerospike 2 | metricsets: ["namespace"] 3 | enabled: false 4 | period: 10s 5 | hosts: ["localhost:3000"] 6 | -------------------------------------------------------------------------------- /metricbeat/modules.d/php_fpm.yml.disabled: -------------------------------------------------------------------------------- 1 | - module: php_fpm 2 | metricsets: ["pool"] 3 | period: 10s 4 | status_path: "/status" 5 | hosts: ["localhost:8080"] 6 | -------------------------------------------------------------------------------- /elasticsearch/config/elasticsearch.yml: -------------------------------------------------------------------------------- 1 | cluster.name: "docker-cluster" 2 | network.host: 0.0.0.0 3 | 4 | discovery.zen.minimum_master_nodes: 1 5 | 6 | discovery.type: single-node -------------------------------------------------------------------------------- /metricbeat/modules.d/logstash.yml.disabled: -------------------------------------------------------------------------------- 1 | - module: logstash 2 | metricsets: ["node", "node_stats"] 3 | enabled: false 4 | period: 10s 5 | hosts: ["localhost:9600"] 6 | 7 | -------------------------------------------------------------------------------- /kibana/config/kibana.yml: -------------------------------------------------------------------------------- 1 | server.name: kibana 2 | server.host: "0" 3 | 4 | elasticsearch.url: http://elasticsearch:9200 5 | elasticsearch.username: "elastic" 6 | elasticsearch.password: "123456" -------------------------------------------------------------------------------- /metricbeat/modules.d/ceph.yml.disabled: -------------------------------------------------------------------------------- 1 | - module: ceph 2 | metricsets: ["cluster_disk", "cluster_health", "monitor_health", "pool_disk", "osd_tree"] 3 | period: 10s 4 | hosts: ["localhost:5000"] 5 | -------------------------------------------------------------------------------- /metricbeat/modules.d/prometheus.yml.disabled: -------------------------------------------------------------------------------- 1 | - module: prometheus 2 | metricsets: ["stats"] 3 | period: 10s 4 | hosts: ["localhost:9090"] 5 | metrics_path: /metrics 6 | #namespace: example 7 | -------------------------------------------------------------------------------- /metricbeat/modules.d/rabbitmq.yml.disabled: -------------------------------------------------------------------------------- 1 | - module: rabbitmq 2 | metricsets: ["node", "queue"] 3 | period: 10s 4 | hosts: ["localhost:15672"] 5 | 6 | username: guest 7 | password: guest 8 | -------------------------------------------------------------------------------- /metricbeat/modules.d/dropwizard.yml.disabled: -------------------------------------------------------------------------------- 1 | - module: dropwizard 2 | metricsets: ["collector"] 3 | period: 10s 4 | hosts: ["localhost:8080"] 5 | metrics_path: /metrics/metrics 6 | namespace: example 7 | -------------------------------------------------------------------------------- /metricbeat/modules.d/windows.yml.disabled: -------------------------------------------------------------------------------- 1 | - module: windows 2 | metricsets: ["perfmon"] 3 | period: 10s 4 | perfmon.counters: 5 | 6 | - module: windows 7 | metricsets: ["service"] 8 | period: 60s 9 | -------------------------------------------------------------------------------- /logstash/pipeline/default.conf: -------------------------------------------------------------------------------- 1 | input { 2 | tcp { 3 | port => "5000" 4 | } 5 | } 6 | 7 | output { 8 | elasticsearch { 9 | hosts => "http://elasticsearch:9200" 10 | user => "elastic" 11 | password => "123456" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /metricbeat/modules.d/golang.yml.disabled: -------------------------------------------------------------------------------- 1 | - module: golang 2 | metricsets: ["expvar","heap"] 3 | period: 10s 4 | hosts: ["localhost:6060"] 5 | heap.path: "/debug/vars" 6 | expvar: 7 | namespace: "example" 8 | path: "/debug/vars" 9 | -------------------------------------------------------------------------------- /metricbeat/modules.d/nginx.yml: -------------------------------------------------------------------------------- 1 | - module: nginx 2 | metricsets: ["stubstatus"] 3 | period: 10s 4 | 5 | # Nginx hosts 6 | hosts: ["http://172.25.0.5:8001"] 7 | 8 | # Path to server status. Default server-status 9 | server_status_path: "nginx_status" 10 | -------------------------------------------------------------------------------- /elasticsearch/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM docker.elastic.co/elasticsearch/elasticsearch-platinum:6.2.2 2 | 3 | LABEL maintainer="genius840215@163.com" 4 | 5 | COPY ./config/elasticsearch.yml /usr/share/elasticsearch/conifg/elasticsearch.yml 6 | 7 | RUN echo "Asia/Shanghai" > /etc/timezone -------------------------------------------------------------------------------- /nginx/conf.d/nginx_status.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 8001; 3 | location /nginx_status { 4 | stub_status on; 5 | allow 127.0.0.1; 6 | # 允许容器之间访问 7 | # ** 为了安全 可以设置具体ip 白名单 8 | allow 172.0.0.0/8; 9 | # 403 白名单之外ip 10 | deny all; 11 | } 12 | } -------------------------------------------------------------------------------- /kibana/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM docker.elastic.co/kibana/kibana:6.2.2 2 | 3 | LABEL maintainer="genius840215@163.com" 4 | 5 | COPY ./config/kibana.yml /usr/share/kibana/config/kibana.yml 6 | 7 | USER root 8 | 9 | RUN echo "Asia/Shanghai" > /etc/timezone 10 | 11 | USER kibana 12 | -------------------------------------------------------------------------------- /metricbeat/modules.d/jolokia.yml.disabled: -------------------------------------------------------------------------------- 1 | - module: jolokia 2 | metricsets: ["jmx"] 3 | period: 10s 4 | hosts: ["localhost"] 5 | namespace: "metrics" 6 | path: "/jolokia/?ignoreErrors=true&canonicalNaming=false" 7 | jmx.mapping: 8 | jmx.application: 9 | jmx.instance: 10 | -------------------------------------------------------------------------------- /logstash/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM docker.elastic.co/logstash/logstash:6.2.2 2 | 3 | LABEL maintainer="genius840215@163.com" 4 | 5 | COPY ./config /usr/share/logstash/config 6 | COPY ./pipeline /usr/share/logstash/pipeline 7 | 8 | USER root 9 | 10 | RUN echo "Asia/Shanghai" > /etc/timezone 11 | 12 | USER logstash -------------------------------------------------------------------------------- /logstash/config/pipelines.yml: -------------------------------------------------------------------------------- 1 | # This file is where you define your pipelines. You can define multiple. 2 | # For more information on multiple pipelines, see the documentation: 3 | # https://www.elastic.co/guide/en/logstash/current/multiple-pipelines.html 4 | 5 | - pipeline.id: mysql.slow 6 | path.config: "/usr/share/logstash/pipeline/mysql.slow.conf" -------------------------------------------------------------------------------- /metricbeat/modules.d/graphite.yml.disabled: -------------------------------------------------------------------------------- 1 | - module: graphite 2 | metricsets: ["server"] 3 | enabled: true 4 | # protocol: "udp" 5 | # templates: 6 | # - filter: "test.*.bash.*" # This would match metrics like test.localhost.bash.stats 7 | # namespace: "test" 8 | # template: ".host.shell.metric*" # test.localhost.bash.stats would become metric=stats and tags host=localhost,shell=bash 9 | # delimiter: "_" 10 | 11 | -------------------------------------------------------------------------------- /metricbeat/modules.d/vsphere.yml.disabled: -------------------------------------------------------------------------------- 1 | - module: vsphere 2 | metricsets: ["datastore", "host", "virtualmachine"] 3 | period: 10s 4 | hosts: ["https://localhost/sdk"] 5 | 6 | username: "user" 7 | password: "password" 8 | # If insecure is true, don't verify the server's certificate chain 9 | insecure: false 10 | # Get custom fields when using virtualmachine metric set. Default false. 11 | # get_custom_fields: false 12 | 13 | -------------------------------------------------------------------------------- /nginx/conf.d/kibana.happygod.cn.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | server_name kibana.happygod.cn; 4 | access_log /var/log/kibana.happygod.cn; 5 | 6 | location / { 7 | try_files /_not_exists_ @backend; 8 | } 9 | 10 | location @backend { 11 | proxy_set_header X-Forwarded-For $remote_addr; 12 | proxy_set_header Host $http_host; 13 | 14 | proxy_pass http://172.25.0.4:5601; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /metricbeat/modules.d/docker.yml: -------------------------------------------------------------------------------- 1 | - module: docker 2 | metricsets: ["container", "cpu", "diskio", "healthcheck", "info", "memory", "network"] 3 | hosts: ["unix:///var/run/docker.sock"] 4 | period: 10s 5 | 6 | # To connect to Docker over TLS you must specify a client and CA certificate. 7 | #ssl: 8 | #certificate_authority: "/etc/pki/root/ca.pem" 9 | #certificate: "/etc/pki/client/cert.pem" 10 | #key: "/etc/pki/client/cert.key" 11 | -------------------------------------------------------------------------------- /metricbeat/modules.d/http.yml.disabled: -------------------------------------------------------------------------------- 1 | - module: http 2 | metricsets: ["json"] 3 | period: 10s 4 | hosts: ["localhost:80"] 5 | namespace: "json_namespace" 6 | path: "/" 7 | #body: "" 8 | #method: "GET" 9 | #request.enabled: false 10 | #response.enabled: false 11 | #dedot.enabled: false 12 | 13 | - module: http 14 | metricsets: ["server"] 15 | host: "localhost" 16 | port: "8080" 17 | enabled: false 18 | # paths: 19 | # - path: "/foo" 20 | # namespace: "foo" 21 | # fields: # added to the the response in root. overwrites existing fields 22 | # key: "value" 23 | -------------------------------------------------------------------------------- /mariadb/conf.d/mariadb.cnf: -------------------------------------------------------------------------------- 1 | # MariaDB-specific config file. 2 | # Read by /etc/mysql/my.cnf 3 | 4 | [client] 5 | # Default is Latin1, if you need UTF-8 set this (also in server section) 6 | #default-character-set = utf8 7 | 8 | [mysqld] 9 | # 10 | # * Character sets 11 | # 12 | # Default is Latin1, if you need UTF-8 set all this (also in client section) 13 | # 14 | #character-set-server = utf8 15 | #collation-server = utf8_general_ci 16 | #character_set_server = utf8 17 | #collation_server = utf8_general_ci 18 | # Import all .cnf files from configuration directory 19 | !includedir /etc/mysql/mariadb.conf.d/ -------------------------------------------------------------------------------- /logstash/config/logstash.yml: -------------------------------------------------------------------------------- 1 | http.host: "0.0.0.0" 2 | 3 | xpack.monitoring.elasticsearch.url: "http://elasticsearch:9200" 4 | xpack.monitoring.elasticsearch.username: elastic 5 | xpack.monitoring.elasticsearch.password: "123456" 6 | 7 | # 通过x-pack 在kibana上管理pipe信息 8 | # * pipeline id 必须要在这里注册 9 | # * 至少要有配置一个管道 10 | 11 | # xpack.management.enabled: true 12 | # xpack.management.elasticsearch.url: "http://elasticsearch:9200/" 13 | # xpack.management.elasticsearch.username: elastic 14 | # xpack.management.elasticsearch.password: "123456" 15 | # xpack.management.logstash.poll_interval: 5s 16 | # xpack.management.pipeline.id: ["var.log.system", "main", "mysql.show"] -------------------------------------------------------------------------------- /metricbeat/modules.d/mongodb.yml.disabled: -------------------------------------------------------------------------------- 1 | - module: mongodb 2 | metricsets: ["dbstats", "status"] 3 | period: 10s 4 | 5 | # The hosts must be passed as MongoDB URLs in the format: 6 | # [mongodb://][user:pass@]host[:port]. 7 | # The username and password can also be set using the respective configuration 8 | # options. The credentials in the URL take precedence over the username and 9 | # password configuration options. 10 | hosts: ["localhost:27017"] 11 | 12 | # Username to use when connecting to MongoDB. Empty by default. 13 | #username: user 14 | 15 | # Password to use when connecting to MongoDB. Empty by default. 16 | #password: pass 17 | -------------------------------------------------------------------------------- /metricbeat/modules.d/kubernetes.yml.disabled: -------------------------------------------------------------------------------- 1 | # Node metrics, from kubelet: 2 | - module: kubernetes 3 | metricsets: 4 | - node 5 | - system 6 | - pod 7 | - container 8 | - volume 9 | period: 10s 10 | hosts: ["localhost:10255"] 11 | 12 | # State metrics from kube-state-metrics service: 13 | - module: kubernetes 14 | enabled: false 15 | metricsets: 16 | - state_node 17 | - state_deployment 18 | - state_replicaset 19 | - state_pod 20 | - state_container 21 | period: 10s 22 | hosts: ["kube-state-metrics:8080"] 23 | 24 | # Kubernetes events 25 | - module: kubernetes 26 | enabled: false 27 | metricsets: 28 | - event 29 | -------------------------------------------------------------------------------- /metricbeat/modules.d/mysql.yml: -------------------------------------------------------------------------------- 1 | - module: mysql 2 | metricsets: ["status"] 3 | period: 10s 4 | 5 | # Host DSN should be defined as "user:pass@tcp(127.0.0.1:3306)/" 6 | # The username and password can either be set in the DSN or using the username 7 | # and password config options. Those specified in the DSN take precedence. 8 | hosts: [ 9 | "root:root@tcp(172.25.0.6:3306)/", 10 | "root:root@tcp(172.20.0.2:3306)/" 11 | ] 12 | 13 | # Username of hosts. Empty by default. 14 | #username: root 15 | 16 | # Password of hosts. Empty by default. 17 | #password: secret 18 | 19 | # By setting raw to true, all raw fields from the status metricset will be added to the event. 20 | #raw: false 21 | -------------------------------------------------------------------------------- /metricbeat/modules.d/system.yml: -------------------------------------------------------------------------------- 1 | - module: system 2 | period: 10s 3 | metricsets: 4 | - cpu 5 | - load 6 | - memory 7 | - network 8 | - process 9 | - process_summary 10 | - core 11 | - diskio 12 | # - socket 13 | processes: ['.*'] 14 | process.include_top_n: 15 | by_cpu: 5 # include top 5 processes by CPU 16 | by_memory: 5 # include top 5 processes by memory 17 | 18 | - module: system 19 | period: 1m 20 | metricsets: 21 | - filesystem 22 | - fsstat 23 | processors: 24 | - drop_event.when.regexp: 25 | system.filesystem.mount_point: '^/(sys|cgroup|proc|dev|etc|host|lib)($|/)' 26 | 27 | - module: system 28 | period: 15m 29 | metricsets: 30 | - uptime 31 | -------------------------------------------------------------------------------- /metricbeat/modules.d/kafka.yml.disabled: -------------------------------------------------------------------------------- 1 | - module: kafka 2 | metricsets: ["partition"] 3 | period: 10s 4 | hosts: ["localhost:9092"] 5 | 6 | #client_id: metricbeat 7 | #retries: 3 8 | #backoff: 250ms 9 | 10 | # List of Topics to query metadata for. If empty, all topics will be queried. 11 | #topics: [] 12 | 13 | # Optional SSL. By default is off. 14 | # List of root certificates for HTTPS server verifications 15 | #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"] 16 | 17 | # Certificate for SSL client authentication 18 | #ssl.certificate: "/etc/pki/client/cert.pem" 19 | 20 | # Client Certificate Key 21 | #ssl.key: "/etc/pki/client/cert.key" 22 | 23 | # SASL authentication 24 | #username: "" 25 | #password: "" 26 | -------------------------------------------------------------------------------- /nginx/nginx.conf: -------------------------------------------------------------------------------- 1 | user nginx; 2 | worker_processes 1; 3 | 4 | error_log /var/log/nginx/error.log warn; 5 | pid /var/run/nginx.pid; 6 | 7 | 8 | events { 9 | worker_connections 1024; 10 | } 11 | 12 | 13 | http { 14 | include /etc/nginx/mime.types; 15 | default_type application/octet-stream; 16 | 17 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 18 | '$status $body_bytes_sent "$http_referer" ' 19 | '"$http_user_agent" "$http_x_forwarded_for"'; 20 | 21 | access_log /var/log/nginx/access.log main; 22 | 23 | sendfile on; 24 | #tcp_nopush on; 25 | 26 | keepalive_timeout 65; 27 | 28 | #gzip on; 29 | 30 | include /etc/nginx/conf.d/*.conf; 31 | } -------------------------------------------------------------------------------- /metricbeat/modules.d/postgresql.yml.disabled: -------------------------------------------------------------------------------- 1 | - module: postgresql 2 | metricsets: 3 | # Stats about every PostgreSQL database 4 | - database 5 | 6 | # Stats about the background writer process's activity 7 | - bgwriter 8 | 9 | # Stats about every PostgreSQL process 10 | - activity 11 | 12 | period: 10s 13 | 14 | # The host must be passed as PostgreSQL URL. Example: 15 | # postgres://localhost:5432?sslmode=disable 16 | # The available parameters are documented here: 17 | # https://godoc.org/github.com/lib/pq#hdr-Connection_String_Parameters 18 | hosts: ["postgres://localhost:5432"] 19 | 20 | # Username to use when connecting to PostgreSQL. Empty by default. 21 | #username: user 22 | 23 | # Password to use when connecting to PostgreSQL. Empty by default. 24 | #password: pass 25 | -------------------------------------------------------------------------------- /metricbeat/modules.d/redis.yml: -------------------------------------------------------------------------------- 1 | - module: redis 2 | metricsets: ["info", "keyspace"] 3 | period: 10s 4 | 5 | # Redis hosts 6 | hosts: ["localhost:6379"] 7 | 8 | # Timeout after which time a metricset should return an error 9 | # Timeout is by default defined as period, as a fetch of a metricset 10 | # should never take longer then period, as otherwise calls can pile up. 11 | #timeout: 1s 12 | 13 | # Optional fields to be added to each event 14 | #fields: 15 | # datacenter: west 16 | 17 | # Network type to be used for redis connection. Default: tcp 18 | #network: tcp 19 | 20 | # Max number of concurrent connections. Default: 10 21 | #maxconn: 10 22 | 23 | # Filters can be used to reduce the number of fields sent. 24 | #processors: 25 | # - include_fields: 26 | # fields: ["beat", "metricset", "redis.info.stats"] 27 | 28 | # Redis AUTH password. Empty by default. 29 | #password: foobared 30 | -------------------------------------------------------------------------------- /logstash/pipeline/mysql.slow.conf: -------------------------------------------------------------------------------- 1 | input { 2 | file { 3 | type => "mysql-slow" 4 | path => "/xlogs/mysqllog/mariadb-slow.log" 5 | codec => multiline { 6 | pattern => "^# Time" 7 | negate => true 8 | what => "previous" 9 | } 10 | } 11 | } 12 | 13 | filter { 14 | # # Drop "Time" line since it does not appear on every log entry 15 | grok { 16 | match => { 17 | "message" => [ 18 | "# Time: %{GREEDYDATA}\n# User@Host: %{USER:query_user}?(\[%{WORD}\])? @ %{HOSTNAME:query_host} \[%{IP:query_ip}?\]\n# Thread_id: %{NUMBER:query_thread_id:int} Schema: %{DATA:query_schema} QC_hit: %{DATA:query_qc_hit}\n# Query_time: %{NUMBER:query_time:float} Lock_time: %{NUMBER:query_lock_time:float} Rows_sent: %{NUMBER:query_rows_sent:int} Rows_examined: %{NUMBER:query_rows_examined:int}\n# Rows_affected: %{NUMBER:query_rows_affected:int}\n(?:# Full_scan: %{DATA:query_full_scan} Full_join: %{DATA:query_full_join} Tmp_table: %{DATA:query_tmp_table} Tmp_table_on_disk: %{DATA:query_tmp_table_on_disk}\n)?(?:# Filesort: %{DATA:query_filesort} Filesort_on_disk: %{DATA:query_filesort_on_disk} Merge_passes: %{DATA:query_merge_passes} Priority_queue: %{DATA:query_priority_queue}\n)?SET timestamp=%{NUMBER:timestamp:int};\n%{GREEDYDATA:query_sql}" 19 | ] 20 | } 21 | remove_field => "message" 22 | } 23 | date { 24 | match => [ "timestamp", "UNIX" ] 25 | remove_field => [ "timestamp" ] 26 | } 27 | } 28 | 29 | output { 30 | elasticsearch { 31 | hosts => "http://172.25.0.2:9200" 32 | index => "mysql.slow-%{+YYYY.MM.dd}" 33 | user => elastic 34 | password => "123456" 35 | } 36 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Docker ELK Example 2 | 3 | ### 简介 4 | 5 | 快速创建ELK metricbeat x-pack学习环境 6 | 7 | > 目标 8 | 9 | - build-compose快速部署 10 | - 支持[DaoCloud Stack](http://guide.daocloud.io/dcs/%E9%83%A8%E7%BD%B2%E5%A4%8D%E6%9D%82%E7%9A%84%E5%A4%9A%E8%8A%82%E7%82%B9%E5%BE%AE%E6%9C%8D%E5%8A%A1%E5%BA%94%E7%94%A8-9153682.html)自动化部署 11 | - Metricbeat System 监听 12 | - Metricbeat Docker 监听 13 | - Metricbeat Nginx 监听 14 | - Metricbeat Mysql 监听 15 | - Metricbeat Redis 监听 16 | - Metricbeat NodeJs 监听 17 | - Metricbeat Golang 监听 18 | - Metricbeat Kubernetes 监听 19 | - X-pack 权限解析 20 | - ELK 集群 21 | 22 | ### 准备工具 23 | 24 | - [docker-compose](https://docs.docker.com/compose/install/#install-compose) 25 | 26 | ### 本地编译安装 27 | 28 | ``` 29 | $ git clone "https://github.com/wilfordw/docker-elk-example.git" 30 | $ cd docker-elk-example 31 | $ docker-compose up -d 32 | ``` 33 | 34 | ### ~~DaoCloud Stack 自动化部署~~ 35 | 36 | > 开发测试阶段暂不提供 stack 脚本更新,包装完会整体更新 37 | 38 | ``` 39 | $ git clone "https://github.com/wilfordw/docker-elk-example.git" 40 | $ cd docker-elk-example 41 | $ pwd 42 | ``` 43 | 44 | ~~把 dao-docker-compose.yml 内容复制进 Stack 的 YAML, 把上面克隆项目的 `pwd` 替换里面的 `/root/app/docker-elk/`, 点击部署就可以~~ 45 | 46 | > ~~想要自己创建镜像也可以,把你创建好的镜像地址替换 `yml` 里的 `image`~~ 47 | 48 | ### 注意事项 49 | 50 | #### Metricbeat 51 | 52 | > Metricbeat System 监听 无法在 MacOS 或者 Win 上使用, 请关闭(进入 `./metricbeat/modules.d`, 修改 `system.yml` 为 `system.yml.disabled`) 53 | 54 | #### Logstash 55 | 56 | > ~~Logstash 默认使用 x-pack 监听特性,在 kibana 编辑已注册 pipeline ID 的 pipeline。 ( 编辑位置 Kibana > Management > Pipelines ),初始化后必须先添加一个 pipeline 要不 Logstash 无法正常工作~~ 57 | 58 | > ~~Logstash 要恢复默认配置,请修改~~ 59 | 60 | ./logstash/conf/pipeline 61 | 62 | ``` 63 | - pipeline.id: main 64 | path.config: "/usr/share/logstash/pipeline" 65 | ``` 66 | 67 | ./logstash/conf/logstash.yml 68 | 69 | ``` 70 | #xpack.management.enabled: true 71 | #xpack.management.elasticsearch.url: "http://elasticsearch:9200/" 72 | #xpack.management.elasticsearch.username: elastic 73 | #xpack.management.elasticsearch.password: "123456" 74 | #xpack.management.logstash.poll_interval: 5s 75 | #xpack.management.pipeline.id: ["var.log.system","main"] 76 | ``` 77 | 78 | > 可以在 `./logstash/pipeline` 目录下新增自己的管道 79 | 80 | #### 初始账户 81 | 82 | > 初始账号 elastic 密码 123456 修改密码在 `docker-compose.yml` 里修改 `ELASTIC_PASSWORD: 123456`, 其他账号密码可在 kibana 里修改 83 | > **初始密码修改后请同步修改 `./metricbeat/metricbeat.yml`* 84 | ``` 85 | output.elasticsearch: 86 | 87 | ... 88 | 89 | username: "elastic" 90 | password: "" 91 | ``` 92 | 93 | 94 | 95 | ### Change List 96 | 97 | - v1.1.1 98 | - 修复 redis 崩溃 bug 99 | 100 | - v1.1.0 101 | - 暂时去除 DaoCloud Stack 脚本更新,专注 docker-compose 102 | - 新增 mariadb 监控支持 103 | - 新增 redis 监控支持 104 | - 新增 mariadb 慢查询日志分析 105 | - 恢复 logstash 默认设置,不再使用 x-pack management。 106 | 107 | - v1.0.3 108 | - 去除 DaoCloud Stack 脚本 image 版本依赖 (默认 latest) 109 | 110 | - v1.0.2 111 | - 新增 DaoCloud Stack 集成部署支持 112 | - nginx 监控 113 | 114 | - v1.0.1 115 | 116 | - Kibana + Logstash + ElasticSearch + X-pack + Metricbeat docker-compose 构建 117 | - metricbeat 实现系统监控 118 | 119 | 120 | ### TODO 121 | 122 | 123 | - Metricbeat NodeJs 监听 124 | - Metricbeat Golang 监听 125 | - Metricbeat Kubernetes 监听 126 | - X-pack 权限解析 127 | - ELK 集群 128 | - 新增 filebeat 支持 -------------------------------------------------------------------------------- /mac-docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | 5 | elasticsearch: 6 | build: 7 | context: elasticsearch/ 8 | container_name: elasticsearch 9 | volumes: 10 | - esdata:/usr/share/elasticsearch/data 11 | - ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro 12 | ports: 13 | - "9200:9200" 14 | - "9300:9300" 15 | environment: 16 | ES_JAVA_OPTS: "-Xmx256m -Xms256m" 17 | ELASTIC_PASSWORD: "123456" 18 | networks: 19 | elk: 20 | ipv4_address: 172.25.0.2 21 | restart: always 22 | 23 | logstash: 24 | build: 25 | context: logstash/ 26 | container_name: logstash 27 | volumes: 28 | - ./logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml:ro 29 | - ./logstash/config/pipelines.yml:/usr/share/logstash/config/pipelines.yml:ro 30 | - ./logstash/pipeline:/usr/share/logstash/pipeline:ro 31 | - mysqllog:/xlogs/mysqllog:ro 32 | ports: 33 | - "5000:5000" 34 | environment: 35 | LS_JAVA_OPTS: "-Xmx256m -Xms256m" 36 | user: "root" 37 | networks: 38 | elk: 39 | ipv4_address: 172.25.0.3 40 | depends_on: 41 | - elasticsearch 42 | restart: always 43 | 44 | kibana: 45 | build: 46 | context: kibana/ 47 | container_name: kibana 48 | volumes: 49 | - ./kibana/config/:/usr/share/kibana/config:ro 50 | ports: 51 | - "5601:5601" 52 | networks: 53 | elk: 54 | ipv4_address: 172.25.0.4 55 | depends_on: 56 | - elasticsearch 57 | restart: always 58 | 59 | metricbeat: 60 | build: 61 | context: metricbeat/ 62 | container_name: metricbeat 63 | volumes: 64 | - ./metricbeat/metricbeat.yml:/usr/share/metricbeat/metricbeat.yml:ro 65 | - ./metricbeat/modules.d:/usr/share/metricbeat/modules.d:ro 66 | - /var/run/docker.sock:/var/run/docker.sock:ro 67 | - /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime:ro 68 | user: "root" 69 | network_mode: host 70 | depends_on: 71 | - elasticsearch 72 | - kibana 73 | - logstash 74 | restart: always 75 | 76 | nginx: 77 | build: 78 | context: nginx/ 79 | container_name: nginx 80 | volumes: 81 | - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro 82 | - ./nginx/conf.d:/etc/nginx/conf.d:ro 83 | - /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime:ro 84 | ports: 85 | - "80:80" 86 | - "443:443" 87 | networks: 88 | elk: 89 | ipv4_address: 172.25.0.5 90 | depends_on: 91 | - kibana 92 | restart: always 93 | 94 | mysql: 95 | build: 96 | context: mariadb/ 97 | container_name: mysql 98 | volumes: 99 | - mysqldata:/var/lib/mysql 100 | - ./mariadb/conf.d:/etc/mysql/conf.d:ro 101 | - ./mariadb/my.cnf:/etc/mysql/my.cnf:ro 102 | - /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime:ro 103 | - mysqllog:/var/log/mysql 104 | ports: 105 | - "3306:3306" 106 | networks: 107 | elk: 108 | ipv4_address: 172.25.0.6 109 | environment: 110 | MYSQL_ROOT_PASSWORD: root 111 | restart: always 112 | 113 | redis: 114 | build: 115 | context: redis/ 116 | container_name: redis 117 | volumes: 118 | - redisdata:/data 119 | - /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime:ro 120 | ports: 121 | - "6379:6379" 122 | networks: 123 | elk: 124 | ipv4_address: 172.25.0.7 125 | restart: always 126 | 127 | 128 | volumes: 129 | esdata: 130 | driver: local 131 | mysqldata: 132 | driver: local 133 | mysqllog: 134 | driver: local 135 | redisdata: 136 | driver: local 137 | 138 | 139 | networks: 140 | elk: 141 | driver: bridge 142 | ipam: 143 | config: 144 | - subnet: 172.25.0.0/16 145 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | 5 | elasticsearch: 6 | build: 7 | context: elasticsearch/ 8 | container_name: elasticsearch 9 | volumes: 10 | - esdata:/usr/share/elasticsearch/data 11 | - ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro 12 | ports: 13 | - "9200:9200" 14 | - "9300:9300" 15 | environment: 16 | ES_JAVA_OPTS: "-Xmx256m -Xms256m" 17 | ELASTIC_PASSWORD: "123456" 18 | networks: 19 | elk: 20 | ipv4_address: 172.25.0.2 21 | restart: always 22 | 23 | logstash: 24 | build: 25 | context: logstash/ 26 | container_name: logstash 27 | volumes: 28 | - ./logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml:ro 29 | - ./logstash/config/pipelines.yml:/usr/share/logstash/config/pipelines.yml:ro 30 | - ./logstash/pipeline:/usr/share/logstash/pipeline:ro 31 | - mysqllog:/xlogs/mysqllog:ro 32 | ports: 33 | - "5000:5000" 34 | environment: 35 | LS_JAVA_OPTS: "-Xmx256m -Xms256m" 36 | user: "root" 37 | networks: 38 | elk: 39 | ipv4_address: 172.25.0.3 40 | depends_on: 41 | - elasticsearch 42 | restart: always 43 | 44 | kibana: 45 | build: 46 | context: kibana/ 47 | container_name: kibana 48 | volumes: 49 | - ./kibana/config/:/usr/share/kibana/config:ro 50 | ports: 51 | - "5601:5601" 52 | networks: 53 | elk: 54 | ipv4_address: 172.25.0.4 55 | depends_on: 56 | - elasticsearch 57 | restart: always 58 | 59 | metricbeat: 60 | build: 61 | context: metricbeat/ 62 | container_name: metricbeat 63 | volumes: 64 | - /var/run/docker.sock:/var/run/docker.sock:ro 65 | - /proc:/hostfs/proc:ro 66 | - /sys/fs/cgroup:/hostfs/sys/fs/cgroup:ro 67 | - /:/hostfs:ro 68 | - ./metricbeat/metricbeat.yml:/usr/share/metricbeat/metricbeat.yml:ro 69 | - ./metricbeat/modules.d:/usr/share/metricbeat/modules.d:ro 70 | - /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime:ro 71 | user: "root" 72 | network_mode: host 73 | depends_on: 74 | - elasticsearch 75 | - kibana 76 | - logstash 77 | command: -system.hostfs=/hostfs -e 78 | restart: always 79 | 80 | nginx: 81 | build: 82 | context: nginx/ 83 | container_name: nginx 84 | volumes: 85 | - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro 86 | - ./nginx/conf.d:/etc/nginx/conf.d:ro 87 | - /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime:ro 88 | ports: 89 | - "80:80" 90 | - "443:443" 91 | networks: 92 | elk: 93 | ipv4_address: 172.25.0.5 94 | depends_on: 95 | - kibana 96 | restart: always 97 | 98 | mysql: 99 | build: 100 | context: mariadb/ 101 | container_name: mysql 102 | volumes: 103 | - mysqldata:/var/lib/mysql 104 | - ./mariadb/conf.d:/etc/mysql/conf.d:ro 105 | - ./mariadb/my.cnf:/etc/mysql/my.cnf:ro 106 | - /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime:ro 107 | - mysqllog:/var/log/mysql 108 | ports: 109 | - "3306:3306" 110 | networks: 111 | elk: 112 | ipv4_address: 172.25.0.6 113 | environment: 114 | MYSQL_ROOT_PASSWORD: root 115 | restart: always 116 | 117 | redis: 118 | build: 119 | context: redis/ 120 | container_name: redis 121 | volumes: 122 | - redisdata:/data 123 | - /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime:ro 124 | ports: 125 | - "6379:6379" 126 | networks: 127 | elk: 128 | ipv4_address: 172.25.0.7 129 | restart: always 130 | 131 | 132 | volumes: 133 | esdata: 134 | driver: local 135 | mysqldata: 136 | driver: local 137 | mysqllog: 138 | driver: local 139 | redisdata: 140 | driver: local 141 | 142 | 143 | networks: 144 | elk: 145 | driver: bridge 146 | ipam: 147 | config: 148 | - subnet: 172.25.0.0/16 149 | -------------------------------------------------------------------------------- /dao-docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | elasticsearch: 4 | image: daocloud.io/genius0215/elasticsearch 5 | container_name: elasticsearch 6 | volumes: 7 | - esdata:/usr/share/elasticsearch/data 8 | - /root/app/docker-elk/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro 9 | ports: 10 | - 9200:9200 11 | - 9300:9300 12 | environment: 13 | ES_JAVA_OPTS: -Xmx256m -Xms256m 14 | ELASTIC_PASSWORD: '123456' 15 | networks: 16 | elk: 17 | ipv4_address: 172.25.0.2 18 | 19 | 20 | logstash: 21 | image: daocloud.io/genius0215/logstash 22 | container_name: logstash 23 | volumes: 24 | - /root/app/docker-elk/logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml:ro 25 | - /root/app/docker-elk/logstash/config/pipelines.yml:/usr/share/logstash/config/pipelines.yml:ro 26 | - /root/app/docker-elk/logstash/pipeline:/usr/share/logstash/pipeline:ro 27 | - mysqllog:/xlogs/mysqllog:ro 28 | - /var/log:/xlogs/hostlog:ro 29 | ports: 30 | - 5000:5000 31 | environment: 32 | LS_JAVA_OPTS: -Xmx256m -Xms256m 33 | user: root 34 | networks: 35 | elk: 36 | ipv4_address: 172.25.0.3 37 | depends_on: 38 | - elasticsearch 39 | restart: always 40 | 41 | kibana: 42 | image: daocloud.io/genius0215/kibana 43 | container_name: kibana 44 | volumes: 45 | - /root/app/docker-elk/kibana/config/:/usr/share/kibana/config:ro 46 | ports: 47 | - 5601:5601 48 | networks: 49 | elk: 50 | ipv4_address: 172.25.0.4 51 | depends_on: 52 | - elasticsearch 53 | restart: always 54 | 55 | metricbeat: 56 | image: daocloud.io/genius0215/metricbeat 57 | container_name: metricbeat 58 | volumes: 59 | - /root/app/docker-elk/metricbeat/metricbeat.yml:/usr/share/metricbeat/metricbeat.yml:ro 60 | - /root/app/docker-elk/metricbeat/modules.d:/usr/share/metricbeat/modules.d:ro 61 | - /var/run/docker.sock:/var/run/docker.sock:ro 62 | - /proc:/hostfs/proc:ro 63 | - /sys/fs/cgroup:/hostfs/sys/fs/cgroup:ro 64 | - /:/hostfs:ro 65 | - /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime:ro 66 | user: root 67 | network_mode: host 68 | depends_on: 69 | - elasticsearch 70 | - kibana 71 | - logstash 72 | command: -system.hostfs=/hostfs -e 73 | restart: always 74 | 75 | nginx: 76 | image: daocloud.io/genius0215/nginx 77 | container_name: nginx 78 | volumes: 79 | - /root/app/docker-elk/nginx/nginx.conf:/etc/nginx/nginx.conf:ro 80 | - /root/app/docker-elk/nginx/conf.d:/etc/nginx/conf.d:ro 81 | - /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime:ro 82 | ports: 83 | - 80:80 84 | - 443:443 85 | networks: 86 | elk: 87 | ipv4_address: 172.25.0.5 88 | depends_on: 89 | - kibana 90 | restart: always 91 | 92 | mysql: 93 | image: daocloud.io/genius0215/mariadb 94 | container_name: mysql 95 | volumes: 96 | - mysqldata:/var/lib/mysql 97 | - /root/app/docker-elk/mariadb/conf.d:/etc/mysql/conf.d:ro 98 | - /root/app/docker-elk/mariadb/my.cnf:/etc/mysql/my.cnf:ro 99 | - mysqllog:/var/log/mysql 100 | - /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime:ro 101 | ports: 102 | - "3306:3306" 103 | networks: 104 | elk: 105 | ipv4_address: 172.25.0.6 106 | environment: 107 | MYSQL_ROOT_PASSWORD: root 108 | restart: always 109 | 110 | redis: 111 | image: daocloud.io/genius0215/redis 112 | container_name: redis 113 | volumes: 114 | - redisdata:/data 115 | - /root/app/docker-elk//redis.conf:/usr/local/etc/redis/redis.conf 116 | - /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime:ro 117 | ports: 118 | - "6379:6379" 119 | networks: 120 | elk: 121 | ipv4_address: 172.25.0.7 122 | command: "redis-server /usr/local/etc/redis/redis.conf" 123 | restart: always 124 | 125 | volumes: 126 | esdata: 127 | driver: local 128 | mysqldata: 129 | driver: local 130 | mysqllog: 131 | driver: local 132 | redisdata: 133 | driver: local 134 | 135 | networks: 136 | elk: 137 | driver: bridge 138 | ipam: 139 | config: 140 | - subnet: 172.25.0.0/16 141 | -------------------------------------------------------------------------------- /metricbeat/metricbeat.yml: -------------------------------------------------------------------------------- 1 | ###################### Metricbeat Configuration Example ####################### 2 | 3 | # This file is an example configuration file highlighting only the most common 4 | # options. The metricbeat.reference.yml file from the same directory contains all the 5 | # supported options with more comments. You can use it as a reference. 6 | # 7 | # You can find the full configuration reference here: 8 | # https://www.elastic.co/guide/en/beats/metricbeat/index.html 9 | 10 | #========================== Modules configuration ============================ 11 | 12 | metricbeat.config.modules: 13 | # Glob pattern for configuration loading 14 | path: ${path.config}/modules.d/*.yml 15 | 16 | # Set to true to enable config reloading 17 | reload.enabled: false 18 | 19 | # Period on which files under path should be checked for changes 20 | #reload.period: 10s 21 | 22 | #==================== Elasticsearch template setting ========================== 23 | 24 | setup.template.settings: 25 | index.number_of_shards: 1 26 | index.codec: best_compression 27 | #_source.enabled: false 28 | 29 | #================================ General ===================================== 30 | 31 | # The name of the shipper that publishes the network data. It can be used to group 32 | # all the transactions sent by a single shipper in the web interface. 33 | #name: 34 | 35 | # The tags of the shipper are included in their own field with each 36 | # transaction published. 37 | #tags: ["service-X", "web-tier"] 38 | 39 | # Optional fields that you can specify to add additional information to the 40 | # output. 41 | #fields: 42 | # env: staging 43 | 44 | 45 | #============================== Dashboards ===================================== 46 | # These settings control loading the sample dashboards to the Kibana index. Loading 47 | # the dashboards is disabled by default and can be enabled either by setting the 48 | # options here, or by using the `-setup` CLI flag or the `setup` command. 49 | setup.dashboards.enabled: true 50 | 51 | # The URL from where to download the dashboards archive. By default this URL 52 | # has a value which is computed based on the Beat name and version. For released 53 | # versions, this URL points to the dashboard archive on the artifacts.elastic.co 54 | # website. 55 | #setup.dashboards.url: 56 | 57 | #============================== Kibana ===================================== 58 | 59 | # Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API. 60 | # This requires a Kibana endpoint configuration. 61 | setup.kibana: 62 | 63 | # Kibana Host 64 | # Scheme and port can be left out and will be set to the default (http and 5601) 65 | # In case you specify and additional path, the scheme is required: http://localhost:5601/path 66 | # IPv6 addresses should always be defined as: https://[2001:db8::1]:5601 67 | host: "http://172.25.0.4:5601" 68 | 69 | #============================= Elastic Cloud ================================== 70 | 71 | # These settings simplify using metricbeat with the Elastic Cloud (https://cloud.elastic.co/). 72 | 73 | # The cloud.id setting overwrites the `output.elasticsearch.hosts` and 74 | # `setup.kibana.host` options. 75 | # You can find the `cloud.id` in the Elastic Cloud web UI. 76 | #cloud.id: 77 | 78 | # The cloud.auth setting overwrites the `output.elasticsearch.username` and 79 | # `output.elasticsearch.password` settings. The format is `:`. 80 | #cloud.auth: 81 | 82 | #================================ Outputs ===================================== 83 | 84 | # Configure what output to use when sending the data collected by the beat. 85 | 86 | #-------------------------- Elasticsearch output ------------------------------ 87 | output.elasticsearch: 88 | # Array of hosts to connect to. 89 | hosts: ["http://172.25.0.2:9200"] 90 | 91 | # Optional protocol and basic auth credentials. 92 | #protocol: "https" 93 | username: "elastic" 94 | password: "123456" 95 | 96 | #----------------------------- Logstash output -------------------------------- 97 | #output.logstash: 98 | # The Logstash hosts 99 | #hosts: ["localhost:5044"] 100 | 101 | # Optional SSL. By default is off. 102 | # List of root certificates for HTTPS server verifications 103 | #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"] 104 | 105 | # Certificate for SSL client authentication 106 | #ssl.certificate: "/etc/pki/client/cert.pem" 107 | 108 | # Client Certificate Key 109 | #ssl.key: "/etc/pki/client/cert.key" 110 | 111 | #================================ Logging ===================================== 112 | 113 | # Sets log level. The default log level is info. 114 | # Available log levels are: error, warning, info, debug 115 | #logging.level: debug 116 | 117 | # At debug level, you can selectively enable logging only for some components. 118 | # To enable all selectors use ["*"]. Examples of other selectors are "beat", 119 | # "publish", "service". 120 | #logging.selectors: ["*"] 121 | 122 | #============================== Xpack Monitoring =============================== 123 | # metricbeat can export internal metrics to a central Elasticsearch monitoring 124 | # cluster. This requires xpack monitoring to be enabled in Elasticsearch. The 125 | # reporting is disabled by default. 126 | 127 | # Set to true to enable the monitoring reporter. 128 | #xpack.monitoring.enabled: false 129 | 130 | # Uncomment to send the metrics to Elasticsearch. Most settings from the 131 | # Elasticsearch output are accepted here as well. Any setting that is not set is 132 | # automatically inherited from the Elasticsearch output configuration, so if you 133 | # have the Elasticsearch output configured, you can simply uncomment the 134 | # following line. 135 | #xpack.monitoring.elasticsearch: -------------------------------------------------------------------------------- /mariadb/my.cnf: -------------------------------------------------------------------------------- 1 | # MariaDB database server configuration file. 2 | # 3 | # You can copy this file to one of: 4 | # - "/etc/mysql/my.cnf" to set global options, 5 | # - "~/.my.cnf" to set user-specific options. 6 | # 7 | # One can use all long options that the program supports. 8 | # Run program with --help to get a list of available options and with 9 | # --print-defaults to see which it would actually understand and use. 10 | # 11 | # For explanations see 12 | # http://dev.mysql.com/doc/mysql/en/server-system-variables.html 13 | 14 | # This will be passed to all mysql clients 15 | # It has been reported that passwords should be enclosed with ticks/quotes 16 | # escpecially if they contain "#" chars... 17 | # Remember to edit /etc/mysql/debian.cnf when changing the socket location. 18 | [client] 19 | port = 3306 20 | socket = /var/run/mysqld/mysqld.sock 21 | 22 | # Here is entries for some specific programs 23 | # The following values assume you have at least 32M ram 24 | 25 | # This was formally known as [safe_mysqld]. Both versions are currently parsed. 26 | [mysqld_safe] 27 | socket = /var/run/mysqld/mysqld.sock 28 | nice = 0 29 | 30 | [mysqld] 31 | # 32 | # * Basic Settings 33 | # 34 | #user = mysql 35 | pid-file = /var/run/mysqld/mysqld.pid 36 | socket = /var/run/mysqld/mysqld.sock 37 | port = 3306 38 | basedir = /usr 39 | datadir = /var/lib/mysql 40 | tmpdir = /tmp 41 | lc_messages_dir = /usr/share/mysql 42 | lc_messages = en_US 43 | skip-external-locking 44 | # 45 | # Instead of skip-networking the default is now to listen only on 46 | # localhost which is more compatible and is not less secure. 47 | #bind-address = 127.0.0.1 48 | # 49 | # * Fine Tuning 50 | # 51 | max_connections = 100 52 | connect_timeout = 5 53 | wait_timeout = 600 54 | max_allowed_packet = 16M 55 | thread_cache_size = 128 56 | sort_buffer_size = 4M 57 | bulk_insert_buffer_size = 16M 58 | tmp_table_size = 32M 59 | max_heap_table_size = 32M 60 | # 61 | # * MyISAM 62 | # 63 | # This replaces the startup script and checks MyISAM tables if needed 64 | # the first time they are touched. On error, make copy and try a repair. 65 | myisam_recover_options = BACKUP 66 | key_buffer_size = 128M 67 | #open-files-limit = 2000 68 | table_open_cache = 400 69 | myisam_sort_buffer_size = 512M 70 | concurrent_insert = 2 71 | read_buffer_size = 2M 72 | read_rnd_buffer_size = 1M 73 | # 74 | # * Query Cache Configuration 75 | # 76 | # Cache only tiny result sets, so we can fit more in the query cache. 77 | query_cache_limit = 128K 78 | query_cache_size = 64M 79 | # for more write intensive setups, set to DEMAND or OFF 80 | #query_cache_type = DEMAND 81 | # 82 | # * Logging and Replication 83 | # 84 | # Both location gets rotated by the cronjob. 85 | # Be aware that this log type is a performance killer. 86 | # As of 5.1 you can enable the log at runtime! 87 | #general_log_file = /var/log/mysql/mysql.log 88 | #general_log = 1 89 | # 90 | # Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf. 91 | # 92 | # we do want to know about network errors and such 93 | #log_warnings = 2 94 | # 95 | # Enable the slow query log to see queries with especially long duration 96 | slow_query_log = 1 97 | slow_query_log_file = /var/log/mysql/mariadb-slow.log 98 | long_query_time = 10 99 | #log_slow_rate_limit = 1000 100 | #log_slow_verbosity = query_plan 101 | 102 | #log-queries-not-using-indexes 103 | #log_slow_admin_statements 104 | # 105 | # The following can be used as easy to replay backup logs or for replication. 106 | # note: if you are setting up a replication slave, see README.Debian about 107 | # other settings you may need to change. 108 | #server-id = 1 109 | #report_host = master1 110 | #auto_increment_increment = 2 111 | #auto_increment_offset = 1 112 | #log_bin = /var/log/mysql/mariadb-bin 113 | #log_bin_index = /var/log/mysql/mariadb-bin.index 114 | # not fab for performance, but safer 115 | #sync_binlog = 1 116 | expire_logs_days = 10 117 | max_binlog_size = 100M 118 | # slaves 119 | #relay_log = /var/log/mysql/relay-bin 120 | #relay_log_index = /var/log/mysql/relay-bin.index 121 | #relay_log_info_file = /var/log/mysql/relay-bin.info 122 | #log_slave_updates 123 | #read_only 124 | # 125 | # If applications support it, this stricter sql_mode prevents some 126 | # mistakes like inserting invalid dates etc. 127 | #sql_mode = NO_ENGINE_SUBSTITUTION,TRADITIONAL 128 | # 129 | # * InnoDB 130 | # 131 | # InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/. 132 | # Read the manual for more InnoDB related options. There are many! 133 | default_storage_engine = InnoDB 134 | # you can't just change log file size, requires special procedure 135 | #innodb_log_file_size = 50M 136 | innodb_buffer_pool_size = 256M 137 | innodb_log_buffer_size = 8M 138 | innodb_file_per_table = 1 139 | innodb_open_files = 400 140 | innodb_io_capacity = 400 141 | innodb_flush_method = O_DIRECT 142 | # 143 | # * Security Features 144 | # 145 | # Read the manual, too, if you want chroot! 146 | # chroot = /var/lib/mysql/ 147 | # 148 | # For generating SSL certificates I recommend the OpenSSL GUI "tinyca". 149 | # 150 | # ssl-ca=/etc/mysql/cacert.pem 151 | # ssl-cert=/etc/mysql/server-cert.pem 152 | # ssl-key=/etc/mysql/server-key.pem 153 | 154 | # 155 | # * Galera-related settings 156 | # 157 | [galera] 158 | # Mandatory settings 159 | #wsrep_on=ON 160 | #wsrep_provider= 161 | #wsrep_cluster_address= 162 | #binlog_format=row 163 | #default_storage_engine=InnoDB 164 | #innodb_autoinc_lock_mode=2 165 | # 166 | # Allow server to accept connections on all interfaces. 167 | # 168 | #bind-address=0.0.0.0 169 | # 170 | # Optional setting 171 | #wsrep_slave_threads=1 172 | #innodb_flush_log_at_trx_commit=0 173 | 174 | [mysqldump] 175 | quick 176 | quote-names 177 | max_allowed_packet = 16M 178 | 179 | [mysql] 180 | #no-auto-rehash # faster start of mysql but no tab completion 181 | 182 | [isamchk] 183 | key_buffer = 16M 184 | 185 | # 186 | # * IMPORTANT: Additional settings that can override those from this file! 187 | # The files must end with '.cnf', otherwise they'll be ignored. 188 | # 189 | !includedir /etc/mysql/conf.d/ --------------------------------------------------------------------------------