init
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
REGISTER=192.168.0.188/blade
|
||||
TAG=4.10.0.RELEASE
|
||||
@@ -0,0 +1,166 @@
|
||||
#!/bin/bash
|
||||
|
||||
#使用说明,用来提示输入参数
|
||||
usage() {
|
||||
echo "Usage: sh 执行脚本.sh [port|mount|base|monitor|modules|prometheus|alertmanager|stop|rm|rmiNoneTag]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
#开启所需端口
|
||||
port(){
|
||||
#gateway
|
||||
firewall-cmd --add-port=88/tcp --permanent
|
||||
#web
|
||||
firewall-cmd --add-port=8000/tcp --permanent
|
||||
#nacos
|
||||
firewall-cmd --add-port=8848/tcp --permanent
|
||||
firewall-cmd --add-port=9848/tcp --permanent
|
||||
firewall-cmd --add-port=9849/tcp --permanent
|
||||
#sentinel
|
||||
firewall-cmd --add-port=8858/tcp --permanent
|
||||
#grafana
|
||||
firewall-cmd --add-port=3000/tcp --permanent
|
||||
#mysql
|
||||
firewall-cmd --add-port=3306/tcp --permanent
|
||||
#redis
|
||||
firewall-cmd --add-port=3379/tcp --permanent
|
||||
#admin
|
||||
firewall-cmd --add-port=7002/tcp --permanent
|
||||
#ureport
|
||||
firewall-cmd --add-port=8108/tcp --permanent
|
||||
#zipkin
|
||||
firewall-cmd --add-port=9411/tcp --permanent
|
||||
#prometheus
|
||||
firewall-cmd --add-port=9090/tcp --permanent
|
||||
#swagger
|
||||
firewall-cmd --add-port=18000/tcp --permanent
|
||||
#powerjob
|
||||
firewall-cmd --add-port=7700/tcp --permanent
|
||||
firewall-cmd --add-port=10086/tcp --permanent
|
||||
firewall-cmd --add-port=10010/tcp --permanent
|
||||
#firewalld
|
||||
service firewalld restart
|
||||
}
|
||||
|
||||
##放置挂载文件
|
||||
mount(){
|
||||
#挂载配置文件
|
||||
if test ! -f "/docker/nginx/api/nginx.conf" ;then
|
||||
mkdir -p /docker/nginx/api
|
||||
cp nginx/api/nginx.conf /docker/nginx/api/nginx.conf
|
||||
fi
|
||||
if test ! -f "/docker/nginx/web/nginx.conf" ;then
|
||||
mkdir -p /docker/nginx/web
|
||||
cp nginx/web/nginx.conf /docker/nginx/web/nginx.conf
|
||||
cp -r nginx/web/html /docker/nginx/web/html
|
||||
fi
|
||||
if test ! -f "/docker/nacos/conf/application.properties" ;then
|
||||
mkdir -p /docker/nacos/conf
|
||||
cp nacos/conf/application.properties /docker/nacos/conf/application.properties
|
||||
fi
|
||||
if test ! -f "/docker/prometheus/prometheus.yml" ;then
|
||||
mkdir -p /docker/prometheus
|
||||
cp prometheus/config/prometheus.yml /docker/prometheus/prometheus.yml
|
||||
fi
|
||||
if test ! -f "/docker/prometheus/rules/alert_rules.yml" ;then
|
||||
mkdir -p /docker/prometheus/rules
|
||||
cp prometheus/config/alert_rules.yml /docker/prometheus/rules/alert_rules.yml
|
||||
fi
|
||||
if test ! -f "/docker/grafana/grafana.ini" ;then
|
||||
mkdir -p /docker/grafana
|
||||
cp prometheus/config/grafana.ini /docker/grafana/grafana.ini
|
||||
fi
|
||||
if test ! -f "/docker/alertmanager/alertmanager.yml" ;then
|
||||
mkdir -p /docker/alertmanager
|
||||
cp prometheus/config/alertmanager.yml /docker/alertmanager/alertmanager.yml
|
||||
fi
|
||||
if test ! -f "/docker/alertmanager/templates/wechat.tmpl" ;then
|
||||
mkdir -p /docker/alertmanager/templates
|
||||
cp prometheus/config/wechat.tmpl /docker/alertmanager/templates/wechat.tmpl
|
||||
fi
|
||||
if test ! -f "/docker/webhook_dingtalk/dingtalk.yml" ;then
|
||||
mkdir -p /docker/webhook_dingtalk
|
||||
cp prometheus/config/dingtalk.yml /docker/webhook_dingtalk/dingtalk.yml
|
||||
fi
|
||||
#增加目录权限
|
||||
chmod -R 777 /docker/prometheus
|
||||
chmod -R 777 /docker/grafana
|
||||
chmod -R 777 /docker/alertmanager
|
||||
}
|
||||
|
||||
#启动基础模块
|
||||
base(){
|
||||
docker-compose up -d nacos sentinel seata-server web-nginx blade-nginx blade-redis powerjob-server
|
||||
}
|
||||
|
||||
#启动监控模块
|
||||
monitor(){
|
||||
docker-compose up -d blade-admin
|
||||
}
|
||||
|
||||
#启动程序模块
|
||||
modules(){
|
||||
docker-compose up -d blade-gateway1 blade-gateway2 blade-auth1 blade-auth2 blade-report blade-desk blade-system blade-log blade-flow blade-resource blade-job
|
||||
}
|
||||
|
||||
#启动普罗米修斯模块
|
||||
prometheus(){
|
||||
docker-compose up -d prometheus node-exporter mysqld-exporter cadvisor grafana
|
||||
}
|
||||
|
||||
#启动监听模块
|
||||
alertmanager(){
|
||||
docker-compose up -d alertmanager webhook-dingtalk
|
||||
}
|
||||
|
||||
#关闭所有模块
|
||||
stop(){
|
||||
docker-compose stop
|
||||
}
|
||||
|
||||
#删除所有模块
|
||||
rm(){
|
||||
docker-compose rm
|
||||
}
|
||||
|
||||
#删除Tag为空的镜像
|
||||
rmiNoneTag(){
|
||||
docker images|grep none|awk '{print $3}'|xargs docker rmi -f
|
||||
}
|
||||
|
||||
#根据输入参数,选择执行对应方法,不输入则执行使用说明
|
||||
case "$1" in
|
||||
"port")
|
||||
port
|
||||
;;
|
||||
"mount")
|
||||
mount
|
||||
;;
|
||||
"base")
|
||||
base
|
||||
;;
|
||||
"monitor")
|
||||
monitor
|
||||
;;
|
||||
"modules")
|
||||
modules
|
||||
;;
|
||||
"prometheus")
|
||||
prometheus
|
||||
;;
|
||||
"alertmanager")
|
||||
alertmanager
|
||||
;;
|
||||
"stop")
|
||||
stop
|
||||
;;
|
||||
"rm")
|
||||
rm
|
||||
;;
|
||||
"rmiNoneTag")
|
||||
rmiNoneTag
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,366 @@
|
||||
version: '3'
|
||||
services:
|
||||
|
||||
####################################################################################################
|
||||
###=================================== 以下为中间件模块 =========================================###
|
||||
####################################################################################################
|
||||
|
||||
nacos:
|
||||
image: nacos/nacos-server:v3.1.2
|
||||
hostname: "nacos-standalone"
|
||||
environment:
|
||||
- NACOS_AUTH_ENABLE=true
|
||||
- NACOS_AUTH_CACHE_ENABLE=true
|
||||
- NACOS_AUTH_IDENTITY_KEY=nacos
|
||||
- NACOS_AUTH_IDENTITY_VALUE=nacos
|
||||
- NACOS_AUTH_TOKEN= # 请阅读官方文档了解规则后替换为自己的token:https://nacos.io/zh-cn/docs/v2/guide/user/auth.html
|
||||
- MODE=standalone
|
||||
- TZ=Asia/Shanghai
|
||||
volumes:
|
||||
- /docker/nacos/standalone-logs/:/home/nacos/logs
|
||||
- /docker/nacos/conf/application.properties:/home/nacos/conf/application.properties
|
||||
ports:
|
||||
- 8848:8848
|
||||
- 9848:9848
|
||||
- 8080:8080
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.48
|
||||
|
||||
sentinel:
|
||||
image: bladex/sentinel-dashboard:1.8.6
|
||||
hostname: "sentinel"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
ports:
|
||||
- 8858:8858
|
||||
restart: on-failure
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.58
|
||||
|
||||
seata-server:
|
||||
image: seataio/seata-server:1.6.1
|
||||
hostname: "seata-server"
|
||||
ports:
|
||||
- 8091:8091
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
- SEATA_PORT=8091
|
||||
- STORE_MODE=file
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.68
|
||||
|
||||
blade-nginx:
|
||||
image: nginx:stable-alpine-perl
|
||||
hostname: "blade-nginx"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
ports:
|
||||
- 88:88
|
||||
volumes:
|
||||
- /docker/nginx/api/nginx.conf:/etc/nginx/nginx.conf
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
- blade_net
|
||||
|
||||
web-nginx:
|
||||
image: nginx:stable-alpine-perl
|
||||
hostname: "web-nginx"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
ports:
|
||||
- 8000:8000
|
||||
volumes:
|
||||
- /docker/nginx/web/html:/usr/share/nginx/html
|
||||
- /docker/nginx/web/nginx.conf:/etc/nginx/nginx.conf
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
- blade_net
|
||||
|
||||
blade-redis:
|
||||
image: redis:7-alpine
|
||||
hostname: "blade-redis"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
ports:
|
||||
- 3379:6379
|
||||
volumes:
|
||||
- /docker/redis/data:/data
|
||||
command: "redis-server --appendonly yes"
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
- blade_net
|
||||
|
||||
##powerjob.network.external.address可配置为外部宿主机地址,更详细见:https://www.yuque.com/powerjob/guidence/deploy_server
|
||||
powerjob-server:
|
||||
container_name: powerjob-server
|
||||
image: powerjob/powerjob-server:4.3.6
|
||||
restart: always
|
||||
environment:
|
||||
JVMOPTIONS: "-Xmx512m -Dpowerjob.network.external.address=172.30.0.70 -Dpowerjob.network.external.port.http=10010 -Dpowerjob.network.external.port.akka=10086"
|
||||
PARAMS: "--spring.datasource.core.jdbc-url=jdbc:mysql://mysql服务ip:端口/powerjob-product?useUnicode=true&characterEncoding=UTF-8&useSSL=false --spring.datasource.core.username=mysql账号名 --spring.datasource.core.password=mysql密码 --oms.mongodb.enable=false"
|
||||
ports:
|
||||
- 7700:7700
|
||||
- 10086:10086
|
||||
- 10010:10010
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.70
|
||||
|
||||
####################################################################################################
|
||||
###================================= 以下为BladeX服务模块 =======================================###
|
||||
####################################################################################################
|
||||
|
||||
blade-admin:
|
||||
image: "${REGISTER}/blade-admin:${TAG}"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
ports:
|
||||
- 7002:7002
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.72
|
||||
|
||||
blade-gateway1:
|
||||
image: "${REGISTER}/blade-gateway:${TAG}"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.81
|
||||
|
||||
blade-gateway2:
|
||||
image: "${REGISTER}/blade-gateway:${TAG}"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.82
|
||||
|
||||
blade-auth1:
|
||||
image: "${REGISTER}/blade-auth:${TAG}"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.91
|
||||
|
||||
blade-auth2:
|
||||
image: "${REGISTER}/blade-auth:${TAG}"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.92
|
||||
|
||||
blade-report:
|
||||
image: "${REGISTER}/blade-report:${TAG}"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
privileged: true
|
||||
restart: always
|
||||
ports:
|
||||
- 8108:8108
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.98
|
||||
|
||||
blade-log:
|
||||
image: "${REGISTER}/blade-log:${TAG}"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
- blade_net
|
||||
|
||||
blade-desk:
|
||||
image: "${REGISTER}/blade-desk:${TAG}"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
- blade_net
|
||||
|
||||
blade-system:
|
||||
image: "${REGISTER}/blade-system:${TAG}"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
- blade_net
|
||||
|
||||
blade-flow:
|
||||
image: "${REGISTER}/blade-flow:${TAG}"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
- blade_net
|
||||
|
||||
blade-resource:
|
||||
image: "${REGISTER}/blade-resource:${TAG}"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
- blade_net
|
||||
|
||||
blade-job:
|
||||
image: "${REGISTER}/blade-job:${TAG}"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
- blade_net
|
||||
|
||||
####################################################################################################
|
||||
###=============================== 以下为Prometheus监控模块 =====================================###
|
||||
####################################################################################################
|
||||
|
||||
prometheus:
|
||||
image: prom/prometheus:v2.24.1
|
||||
hostname: "prometheus"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
ports:
|
||||
- 9090:9090
|
||||
volumes:
|
||||
- /docker/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
|
||||
- /docker/prometheus/rules:/etc/prometheus/rules
|
||||
command: "--config.file=/etc/prometheus/prometheus.yml --web.enable-lifecycle"
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.90
|
||||
|
||||
node-exporter:
|
||||
image: prom/node-exporter:v1.0.1
|
||||
hostname: "node-exporter"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
ports:
|
||||
- 9190:9100
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.93
|
||||
|
||||
mysqld-exporter:
|
||||
image: prom/mysqld-exporter:v0.12.1
|
||||
hostname: "mysqld-exporter"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
# 需要先在mysql服务执行如下语句
|
||||
# =====================================================================================
|
||||
# === CREATE USER 'exporter'@'mysql服务ip' IDENTIFIED BY '密码'; ===
|
||||
# === GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'exporter'@'mysql服务ip'; ===
|
||||
# === flush privileges; ===
|
||||
# =====================================================================================
|
||||
- DATA_SOURCE_NAME=exporter:密码@(mysql服务ip:mysql服务端口)/
|
||||
ports:
|
||||
- 9104:9104
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.94
|
||||
|
||||
cadvisor:
|
||||
image: google/cadvisor:v0.33.0
|
||||
hostname: "cadvisor"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
ports:
|
||||
- 18080:8080
|
||||
volumes:
|
||||
- /:/rootfs:ro
|
||||
- /var/run:/var/run:rw
|
||||
- /sys:/sys:ro
|
||||
- /var/lib/docker/:/var/lib/docker:ro
|
||||
- /dev/disk/:/dev/disk:ro
|
||||
command: "detach=true"
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.180
|
||||
|
||||
grafana:
|
||||
image: grafana/grafana:7.3.7
|
||||
hostname: "grafana"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
- GF_SERVER_ROOT_URL=https://grafana.bladex.vip
|
||||
- GF_SECURITY_ADMIN_PASSWORD=1qaz@WSX
|
||||
ports:
|
||||
- 3000:3000
|
||||
volumes:
|
||||
- /docker/grafana/grafana.ini:/etc/grafana/grafana.ini
|
||||
- /docker/grafana:/var/lib/grafana
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.30
|
||||
|
||||
alertmanager:
|
||||
image: prom/alertmanager:v0.21.0
|
||||
hostname: "alertmanager"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
ports:
|
||||
- 9093:9093
|
||||
volumes:
|
||||
- /docker/alertmanager/alertmanager.yml:/etc/alertmanager/alertmanager.yml
|
||||
- /docker/alertmanager/data:/etc/alertmanager/data
|
||||
- /docker/alertmanager/templates:/etc/alertmanager/templates
|
||||
command: "--config.file=/etc/alertmanager/alertmanager.yml --storage.path=/etc/alertmanager/data"
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.99
|
||||
|
||||
webhook-dingtalk:
|
||||
image: timonwong/prometheus-webhook-dingtalk:v1.4.0
|
||||
hostname: "webhook-dingtalk"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
ports:
|
||||
- 8060:8060
|
||||
command: "ding.profile=webhook_robot=https://oapi.dingtalk.com/robot/send?access_token=xxxxx"
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.96
|
||||
|
||||
networks:
|
||||
blade_net:
|
||||
driver: bridge
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.30.0.0/16
|
||||
@@ -0,0 +1,55 @@
|
||||
# spring
|
||||
server.servlet.contextPath=${SERVER_SERVLET_CONTEXTPATH:/nacos}
|
||||
server.contextPath=/nacos
|
||||
server.port=${NACOS_APPLICATION_PORT:8848}
|
||||
server.tomcat.accesslog.max-days=30
|
||||
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i
|
||||
server.tomcat.accesslog.enabled=${TOMCAT_ACCESSLOG_ENABLED:false}
|
||||
server.error.include-message=ALWAYS
|
||||
# default current work dir
|
||||
server.tomcat.basedir=file:.
|
||||
#*************** Config Module Related Configurations ***************#
|
||||
### Deprecated configuration property, it is recommended to use `spring.sql.init.platform` replaced.
|
||||
#spring.datasource.platform=${SPRING_DATASOURCE_PLATFORM:}
|
||||
spring.sql.init.platform=${SPRING_DATASOURCE_PLATFORM:}
|
||||
nacos.cmdb.dumpTaskInterval=3600
|
||||
nacos.cmdb.eventTaskInterval=10
|
||||
nacos.cmdb.labelTaskInterval=300
|
||||
nacos.cmdb.loadDataAtStart=false
|
||||
db.num=${MYSQL_DATABASE_NUM:1}
|
||||
db.url.0=jdbc:mysql://${MYSQL_SERVICE_HOST}:${MYSQL_SERVICE_PORT:3306}/${MYSQL_SERVICE_DB_NAME}?${MYSQL_SERVICE_DB_PARAM:characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false}
|
||||
db.user.0=${MYSQL_SERVICE_USER}
|
||||
db.password.0=${MYSQL_SERVICE_PASSWORD}
|
||||
## DB connection pool settings
|
||||
db.pool.config.connectionTimeout=${DB_POOL_CONNECTION_TIMEOUT:30000}
|
||||
db.pool.config.validationTimeout=10000
|
||||
db.pool.config.maximumPoolSize=20
|
||||
db.pool.config.minimumIdle=2
|
||||
### The auth system to use, currently only 'nacos' and 'ldap' is supported:
|
||||
nacos.core.auth.system.type=${NACOS_AUTH_SYSTEM_TYPE:nacos}
|
||||
### worked when nacos.core.auth.system.type=nacos
|
||||
### The token expiration in seconds:
|
||||
nacos.core.auth.plugin.nacos.token.expire.seconds=${NACOS_AUTH_TOKEN_EXPIRE_SECONDS:18000}
|
||||
### The default token:
|
||||
nacos.core.auth.plugin.nacos.token.secret.key=${NACOS_AUTH_TOKEN:}
|
||||
### Turn on/off caching of auth information. By turning on this switch, the update of auth information would have a 15 seconds delay.
|
||||
nacos.core.auth.caching.enabled=${NACOS_AUTH_CACHE_ENABLE:false}
|
||||
nacos.core.auth.enable.userAgentAuthWhite=${NACOS_AUTH_USER_AGENT_AUTH_WHITE_ENABLE:false}
|
||||
nacos.core.auth.server.identity.key=${NACOS_AUTH_IDENTITY_KEY:}
|
||||
nacos.core.auth.server.identity.value=${NACOS_AUTH_IDENTITY_VALUE:}
|
||||
## spring security config
|
||||
### turn off security
|
||||
nacos.security.ignore.urls=${NACOS_SECURITY_IGNORE_URLS:/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**}
|
||||
# metrics for elastic search
|
||||
management.metrics.export.elastic.enabled=false
|
||||
management.metrics.export.influx.enabled=false
|
||||
nacos.naming.distro.taskDispatchThreadCount=10
|
||||
nacos.naming.distro.taskDispatchPeriod=200
|
||||
nacos.naming.distro.batchSyncKeyCount=1000
|
||||
nacos.naming.distro.initDataRatio=0.9
|
||||
nacos.naming.distro.syncRetryDelay=5000
|
||||
nacos.naming.data.warmup=true
|
||||
nacos.console.ui.enabled=true
|
||||
nacos.core.param.check.enabled=true
|
||||
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
|
||||
user root;
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
#include /etc/nginx/conf.d/*.conf;
|
||||
|
||||
upstream gateway {
|
||||
server 172.30.0.81;
|
||||
server 172.30.0.82;
|
||||
}
|
||||
|
||||
upstream auth {
|
||||
server 172.30.0.91:8100;
|
||||
server 172.30.0.92:8100;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 88;
|
||||
server_name gateway;
|
||||
location / {
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_buffering off;
|
||||
proxy_pass http://gateway/;
|
||||
}
|
||||
|
||||
location ~ ^/(api/)?actuator {
|
||||
return 403;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 9000;
|
||||
server_name auth;
|
||||
location / {
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_buffering off;
|
||||
proxy_pass http://auth/;
|
||||
}
|
||||
|
||||
location ~ ^/(api/)?actuator {
|
||||
return 403;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Hello BladeX</title>
|
||||
</head>
|
||||
<body>
|
||||
<div style="text-align: center">Hello BladeX !</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,77 @@
|
||||
|
||||
user root;
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#include /etc/nginx/conf.d/*.conf;
|
||||
|
||||
gzip on;
|
||||
gzip_min_length 1k;
|
||||
gzip_buffers 4 16k;
|
||||
gzip_http_version 1.1;
|
||||
gzip_comp_level 2;
|
||||
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml;
|
||||
gzip_vary on;
|
||||
gzip_proxied expired no-cache no-store private auth;
|
||||
gzip_disable "MSIE [1-6]\.";
|
||||
|
||||
upstream gateway {
|
||||
server 172.30.0.81;
|
||||
server 172.30.0.82;
|
||||
}
|
||||
|
||||
|
||||
server {
|
||||
listen 8000;
|
||||
server_name web;
|
||||
root /usr/share/nginx/html;
|
||||
|
||||
location /{
|
||||
index index.html;
|
||||
error_page 404 /index.html;
|
||||
}
|
||||
|
||||
location ~ ^/(api/)?actuator {
|
||||
return 403;
|
||||
}
|
||||
|
||||
location ^~ /oauth/redirect {
|
||||
rewrite ^(.*)$ /index.html break;
|
||||
}
|
||||
|
||||
location ^~ /api/ {
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_buffering off;
|
||||
rewrite ^/api/(.*)$ /$1 break;
|
||||
proxy_pass http://gateway/;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
groups:
|
||||
- name: alert_rules
|
||||
rules:
|
||||
- alert: CpuUsageAlertWarning
|
||||
expr: sum(avg(irate(node_cpu_seconds_total{mode!='idle'}[5m])) without (cpu)) by (instance) > 0.60
|
||||
for: 2m
|
||||
labels:
|
||||
level: warning
|
||||
annotations:
|
||||
summary: "Instance {{ $labels.instance }} CPU usage high"
|
||||
description: "{{ $labels.instance }} CPU usage above 60% (current value: {{ $value }})"
|
||||
- alert: CpuUsageAlertSerious
|
||||
#expr: sum(avg(irate(node_cpu_seconds_total{mode!='idle'}[5m])) without (cpu)) by (instance) > 0.85
|
||||
expr: (100 - (avg by (instance) (irate(node_cpu_seconds_total{job=~".*",mode="idle"}[5m])) * 100)) > 85
|
||||
for: 3m
|
||||
labels:
|
||||
level: serious
|
||||
annotations:
|
||||
summary: "Instance {{ $labels.instance }} CPU usage high"
|
||||
description: "{{ $labels.instance }} CPU usage above 85% (current value: {{ $value }})"
|
||||
- alert: MemUsageAlertWarning
|
||||
expr: avg by(instance) ((1 - (node_memory_MemFree_bytes + node_memory_Buffers_bytes + node_memory_Cached_bytes) / node_memory_MemTotal_bytes) * 100) > 70
|
||||
for: 2m
|
||||
labels:
|
||||
level: warning
|
||||
annotations:
|
||||
summary: "Instance {{ $labels.instance }} MEM usage high"
|
||||
description: "{{$labels.instance}}: MEM usage is above 70% (current value is: {{ $value }})"
|
||||
- alert: MemUsageAlertSerious
|
||||
expr: (node_memory_MemTotal_bytes - node_memory_MemAvailable_bytes)/node_memory_MemTotal_bytes > 0.90
|
||||
for: 3m
|
||||
labels:
|
||||
level: serious
|
||||
annotations:
|
||||
summary: "Instance {{ $labels.instance }} MEM usage high"
|
||||
description: "{{ $labels.instance }} MEM usage above 90% (current value: {{ $value }})"
|
||||
- alert: DiskUsageAlertWarning
|
||||
expr: (1 - node_filesystem_free_bytes{fstype!="rootfs",mountpoint!="",mountpoint!~"/(run|var|sys|dev).*"} / node_filesystem_size_bytes) * 100 > 80
|
||||
for: 2m
|
||||
labels:
|
||||
level: warning
|
||||
annotations:
|
||||
summary: "Instance {{ $labels.instance }} Disk usage high"
|
||||
description: "{{$labels.instance}}: Disk usage is above 80% (current value is: {{ $value }})"
|
||||
- alert: DiskUsageAlertSerious
|
||||
expr: (1 - node_filesystem_free_bytes{fstype!="rootfs",mountpoint!="",mountpoint!~"/(run|var|sys|dev).*"} / node_filesystem_size_bytes) * 100 > 90
|
||||
for: 3m
|
||||
labels:
|
||||
level: serious
|
||||
annotations:
|
||||
summary: "Instance {{ $labels.instance }} Disk usage high"
|
||||
description: "{{$labels.instance}}: Disk usage is above 90% (current value is: {{ $value }})"
|
||||
- alert: NodeFileDescriptorUsage
|
||||
expr: avg by (instance) (node_filefd_allocated{} / node_filefd_maximum{}) * 100 > 60
|
||||
for: 2m
|
||||
labels:
|
||||
level: warning
|
||||
annotations:
|
||||
summary: "Instance {{ $labels.instance }} File Descriptor usage high"
|
||||
description: "{{$labels.instance}}: File Descriptor usage is above 60% (current value is: {{ $value }})"
|
||||
- alert: NodeLoad15
|
||||
expr: avg by (instance) (node_load15{}) > 80
|
||||
for: 2m
|
||||
labels:
|
||||
level: warning
|
||||
annotations:
|
||||
summary: "Instance {{ $labels.instance }} Load15 usage high"
|
||||
description: "{{$labels.instance}}: Load15 is above 80 (current value is: {{ $value }})"
|
||||
- alert: NodeAgentStatus
|
||||
expr: avg by (instance) (up{}) == 0
|
||||
for: 2m
|
||||
labels:
|
||||
level: warning
|
||||
annotations:
|
||||
summary: "{{$labels.instance}}: has been down"
|
||||
description: "{{$labels.instance}}: Node_Exporter Agent is down (current value is: {{ $value }})"
|
||||
- alert: NodeProcsBlocked
|
||||
expr: avg by (instance) (node_procs_blocked{}) > 10
|
||||
for: 2m
|
||||
labels:
|
||||
level: warning
|
||||
annotations:
|
||||
summary: "Instance {{ $labels.instance }} Process Blocked usage high"
|
||||
description: "{{$labels.instance}}: Node Blocked Procs detected! above 10 (current value is: {{ $value }})"
|
||||
- alert: NetworkTransmitRate
|
||||
#expr: avg by (instance) (floor(irate(node_network_transmit_bytes_total{device="ens192"}[2m]) / 1024 / 1024)) > 50
|
||||
expr: avg by (instance) (floor(irate(node_network_transmit_bytes_total{}[2m]) / 1024 / 1024 * 8 )) > 40
|
||||
for: 1m
|
||||
labels:
|
||||
level: warning
|
||||
annotations:
|
||||
summary: "Instance {{ $labels.instance }} Network Transmit Rate usage high"
|
||||
description: "{{$labels.instance}}: Node Transmit Rate (Upload) is above 40Mbps/s (current value is: {{ $value }}Mbps/s)"
|
||||
- alert: NetworkReceiveRate
|
||||
#expr: avg by (instance) (floor(irate(node_network_receive_bytes_total{device="ens192"}[2m]) / 1024 / 1024)) > 50
|
||||
expr: avg by (instance) (floor(irate(node_network_receive_bytes_total{}[2m]) / 1024 / 1024 * 8 )) > 40
|
||||
for: 1m
|
||||
labels:
|
||||
level: warning
|
||||
annotations:
|
||||
summary: "Instance {{ $labels.instance }} Network Receive Rate usage high"
|
||||
description: "{{$labels.instance}}: Node Receive Rate (Download) is above 40Mbps/s (current value is: {{ $value }}Mbps/s)"
|
||||
- alert: DiskReadRate
|
||||
expr: avg by (instance) (floor(irate(node_disk_read_bytes_total{}[2m]) / 1024 )) > 200
|
||||
for: 2m
|
||||
labels:
|
||||
level: warning
|
||||
annotations:
|
||||
summary: "Instance {{ $labels.instance }} Disk Read Rate usage high"
|
||||
description: "{{$labels.instance}}: Node Disk Read Rate is above 200KB/s (current value is: {{ $value }}KB/s)"
|
||||
- alert: DiskWriteRate
|
||||
expr: avg by (instance) (floor(irate(node_disk_written_bytes_total{}[2m]) / 1024 / 1024 )) > 20
|
||||
for: 2m
|
||||
labels:
|
||||
level: warning
|
||||
annotations:
|
||||
summary: "Instance {{ $labels.instance }} Disk Write Rate usage high"
|
||||
description: "{{$labels.instance}}: Node Disk Write Rate is above 20MB/s (current value is: {{ $value }}MB/s)"
|
||||
@@ -0,0 +1,56 @@
|
||||
global:
|
||||
# 在没有报警的情况下声明为已解决的时间
|
||||
resolve_timeout: 5m
|
||||
# 配置邮件发送信息
|
||||
smtp_smarthost: 'smtp.163.com:25'
|
||||
# 邮箱地址
|
||||
smtp_from: 'bladejava@163.com'
|
||||
# 邮箱地址
|
||||
smtp_auth_username: 'bladejava@163.com'
|
||||
# 邮箱授权码,需要自行开启设置,非邮箱密码
|
||||
smtp_auth_password: 'xxxxxxxx'
|
||||
# 邮箱地址
|
||||
smtp_hello: 'bladejava@163.com'
|
||||
smtp_require_tls: false
|
||||
|
||||
templates:
|
||||
# 告警模板文件
|
||||
- "/etc/alertmanager/templates/wechat.tmpl"
|
||||
|
||||
route:
|
||||
# 接收到告警后到自定义分组
|
||||
group_by: ["alertname"]
|
||||
# 分组创建后初始化等待时长
|
||||
group_wait: 10s
|
||||
# 告警信息发送之前的等待时长
|
||||
group_interval: 30s
|
||||
# 重复报警的间隔时长
|
||||
repeat_interval: 5m
|
||||
# 默认消息接收
|
||||
receiver: "wechat"
|
||||
|
||||
receivers:
|
||||
# 微信
|
||||
- name: "wechat"
|
||||
wechat_configs:
|
||||
# 是否发送恢复信息
|
||||
- send_resolved: true
|
||||
# 填写应用 AgentId
|
||||
agent_id: "1000002"
|
||||
# 填写应用 Secret
|
||||
api_secret: "jxxxxxxxxxxxxxxxxxxxc"
|
||||
# 填写企业 ID
|
||||
corp_id: "wwxxxxxxxxxxx01d"
|
||||
# 填写接收消息的群体
|
||||
to_user: "@all"
|
||||
# 钉钉
|
||||
- name: 'dingtalk'
|
||||
webhook_configs:
|
||||
# prometheus-webhook-dingtalk服务的地址
|
||||
- url: http://172.30.0.96:8060/dingtalk/webhook_robot/send
|
||||
send_resolved: true
|
||||
# 邮件
|
||||
- name: 'email'
|
||||
email_configs:
|
||||
- to: 'your email'
|
||||
send_resolved: true
|
||||
@@ -0,0 +1,12 @@
|
||||
timeout: 5s
|
||||
|
||||
targets:
|
||||
webhook_robot:
|
||||
# 钉钉机器人创建后的webhook地址
|
||||
url: https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxxxxxx
|
||||
webhook_mention_all:
|
||||
# 钉钉机器人创建后的webhook地址
|
||||
url: https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxxxxxx
|
||||
# 提醒全员
|
||||
mention:
|
||||
all: true
|
||||
@@ -0,0 +1,849 @@
|
||||
##################### Grafana Configuration Example #####################
|
||||
#
|
||||
# Everything has defaults so you only need to uncomment things you want to
|
||||
# change
|
||||
|
||||
# possible values : production, development
|
||||
;app_mode = production
|
||||
|
||||
# instance name, defaults to HOSTNAME environment variable value or hostname if HOSTNAME var is empty
|
||||
;instance_name = ${HOSTNAME}
|
||||
|
||||
#################################### Paths ####################################
|
||||
[paths]
|
||||
# Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used)
|
||||
;data = /var/lib/grafana
|
||||
|
||||
# Temporary files in `data` directory older than given duration will be removed
|
||||
;temp_data_lifetime = 24h
|
||||
|
||||
# Directory where grafana can store logs
|
||||
;logs = /var/log/grafana
|
||||
|
||||
# Directory where grafana will automatically scan and look for plugins
|
||||
;plugins = /var/lib/grafana/plugins
|
||||
|
||||
# folder that contains provisioning config files that grafana will apply on startup and while running.
|
||||
;provisioning = conf/provisioning
|
||||
|
||||
#################################### Server ####################################
|
||||
[server]
|
||||
# Protocol (http, https, h2, socket)
|
||||
;protocol = http
|
||||
|
||||
# The ip address to bind to, empty will bind to all interfaces
|
||||
;http_addr =
|
||||
|
||||
# The http port to use
|
||||
;http_port = 3000
|
||||
|
||||
# The public facing domain name used to access grafana from a browser
|
||||
;domain = localhost
|
||||
|
||||
# Redirect to correct domain if host header does not match domain
|
||||
# Prevents DNS rebinding attacks
|
||||
;enforce_domain = false
|
||||
|
||||
# The full public facing url you use in browser, used for redirects and emails
|
||||
# If you use reverse proxy and sub path specify full url (with sub path)
|
||||
;root_url = %(protocol)s://%(domain)s:%(http_port)s/
|
||||
|
||||
# Serve Grafana from subpath specified in `root_url` setting. By default it is set to `false` for compatibility reasons.
|
||||
;serve_from_sub_path = false
|
||||
|
||||
# Log web requests
|
||||
;router_logging = false
|
||||
|
||||
# the path relative working path
|
||||
;static_root_path = public
|
||||
|
||||
# enable gzip
|
||||
;enable_gzip = false
|
||||
|
||||
# https certs & key file
|
||||
;cert_file =
|
||||
;cert_key =
|
||||
|
||||
# Unix socket path
|
||||
;socket =
|
||||
|
||||
#################################### Database ####################################
|
||||
[database]
|
||||
# You can configure the database connection by specifying type, host, name, user and password
|
||||
# as separate properties or as on string using the url properties.
|
||||
|
||||
# Either "mysql", "postgres" or "sqlite3", it's your choice
|
||||
;type = sqlite3
|
||||
;host = 127.0.0.1:3306
|
||||
;name = grafana
|
||||
;user = root
|
||||
# If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;"""
|
||||
;password =
|
||||
|
||||
# Use either URL or the previous fields to configure the database
|
||||
# Example: mysql://user:secret@host:port/database
|
||||
;url =
|
||||
|
||||
# For "postgres" only, either "disable", "require" or "verify-full"
|
||||
;ssl_mode = disable
|
||||
|
||||
;ca_cert_path =
|
||||
;client_key_path =
|
||||
;client_cert_path =
|
||||
;server_cert_name =
|
||||
|
||||
# For "sqlite3" only, path relative to data_path setting
|
||||
;path = grafana.db
|
||||
|
||||
# Max idle conn setting default is 2
|
||||
;max_idle_conn = 2
|
||||
|
||||
# Max conn setting default is 0 (mean not set)
|
||||
;max_open_conn =
|
||||
|
||||
# Connection Max Lifetime default is 14400 (means 14400 seconds or 4 hours)
|
||||
;conn_max_lifetime = 14400
|
||||
|
||||
# Set to true to log the sql calls and execution times.
|
||||
;log_queries =
|
||||
|
||||
# For "sqlite3" only. cache mode setting used for connecting to the database. (private, shared)
|
||||
;cache_mode = private
|
||||
|
||||
#################################### Cache server #############################
|
||||
[remote_cache]
|
||||
# Either "redis", "memcached" or "database" default is "database"
|
||||
;type = database
|
||||
|
||||
# cache connectionstring options
|
||||
# database: will use Grafana primary database.
|
||||
# redis: config like redis server e.g. `addr=127.0.0.1:6379,pool_size=100,db=0,ssl=false`. Only addr is required. ssl may be 'true', 'false', or 'insecure'.
|
||||
# memcache: 127.0.0.1:11211
|
||||
;connstr =
|
||||
|
||||
#################################### Data proxy ###########################
|
||||
[dataproxy]
|
||||
|
||||
# This enables data proxy logging, default is false
|
||||
;logging = false
|
||||
|
||||
# How long the data proxy waits before timing out, default is 30 seconds.
|
||||
# This setting also applies to core backend HTTP data sources where query requests use an HTTP client with timeout set.
|
||||
;timeout = 30
|
||||
|
||||
# How many seconds the data proxy waits before sending a keepalive probe request.
|
||||
;keep_alive_seconds = 30
|
||||
|
||||
# How many seconds the data proxy waits for a successful TLS Handshake before timing out.
|
||||
;tls_handshake_timeout_seconds = 10
|
||||
|
||||
# How many seconds the data proxy will wait for a server's first response headers after
|
||||
# fully writing the request headers if the request has an "Expect: 100-continue"
|
||||
# header. A value of 0 will result in the body being sent immediately, without
|
||||
# waiting for the server to approve.
|
||||
;expect_continue_timeout_seconds = 1
|
||||
|
||||
# The maximum number of idle connections that Grafana will keep alive.
|
||||
;max_idle_connections = 100
|
||||
|
||||
# How many seconds the data proxy keeps an idle connection open before timing out.
|
||||
;idle_conn_timeout_seconds = 90
|
||||
|
||||
# If enabled and user is not anonymous, data proxy will add X-Grafana-User header with username into the request, default is false.
|
||||
;send_user_header = false
|
||||
|
||||
#################################### Analytics ####################################
|
||||
[analytics]
|
||||
# Server reporting, sends usage counters to stats.grafana.org every 24 hours.
|
||||
# No ip addresses are being tracked, only simple counters to track
|
||||
# running instances, dashboard and error counts. It is very helpful to us.
|
||||
# Change this option to false to disable reporting.
|
||||
;reporting_enabled = true
|
||||
|
||||
# Set to false to disable all checks to https://grafana.net
|
||||
# for new versions (grafana itself and plugins), check is used
|
||||
# in some UI views to notify that grafana or plugin update exists
|
||||
# This option does not cause any auto updates, nor send any information
|
||||
# only a GET request to http://grafana.com to get latest versions
|
||||
;check_for_updates = true
|
||||
|
||||
# Google Analytics universal tracking code, only enabled if you specify an id here
|
||||
;google_analytics_ua_id =
|
||||
|
||||
# Google Tag Manager ID, only enabled if you specify an id here
|
||||
;google_tag_manager_id =
|
||||
|
||||
#################################### Security ####################################
|
||||
[security]
|
||||
# disable creation of admin user on first start of grafana
|
||||
;disable_initial_admin_creation = false
|
||||
|
||||
# default admin user, created on startup
|
||||
;admin_user = admin
|
||||
|
||||
# default admin password, can be changed before first start of grafana, or in profile settings
|
||||
;admin_password = admin
|
||||
|
||||
# used for signing
|
||||
;secret_key = SW2YcwTIb9zpOOhoPsMm
|
||||
|
||||
# disable gravatar profile images
|
||||
;disable_gravatar = false
|
||||
|
||||
# data source proxy whitelist (ip_or_domain:port separated by spaces)
|
||||
;data_source_proxy_whitelist =
|
||||
|
||||
# disable protection against brute force login attempts
|
||||
;disable_brute_force_login_protection = false
|
||||
|
||||
# set to true if you host Grafana behind HTTPS. default is false.
|
||||
;cookie_secure = false
|
||||
|
||||
# set cookie SameSite attribute. defaults to `lax`. can be set to "lax", "strict", "none" and "disabled"
|
||||
;cookie_samesite = lax
|
||||
|
||||
# set to true if you want to allow browsers to render Grafana in a <frame>, <iframe>, <embed> or <object>. default is false.
|
||||
;allow_embedding = false
|
||||
|
||||
# Set to true if you want to enable http strict transport security (HSTS) response header.
|
||||
# This is only sent when HTTPS is enabled in this configuration.
|
||||
# HSTS tells browsers that the site should only be accessed using HTTPS.
|
||||
;strict_transport_security = false
|
||||
|
||||
# Sets how long a browser should cache HSTS. Only applied if strict_transport_security is enabled.
|
||||
;strict_transport_security_max_age_seconds = 86400
|
||||
|
||||
# Set to true if to enable HSTS preloading option. Only applied if strict_transport_security is enabled.
|
||||
;strict_transport_security_preload = false
|
||||
|
||||
# Set to true if to enable the HSTS includeSubDomains option. Only applied if strict_transport_security is enabled.
|
||||
;strict_transport_security_subdomains = false
|
||||
|
||||
# Set to true to enable the X-Content-Type-Options response header.
|
||||
# The X-Content-Type-Options response HTTP header is a marker used by the server to indicate that the MIME types advertised
|
||||
# in the Content-Type headers should not be changed and be followed.
|
||||
;x_content_type_options = true
|
||||
|
||||
# Set to true to enable the X-XSS-Protection header, which tells browsers to stop pages from loading
|
||||
# when they detect reflected cross-site scripting (XSS) attacks.
|
||||
;x_xss_protection = true
|
||||
|
||||
#################################### Snapshots ###########################
|
||||
[snapshots]
|
||||
# snapshot sharing options
|
||||
;external_enabled = true
|
||||
;external_snapshot_url = https://snapshots-origin.raintank.io
|
||||
;external_snapshot_name = Publish to snapshot.raintank.io
|
||||
|
||||
# Set to true to enable this Grafana instance act as an external snapshot server and allow unauthenticated requests for
|
||||
# creating and deleting snapshots.
|
||||
;public_mode = false
|
||||
|
||||
# remove expired snapshot
|
||||
;snapshot_remove_expired = true
|
||||
|
||||
#################################### Dashboards History ##################
|
||||
[dashboards]
|
||||
# Number dashboard versions to keep (per dashboard). Default: 20, Minimum: 1
|
||||
;versions_to_keep = 20
|
||||
|
||||
# Minimum dashboard refresh interval. When set, this will restrict users to set the refresh interval of a dashboard lower than given interval. Per default this is 5 seconds.
|
||||
# The interval string is a possibly signed sequence of decimal numbers, followed by a unit suffix (ms, s, m, h, d), e.g. 30s or 1m.
|
||||
;min_refresh_interval = 5s
|
||||
|
||||
# Path to the default home dashboard. If this value is empty, then Grafana uses StaticRootPath + "dashboards/home.json"
|
||||
;default_home_dashboard_path =
|
||||
|
||||
#################################### Users ###############################
|
||||
[users]
|
||||
# disable user signup / registration
|
||||
;allow_sign_up = true
|
||||
|
||||
# Allow non admin users to create organizations
|
||||
;allow_org_create = true
|
||||
|
||||
# Set to true to automatically assign new users to the default organization (id 1)
|
||||
;auto_assign_org = true
|
||||
|
||||
# Set this value to automatically add new users to the provided organization (if auto_assign_org above is set to true)
|
||||
;auto_assign_org_id = 1
|
||||
|
||||
# Default role new users will be automatically assigned (if disabled above is set to true)
|
||||
;auto_assign_org_role = Viewer
|
||||
|
||||
# Require email validation before sign up completes
|
||||
;verify_email_enabled = false
|
||||
|
||||
# Background text for the user field on the login page
|
||||
;login_hint = email or username
|
||||
;password_hint = password
|
||||
|
||||
# Default UI theme ("dark" or "light")
|
||||
;default_theme = dark
|
||||
|
||||
# External user management, these options affect the organization users view
|
||||
;external_manage_link_url =
|
||||
;external_manage_link_name =
|
||||
;external_manage_info =
|
||||
|
||||
# Viewers can edit/inspect dashboard settings in the browser. But not save the dashboard.
|
||||
;viewers_can_edit = false
|
||||
|
||||
# Editors can administrate dashboard, folders and teams they create
|
||||
;editors_can_admin = false
|
||||
|
||||
# The duration in time a user invitation remains valid before expiring. This setting should be expressed as a duration. Examples: 6h (hours), 2d (days), 1w (week). Default is 24h (24 hours). The minimum supported duration is 15m (15 minutes).
|
||||
;user_invite_max_lifetime_duration = 24h
|
||||
|
||||
[auth]
|
||||
# Login cookie name
|
||||
;login_cookie_name = grafana_session
|
||||
|
||||
# The maximum lifetime (duration) an authenticated user can be inactive before being required to login at next visit. Default is 7 days (7d). This setting should be expressed as a duration, e.g. 5m (minutes), 6h (hours), 10d (days), 2w (weeks), 1M (month). The lifetime resets at each successful token rotation.
|
||||
;login_maximum_inactive_lifetime_duration =
|
||||
|
||||
# The maximum lifetime (duration) an authenticated user can be logged in since login time before being required to login. Default is 30 days (30d). This setting should be expressed as a duration, e.g. 5m (minutes), 6h (hours), 10d (days), 2w (weeks), 1M (month).
|
||||
;login_maximum_lifetime_duration =
|
||||
|
||||
# How often should auth tokens be rotated for authenticated users when being active. The default is each 10 minutes.
|
||||
;token_rotation_interval_minutes = 10
|
||||
|
||||
# Set to true to disable (hide) the login form, useful if you use OAuth, defaults to false
|
||||
;disable_login_form = false
|
||||
|
||||
# Set to true to disable the signout link in the side menu. useful if you use auth.proxy, defaults to false
|
||||
;disable_signout_menu = false
|
||||
|
||||
# URL to redirect the user to after sign out
|
||||
;signout_redirect_url =
|
||||
|
||||
# Set to true to attempt login with OAuth automatically, skipping the login screen.
|
||||
# This setting is ignored if multiple OAuth providers are configured.
|
||||
;oauth_auto_login = false
|
||||
|
||||
# OAuth state max age cookie duration in seconds. Defaults to 600 seconds.
|
||||
;oauth_state_cookie_max_age = 600
|
||||
|
||||
# limit of api_key seconds to live before expiration
|
||||
;api_key_max_seconds_to_live = -1
|
||||
|
||||
# Set to true to enable SigV4 authentication option for HTTP-based datasources.
|
||||
;sigv4_auth_enabled = false
|
||||
|
||||
#################################### Anonymous Auth ######################
|
||||
[auth.anonymous]
|
||||
# enable anonymous access
|
||||
;enabled = false
|
||||
|
||||
# specify organization name that should be used for unauthenticated users
|
||||
;org_name = Main Org.
|
||||
|
||||
# specify role for unauthenticated users
|
||||
;org_role = Viewer
|
||||
|
||||
# mask the Grafana version number for unauthenticated users
|
||||
;hide_version = false
|
||||
|
||||
#################################### GitHub Auth ##########################
|
||||
[auth.github]
|
||||
;enabled = false
|
||||
;allow_sign_up = true
|
||||
;client_id = some_id
|
||||
;client_secret = some_secret
|
||||
;scopes = user:email,read:org
|
||||
;auth_url = https://github.com/login/oauth/authorize
|
||||
;token_url = https://github.com/login/oauth/access_token
|
||||
;api_url = https://api.github.com/user
|
||||
;allowed_domains =
|
||||
;team_ids =
|
||||
;allowed_organizations =
|
||||
|
||||
#################################### GitLab Auth #########################
|
||||
[auth.gitlab]
|
||||
;enabled = false
|
||||
;allow_sign_up = true
|
||||
;client_id = some_id
|
||||
;client_secret = some_secret
|
||||
;scopes = api
|
||||
;auth_url = https://gitlab.com/oauth/authorize
|
||||
;token_url = https://gitlab.com/oauth/token
|
||||
;api_url = https://gitlab.com/api/v4
|
||||
;allowed_domains =
|
||||
;allowed_groups =
|
||||
|
||||
#################################### Google Auth ##########################
|
||||
[auth.google]
|
||||
;enabled = false
|
||||
;allow_sign_up = true
|
||||
;client_id = some_client_id
|
||||
;client_secret = some_client_secret
|
||||
;scopes = https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email
|
||||
;auth_url = https://accounts.google.com/o/oauth2/auth
|
||||
;token_url = https://accounts.google.com/o/oauth2/token
|
||||
;api_url = https://www.googleapis.com/oauth2/v1/userinfo
|
||||
;allowed_domains =
|
||||
;hosted_domain =
|
||||
|
||||
#################################### Grafana.com Auth ####################
|
||||
[auth.grafana_com]
|
||||
;enabled = false
|
||||
;allow_sign_up = true
|
||||
;client_id = some_id
|
||||
;client_secret = some_secret
|
||||
;scopes = user:email
|
||||
;allowed_organizations =
|
||||
|
||||
#################################### Azure AD OAuth #######################
|
||||
[auth.azuread]
|
||||
;name = Azure AD
|
||||
;enabled = false
|
||||
;allow_sign_up = true
|
||||
;client_id = some_client_id
|
||||
;client_secret = some_client_secret
|
||||
;scopes = openid email profile
|
||||
;auth_url = https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/authorize
|
||||
;token_url = https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token
|
||||
;allowed_domains =
|
||||
;allowed_groups =
|
||||
|
||||
#################################### Okta OAuth #######################
|
||||
[auth.okta]
|
||||
;name = Okta
|
||||
;enabled = false
|
||||
;allow_sign_up = true
|
||||
;client_id = some_id
|
||||
;client_secret = some_secret
|
||||
;scopes = openid profile email groups
|
||||
;auth_url = https://<tenant-id>.okta.com/oauth2/v1/authorize
|
||||
;token_url = https://<tenant-id>.okta.com/oauth2/v1/token
|
||||
;api_url = https://<tenant-id>.okta.com/oauth2/v1/userinfo
|
||||
;allowed_domains =
|
||||
;allowed_groups =
|
||||
;role_attribute_path =
|
||||
|
||||
#################################### Generic OAuth ##########################
|
||||
[auth.generic_oauth]
|
||||
;enabled = false
|
||||
;name = OAuth
|
||||
;allow_sign_up = true
|
||||
;client_id = some_id
|
||||
;client_secret = some_secret
|
||||
;scopes = user:email,read:org
|
||||
;email_attribute_name = email:primary
|
||||
;email_attribute_path =
|
||||
;login_attribute_path =
|
||||
;id_token_attribute_name =
|
||||
;auth_url = https://foo.bar/login/oauth/authorize
|
||||
;token_url = https://foo.bar/login/oauth/access_token
|
||||
;api_url = https://foo.bar/user
|
||||
;allowed_domains =
|
||||
;team_ids =
|
||||
;allowed_organizations =
|
||||
;role_attribute_path =
|
||||
;tls_skip_verify_insecure = false
|
||||
;tls_client_cert =
|
||||
;tls_client_key =
|
||||
;tls_client_ca =
|
||||
|
||||
#################################### Basic Auth ##########################
|
||||
[auth.basic]
|
||||
;enabled = true
|
||||
|
||||
#################################### Auth Proxy ##########################
|
||||
[auth.proxy]
|
||||
;enabled = false
|
||||
;header_name = X-WEBAUTH-USER
|
||||
;header_property = username
|
||||
;auto_sign_up = true
|
||||
;sync_ttl = 60
|
||||
;whitelist = 192.168.1.1, 192.168.2.1
|
||||
;headers = Email:X-User-Email, Name:X-User-Name
|
||||
# Read the auth proxy docs for details on what the setting below enables
|
||||
;enable_login_token = false
|
||||
|
||||
#################################### Auth LDAP ##########################
|
||||
[auth.ldap]
|
||||
;enabled = false
|
||||
;config_file = /etc/grafana/ldap.toml
|
||||
;allow_sign_up = true
|
||||
|
||||
# LDAP backround sync (Enterprise only)
|
||||
# At 1 am every day
|
||||
;sync_cron = "0 0 1 * * *"
|
||||
;active_sync_enabled = true
|
||||
|
||||
#################################### SMTP / Emailing ##########################
|
||||
[smtp]
|
||||
;enabled = false
|
||||
;host = localhost:25
|
||||
;user =
|
||||
# If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;"""
|
||||
;password =
|
||||
;cert_file =
|
||||
;key_file =
|
||||
;skip_verify = false
|
||||
;from_address = admin@grafana.localhost
|
||||
;from_name = Grafana
|
||||
# EHLO identity in SMTP dialog (defaults to instance_name)
|
||||
;ehlo_identity = dashboard.example.com
|
||||
# SMTP startTLS policy (defaults to 'OpportunisticStartTLS')
|
||||
;startTLS_policy = NoStartTLS
|
||||
|
||||
[emails]
|
||||
;welcome_email_on_sign_up = false
|
||||
;templates_pattern = emails/*.html
|
||||
|
||||
#################################### Logging ##########################
|
||||
[log]
|
||||
# Either "console", "file", "syslog". Default is console and file
|
||||
# Use space to separate multiple modes, e.g. "console file"
|
||||
;mode = console file
|
||||
|
||||
# Either "debug", "info", "warn", "error", "critical", default is "info"
|
||||
;level = info
|
||||
|
||||
# optional settings to set different levels for specific loggers. Ex filters = sqlstore:debug
|
||||
;filters =
|
||||
|
||||
# For "console" mode only
|
||||
[log.console]
|
||||
;level =
|
||||
|
||||
# log line format, valid options are text, console and json
|
||||
;format = console
|
||||
|
||||
# For "file" mode only
|
||||
[log.file]
|
||||
;level =
|
||||
|
||||
# log line format, valid options are text, console and json
|
||||
;format = text
|
||||
|
||||
# This enables automated log rotate(switch of following options), default is true
|
||||
;log_rotate = true
|
||||
|
||||
# Max line number of single file, default is 1000000
|
||||
;max_lines = 1000000
|
||||
|
||||
# Max size shift of single file, default is 28 means 1 << 28, 256MB
|
||||
;max_size_shift = 28
|
||||
|
||||
# Segment log daily, default is true
|
||||
;daily_rotate = true
|
||||
|
||||
# Expired days of log file(delete after max days), default is 7
|
||||
;max_days = 7
|
||||
|
||||
[log.syslog]
|
||||
;level =
|
||||
|
||||
# log line format, valid options are text, console and json
|
||||
;format = text
|
||||
|
||||
# Syslog network type and address. This can be udp, tcp, or unix. If left blank, the default unix endpoints will be used.
|
||||
;network =
|
||||
;address =
|
||||
|
||||
# Syslog facility. user, daemon and local0 through local7 are valid.
|
||||
;facility =
|
||||
|
||||
# Syslog tag. By default, the process' argv[0] is used.
|
||||
;tag =
|
||||
|
||||
#################################### Usage Quotas ########################
|
||||
[quota]
|
||||
; enabled = false
|
||||
|
||||
#### set quotas to -1 to make unlimited. ####
|
||||
# limit number of users per Org.
|
||||
; org_user = 10
|
||||
|
||||
# limit number of dashboards per Org.
|
||||
; org_dashboard = 100
|
||||
|
||||
# limit number of data_sources per Org.
|
||||
; org_data_source = 10
|
||||
|
||||
# limit number of api_keys per Org.
|
||||
; org_api_key = 10
|
||||
|
||||
# limit number of orgs a user can create.
|
||||
; user_org = 10
|
||||
|
||||
# Global limit of users.
|
||||
; global_user = -1
|
||||
|
||||
# global limit of orgs.
|
||||
; global_org = -1
|
||||
|
||||
# global limit of dashboards
|
||||
; global_dashboard = -1
|
||||
|
||||
# global limit of api_keys
|
||||
; global_api_key = -1
|
||||
|
||||
# global limit on number of logged in users.
|
||||
; global_session = -1
|
||||
|
||||
#################################### Alerting ############################
|
||||
[alerting]
|
||||
# Disable alerting engine & UI features
|
||||
;enabled = true
|
||||
# Makes it possible to turn off alert rule execution but alerting UI is visible
|
||||
;execute_alerts = true
|
||||
|
||||
# Default setting for new alert rules. Defaults to categorize error and timeouts as alerting. (alerting, keep_state)
|
||||
;error_or_timeout = alerting
|
||||
|
||||
# Default setting for how Grafana handles nodata or null values in alerting. (alerting, no_data, keep_state, ok)
|
||||
;nodata_or_nullvalues = no_data
|
||||
|
||||
# Alert notifications can include images, but rendering many images at the same time can overload the server
|
||||
# This limit will protect the server from render overloading and make sure notifications are sent out quickly
|
||||
;concurrent_render_limit = 5
|
||||
|
||||
|
||||
# Default setting for alert calculation timeout. Default value is 30
|
||||
;evaluation_timeout_seconds = 30
|
||||
|
||||
# Default setting for alert notification timeout. Default value is 30
|
||||
;notification_timeout_seconds = 30
|
||||
|
||||
# Default setting for max attempts to sending alert notifications. Default value is 3
|
||||
;max_attempts = 3
|
||||
|
||||
# Makes it possible to enforce a minimal interval between evaluations, to reduce load on the backend
|
||||
;min_interval_seconds = 1
|
||||
|
||||
# Configures for how long alert annotations are stored. Default is 0, which keeps them forever.
|
||||
# This setting should be expressed as a duration. Examples: 6h (hours), 10d (days), 2w (weeks), 1M (month).
|
||||
;max_annotation_age =
|
||||
|
||||
# Configures max number of alert annotations that Grafana stores. Default value is 0, which keeps all alert annotations.
|
||||
;max_annotations_to_keep =
|
||||
|
||||
#################################### Annotations #########################
|
||||
|
||||
[annotations.dashboard]
|
||||
# Dashboard annotations means that annotations are associated with the dashboard they are created on.
|
||||
|
||||
# Configures how long dashboard annotations are stored. Default is 0, which keeps them forever.
|
||||
# This setting should be expressed as a duration. Examples: 6h (hours), 10d (days), 2w (weeks), 1M (month).
|
||||
;max_age =
|
||||
|
||||
# Configures max number of dashboard annotations that Grafana stores. Default value is 0, which keeps all dashboard annotations.
|
||||
;max_annotations_to_keep =
|
||||
|
||||
[annotations.api]
|
||||
# API annotations means that the annotations have been created using the API without any
|
||||
# association with a dashboard.
|
||||
|
||||
# Configures how long Grafana stores API annotations. Default is 0, which keeps them forever.
|
||||
# This setting should be expressed as a duration. Examples: 6h (hours), 10d (days), 2w (weeks), 1M (month).
|
||||
;max_age =
|
||||
|
||||
# Configures max number of API annotations that Grafana keeps. Default value is 0, which keeps all API annotations.
|
||||
;max_annotations_to_keep =
|
||||
|
||||
#################################### Explore #############################
|
||||
[explore]
|
||||
# Enable the Explore section
|
||||
;enabled = true
|
||||
|
||||
#################################### Internal Grafana Metrics ##########################
|
||||
# Metrics available at HTTP API Url /metrics
|
||||
[metrics]
|
||||
# Disable / Enable internal metrics
|
||||
;enabled = true
|
||||
# Graphite Publish interval
|
||||
;interval_seconds = 10
|
||||
# Disable total stats (stat_totals_*) metrics to be generated
|
||||
;disable_total_stats = false
|
||||
|
||||
#If both are set, basic auth will be required for the metrics endpoint.
|
||||
; basic_auth_username =
|
||||
; basic_auth_password =
|
||||
|
||||
# Metrics environment info adds dimensions to the `grafana_environment_info` metric, which
|
||||
# can expose more information about the Grafana instance.
|
||||
[metrics.environment_info]
|
||||
#exampleLabel1 = exampleValue1
|
||||
#exampleLabel2 = exampleValue2
|
||||
|
||||
# Send internal metrics to Graphite
|
||||
[metrics.graphite]
|
||||
# Enable by setting the address setting (ex localhost:2003)
|
||||
;address =
|
||||
;prefix = prod.grafana.%(instance_name)s.
|
||||
|
||||
#################################### Grafana.com integration ##########################
|
||||
# Url used to import dashboards directly from Grafana.com
|
||||
[grafana_com]
|
||||
;url = https://grafana.com
|
||||
|
||||
#################################### Distributed tracing ############
|
||||
[tracing.jaeger]
|
||||
# Enable by setting the address sending traces to jaeger (ex localhost:6831)
|
||||
;address = localhost:6831
|
||||
# Tag that will always be included in when creating new spans. ex (tag1:value1,tag2:value2)
|
||||
;always_included_tag = tag1:value1
|
||||
# Type specifies the type of the sampler: const, probabilistic, rateLimiting, or remote
|
||||
;sampler_type = const
|
||||
# jaeger samplerconfig param
|
||||
# for "const" sampler, 0 or 1 for always false/true respectively
|
||||
# for "probabilistic" sampler, a probability between 0 and 1
|
||||
# for "rateLimiting" sampler, the number of spans per second
|
||||
# for "remote" sampler, param is the same as for "probabilistic"
|
||||
# and indicates the initial sampling rate before the actual one
|
||||
# is received from the mothership
|
||||
;sampler_param = 1
|
||||
# sampling_server_url is the URL of a sampling manager providing a sampling strategy.
|
||||
;sampling_server_url =
|
||||
# Whether or not to use Zipkin propagation (x-b3- HTTP headers).
|
||||
;zipkin_propagation = false
|
||||
# Setting this to true disables shared RPC spans.
|
||||
# Not disabling is the most common setting when using Zipkin elsewhere in your infrastructure.
|
||||
;disable_shared_zipkin_spans = false
|
||||
|
||||
#################################### External image storage ##########################
|
||||
[external_image_storage]
|
||||
# Used for uploading images to public servers so they can be included in slack/email messages.
|
||||
# you can choose between (s3, webdav, gcs, azure_blob, local)
|
||||
;provider =
|
||||
|
||||
[external_image_storage.s3]
|
||||
;endpoint =
|
||||
;path_style_access =
|
||||
;bucket =
|
||||
;region =
|
||||
;path =
|
||||
;access_key =
|
||||
;secret_key =
|
||||
|
||||
[external_image_storage.webdav]
|
||||
;url =
|
||||
;public_url =
|
||||
;username =
|
||||
;password =
|
||||
|
||||
[external_image_storage.gcs]
|
||||
;key_file =
|
||||
;bucket =
|
||||
;path =
|
||||
|
||||
[external_image_storage.azure_blob]
|
||||
;account_name =
|
||||
;account_key =
|
||||
;container_name =
|
||||
|
||||
[external_image_storage.local]
|
||||
# does not require any configuration
|
||||
|
||||
[rendering]
|
||||
# Options to configure a remote HTTP image rendering service, e.g. using https://github.com/grafana/grafana-image-renderer.
|
||||
# URL to a remote HTTP image renderer service, e.g. http://localhost:8081/render, will enable Grafana to render panels and dashboards to PNG-images using HTTP requests to an external service.
|
||||
;server_url =
|
||||
# If the remote HTTP image renderer service runs on a different server than the Grafana server you may have to configure this to a URL where Grafana is reachable, e.g. http://grafana.domain/.
|
||||
;callback_url =
|
||||
# Concurrent render request limit affects when the /render HTTP endpoint is used. Rendering many images at the same time can overload the server,
|
||||
# which this setting can help protect against by only allowing a certain amount of concurrent requests.
|
||||
;concurrent_render_request_limit = 30
|
||||
|
||||
[panels]
|
||||
# If set to true Grafana will allow script tags in text panels. Not recommended as it enable XSS vulnerabilities.
|
||||
;disable_sanitize_html = false
|
||||
|
||||
[plugins]
|
||||
;enable_alpha = false
|
||||
;app_tls_skip_verify_insecure = false
|
||||
# Enter a comma-separated list of plugin identifiers to identify plugins that are allowed to be loaded even if they lack a valid signature.
|
||||
;allow_loading_unsigned_plugins =
|
||||
;marketplace_url = https://grafana.com/grafana/plugins/
|
||||
|
||||
#################################### Grafana Image Renderer Plugin ##########################
|
||||
[plugin.grafana-image-renderer]
|
||||
# Instruct headless browser instance to use a default timezone when not provided by Grafana, e.g. when rendering panel image of alert.
|
||||
# See ICU’s metaZones.txt (https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt) for a list of supported
|
||||
# timezone IDs. Fallbacks to TZ environment variable if not set.
|
||||
;rendering_timezone =
|
||||
|
||||
# Instruct headless browser instance to use a default language when not provided by Grafana, e.g. when rendering panel image of alert.
|
||||
# Please refer to the HTTP header Accept-Language to understand how to format this value, e.g. 'fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5'.
|
||||
;rendering_language =
|
||||
|
||||
# Instruct headless browser instance to use a default device scale factor when not provided by Grafana, e.g. when rendering panel image of alert.
|
||||
# Default is 1. Using a higher value will produce more detailed images (higher DPI), but will require more disk space to store an image.
|
||||
;rendering_viewport_device_scale_factor =
|
||||
|
||||
# Instruct headless browser instance whether to ignore HTTPS errors during navigation. Per default HTTPS errors are not ignored. Due to
|
||||
# the security risk it's not recommended to ignore HTTPS errors.
|
||||
;rendering_ignore_https_errors =
|
||||
|
||||
# Instruct headless browser instance whether to capture and log verbose information when rendering an image. Default is false and will
|
||||
# only capture and log error messages. When enabled, debug messages are captured and logged as well.
|
||||
# For the verbose information to be included in the Grafana server log you have to adjust the rendering log level to debug, configure
|
||||
# [log].filter = rendering:debug.
|
||||
;rendering_verbose_logging =
|
||||
|
||||
# Instruct headless browser instance whether to output its debug and error messages into running process of remote rendering service.
|
||||
# Default is false. This can be useful to enable (true) when troubleshooting.
|
||||
;rendering_dumpio =
|
||||
|
||||
# Additional arguments to pass to the headless browser instance. Default is --no-sandbox. The list of Chromium flags can be found
|
||||
# here (https://peter.sh/experiments/chromium-command-line-switches/). Multiple arguments is separated with comma-character.
|
||||
;rendering_args =
|
||||
|
||||
# You can configure the plugin to use a different browser binary instead of the pre-packaged version of Chromium.
|
||||
# Please note that this is not recommended, since you may encounter problems if the installed version of Chrome/Chromium is not
|
||||
# compatible with the plugin.
|
||||
;rendering_chrome_bin =
|
||||
|
||||
# Instruct how headless browser instances are created. Default is 'default' and will create a new browser instance on each request.
|
||||
# Mode 'clustered' will make sure that only a maximum of browsers/incognito pages can execute concurrently.
|
||||
# Mode 'reusable' will have one browser instance and will create a new incognito page on each request.
|
||||
;rendering_mode =
|
||||
|
||||
# When rendering_mode = clustered you can instruct how many browsers or incognito pages can execute concurrently. Default is 'browser'
|
||||
# and will cluster using browser instances.
|
||||
# Mode 'context' will cluster using incognito pages.
|
||||
;rendering_clustering_mode =
|
||||
# When rendering_mode = clustered you can define maximum number of browser instances/incognito pages that can execute concurrently..
|
||||
;rendering_clustering_max_concurrency =
|
||||
|
||||
# Limit the maximum viewport width, height and device scale factor that can be requested.
|
||||
;rendering_viewport_max_width =
|
||||
;rendering_viewport_max_height =
|
||||
;rendering_viewport_max_device_scale_factor =
|
||||
|
||||
# Change the listening host and port of the gRPC server. Default host is 127.0.0.1 and default port is 0 and will automatically assign
|
||||
# a port not in use.
|
||||
;grpc_host =
|
||||
;grpc_port =
|
||||
|
||||
[enterprise]
|
||||
# Path to a valid Grafana Enterprise license.jwt file
|
||||
;license_path =
|
||||
|
||||
[feature_toggles]
|
||||
# enable features, separated by spaces
|
||||
;enable =
|
||||
|
||||
[date_formats]
|
||||
# For information on what formatting patterns that are supported https://momentjs.com/docs/#/displaying/
|
||||
|
||||
# Default system date format used in time range picker and other places where full time is displayed
|
||||
;full_date = YYYY-MM-DD HH:mm:ss
|
||||
|
||||
# Used by graph and other places where we only show small intervals
|
||||
;interval_second = HH:mm:ss
|
||||
;interval_minute = HH:mm
|
||||
;interval_hour = MM/DD HH:mm
|
||||
;interval_day = MM/DD
|
||||
;interval_month = YYYY-MM
|
||||
;interval_year = YYYY
|
||||
|
||||
# Experimental feature
|
||||
;use_browser_locale = false
|
||||
|
||||
# Default timezone for user preferences. Options are 'browser' for the browser local timezone or a timezone name from IANA Time Zone database, e.g. 'UTC' or 'Europe/Amsterdam' etc.
|
||||
;default_timezone = browser
|
||||
@@ -0,0 +1,68 @@
|
||||
# my global config
|
||||
global:
|
||||
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
|
||||
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
|
||||
# scrape_timeout is set to the global default (10s).
|
||||
|
||||
# Alertmanager configuration
|
||||
alerting:
|
||||
alertmanagers:
|
||||
- static_configs:
|
||||
- targets: ['172.30.0.99:9093']
|
||||
|
||||
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
|
||||
rule_files:
|
||||
- "rules/alert_rules.yml"
|
||||
|
||||
# A scrape configuration containing exactly one endpoint to scrape:
|
||||
# Here it's Prometheus itself.
|
||||
scrape_configs:
|
||||
# 监控 prometheus
|
||||
- job_name: 'prometheus'
|
||||
static_configs:
|
||||
- targets: ['172.30.0.90:9090'] #填写prometheus服务ip:端口
|
||||
# 监控 linux
|
||||
- job_name: linux
|
||||
static_configs:
|
||||
- targets: ['172.30.0.93:9100'] #填写node-exporter的docker服务ip:端口或者宿主机ip:映射的端口
|
||||
labels:
|
||||
instance: localhost:linux #实例名称或ip
|
||||
# 监控 mysql
|
||||
- job_name: 'mysql'
|
||||
static_configs:
|
||||
- targets: ['172.30.0.94:9104'] #填写mysqld-exporter的docker服务ip:端口或者宿主机ip:映射的端口
|
||||
labels:
|
||||
instance: localhost:mysql #实例名称或ip
|
||||
# 监控 cadvisor
|
||||
- job_name: "docker"
|
||||
static_configs:
|
||||
- targets: ['172.30.0.180:8080'] #填写cadvisor服务ip:端口
|
||||
# 监控 nacos
|
||||
- job_name: "nacos"
|
||||
metrics_path: '/nacos/actuator/prometheus'
|
||||
static_configs:
|
||||
- targets: ['172.30.0.48:8848'] #填写nacos服务ip:端口
|
||||
# 监控 bladex
|
||||
- job_name: "bladex"
|
||||
metrics_path: "/actuator/prometheus"
|
||||
scrape_interval: 5s
|
||||
consul_sd_configs:
|
||||
#必须保证prometheus能调用否则不会显示
|
||||
#若是docker部署必须保证网络与各服务调通
|
||||
- server: '172.30.0.72:7002' #填写实现consul-api的blade-admin服务ip:端口
|
||||
#匹配所有service
|
||||
services: []
|
||||
relabel_configs:
|
||||
#service 源标签
|
||||
- source_labels: [__meta_consul_service]
|
||||
#匹配 "blade" 开头的service
|
||||
regex: "blade*"
|
||||
#执行的动作
|
||||
action: drop
|
||||
#将service的label重写为application
|
||||
- source_labels: [__meta_consul_service]
|
||||
target_label: application
|
||||
- source_labels: [__meta_consul_service_address]
|
||||
target_label: instance
|
||||
- source_labels: [__meta_consul_tags]
|
||||
target_label: job
|
||||
@@ -0,0 +1,34 @@
|
||||
{{ define "wechat.default.message" }}
|
||||
{{- if gt (len .Alerts.Firing) 0 -}}
|
||||
{{- range $index, $alert := .Alerts -}}
|
||||
{{- if eq $index 0 -}}
|
||||
==========告警通知==========
|
||||
告警类型: {{ $alert.Labels.alertname }}
|
||||
告警状态: {{ $alert.Status }}
|
||||
告警级别: {{ $alert.Labels.level }}
|
||||
{{- end }}
|
||||
==========告警详情==========
|
||||
告警主题: {{ $alert.Annotations.summary }}
|
||||
告警详情: {{ $alert.Annotations.description }}
|
||||
故障时间: {{ $alert.StartsAt.Local }}
|
||||
{{ if gt (len $alert.Labels.instance) 0 -}}故障实例: {{ $alert.Labels.instance }}{{- end -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if gt (len .Alerts.Resolved) 0 -}}
|
||||
{{- range $index, $alert := .Alerts -}}
|
||||
{{- if eq $index 0 -}}
|
||||
==========恢复通知==========
|
||||
告警类型: {{ $alert.Labels.alertname }}
|
||||
告警状态: {{ $alert.Status }}
|
||||
告警级别: {{ $alert.Labels.level }}
|
||||
{{- end }}
|
||||
==========恢复详情==========
|
||||
告警主题: {{ $alert.Annotations.summary }}
|
||||
告警详情: {{ $alert.Annotations.description }}
|
||||
故障时间: {{ $alert.StartsAt.Local }}
|
||||
恢复时间: {{ $alert.EndsAt.Local }}
|
||||
{{ if gt (len $alert.Labels.instance) 0 -}}故障实例: {{ $alert.Labels.instance }}{{- end -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,27 @@
|
||||
## 一、调整内存:max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144](elasticsearch用户拥有的内存权限太小,至少需要262144)
|
||||
|
||||
#### 1.修改配置sysctl.conf
|
||||
[root@localhost ~]# vi /etc/sysctl.conf
|
||||
#### 2.添加下面配置:
|
||||
vm.max_map_count=262144
|
||||
#### 3.重新加载:
|
||||
[root@localhost ~]# sysctl -p
|
||||
#### 4.最后重新启动elasticsearch,即可启动成功。
|
||||
|
||||
|
||||
## 二、Docker 命令自动补全
|
||||
#### 1.安装依赖工具bash-complete
|
||||
[root@localhost ~]# yum install -y bash-completion
|
||||
|
||||
[root@localhost ~]# source /usr/share/bash-completion/completions/docker
|
||||
|
||||
[root@localhost ~]# source /usr/share/bash-completion/bash_completion
|
||||
|
||||
## 三、将本文件夹内的文件拷贝至服务器
|
||||
#### 1.对sh脚本赋予执行权限
|
||||
|
||||
#### 2.执行 ./deploy.sh
|
||||
|
||||
#### 3.等待服务启动完毕即可
|
||||
|
||||
#### 4.卸载执行 ./undeploy.sh
|
||||
@@ -0,0 +1,88 @@
|
||||
#./bin/bash
|
||||
# 定义颜色
|
||||
BLUE_COLOR="\033[36m"
|
||||
RED_COLOR="\033[31m"
|
||||
GREEN_COLOR="\033[32m"
|
||||
VIOLET_COLOR="\033[35m"
|
||||
RES="\033[0m"
|
||||
|
||||
echo -e "${BLUE_COLOR}# ######################################################################${RES}"
|
||||
echo -e "${BLUE_COLOR}# Docker ELK Deploy Script #${RES}"
|
||||
echo -e "${BLUE_COLOR}# ######################################################################${RES}"
|
||||
|
||||
# 创建目录
|
||||
echo -e "${BLUE_COLOR}---> create [elasticsearch]directory start.${RES}"
|
||||
if [ ! -d "./elasticsearch/" ]; then
|
||||
mkdir -p ./elasticsearch/master/conf ./elasticsearch/master/data ./elasticsearch/master/logs \
|
||||
./elasticsearch/slave1/conf ./elasticsearch/slave1/data ./elasticsearch/slave1/logs \
|
||||
./elasticsearch/slave2/conf ./elasticsearch/slave2/data ./elasticsearch/slave2/logs
|
||||
fi
|
||||
|
||||
echo -e "${RED_COLOR}---> create [kibana]directory start.${RES}"
|
||||
if [ ! -d "./kibana/" ]; then
|
||||
mkdir -p ./kibana/conf ./kibana/logs
|
||||
fi
|
||||
|
||||
echo -e "${GREEN_COLOR}---> create [logstash]directory start.${RES}"
|
||||
if [ ! -d "./logstash/" ]; then
|
||||
mkdir -p ./logstash/conf ./logstash/logs
|
||||
fi
|
||||
|
||||
echo -e "${GREEN_COLOR}---> create [filebeat]directory start.${RES}"
|
||||
if [ ! -d "./filebeat/" ]; then
|
||||
mkdir -p ./filebeat/conf ./filebeat/logs ./filebeat/data
|
||||
fi
|
||||
|
||||
echo -e "${VIOLET_COLOR}---> create [nginx]directory start.${RES}"
|
||||
if [ ! -d "./nginx/" ]; then
|
||||
mkdir -p ./nginx/conf ./nginx/logs ./nginx/www
|
||||
fi
|
||||
echo -e "${BLUE_COLOR}===> create directory success.${RES}"
|
||||
|
||||
# 目录授权(data/logs 都要授读/写权限)
|
||||
echo -e "${BLUE_COLOR}---> directory authorize start.${RES}"
|
||||
if [ -d "./elasticsearch/" ]; then
|
||||
chmod 777 ./elasticsearch/master/data/ ./elasticsearch/master/logs/ \
|
||||
./elasticsearch/slave1/data/ ./elasticsearch/slave1/logs/ \
|
||||
./elasticsearch/slave2/data/ ./elasticsearch/slave2/logs
|
||||
fi
|
||||
|
||||
if [ -d "./filebeat/" ]; then
|
||||
chmod 777 ./filebeat/data/ ./filebeat/logs/
|
||||
fi
|
||||
echo -e "${BLUE_COLOR}===> directory authorize success.${RES}"
|
||||
|
||||
# 移动配置文件
|
||||
echo -e "${BLUE_COLOR}---> move [elasticsearch]config file start.${RES}"
|
||||
if [ -f "./es-master.yml" ] && [ -f "./es-slave1.yml" ] && [ -f "./es-slave2.yml" ]; then
|
||||
mv ./es-master.yml ./elasticsearch/master/conf
|
||||
mv ./es-slave1.yml ./elasticsearch/slave1/conf
|
||||
mv ./es-slave2.yml ./elasticsearch/slave2/conf
|
||||
fi
|
||||
|
||||
echo -e "${RED_COLOR}---> move [kibana]config file start.${RES}"
|
||||
if [ -f "./kibana.yml" ]; then
|
||||
mv ./kibana.yml ./kibana/conf
|
||||
fi
|
||||
|
||||
echo -e "${GREEN_COLOR}---> move [logstash]config file start.${RES}"
|
||||
if [ -f "./logstash.yml" ] && [ -f "./logstash-filebeat.conf" ]; then
|
||||
mv ./logstash-filebeat.conf ./logstash/conf
|
||||
mv ./logstash.yml ./logstash/conf
|
||||
fi
|
||||
|
||||
echo -e "${GREEN_COLOR}---> move [filebeat]config file start.${RES}"
|
||||
if [ -f "./filebeat.yml" ]; then
|
||||
mv ./filebeat.yml ./filebeat/conf
|
||||
fi
|
||||
|
||||
echo -e "${VIOLET_COLOR}---> move [nginx]config file start.${RES}"
|
||||
if [ -f "./nginx.conf" ]; then
|
||||
mv ./nginx.conf ./nginx/conf
|
||||
fi
|
||||
echo -e "${BLUE_COLOR}===> move config files success.${RES}"
|
||||
echo -e "${GREEN_COLOR}>>>>>>>>>>>>>>>>>> The End <<<<<<<<<<<<<<<<<<${RES}"
|
||||
|
||||
# 部署项目
|
||||
echo -e "${BLUE_COLOR}==================> Docker deploy Start <==================${RES}"
|
||||
docker-compose up --build -d
|
||||
@@ -0,0 +1,115 @@
|
||||
version: "3"
|
||||
services:
|
||||
es-master:
|
||||
container_name: es-master
|
||||
hostname: es-master
|
||||
image: elasticsearch:7.1.1
|
||||
restart: always
|
||||
ports:
|
||||
- 9200:9200
|
||||
- 9300:9300
|
||||
volumes:
|
||||
- ./elasticsearch/master/conf/es-master.yml:/usr/share/elasticsearch/config/elasticsearch.yml
|
||||
- ./elasticsearch/master/data:/usr/share/elasticsearch/data
|
||||
- ./elasticsearch/master/logs:/usr/share/elasticsearch/logs
|
||||
environment:
|
||||
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
||||
|
||||
es-slave1:
|
||||
container_name: es-slave1
|
||||
image: elasticsearch:7.1.1
|
||||
restart: always
|
||||
ports:
|
||||
- 9201:9200
|
||||
- 9301:9300
|
||||
volumes:
|
||||
- ./elasticsearch/slave1/conf/es-slave1.yml:/usr/share/elasticsearch/config/elasticsearch.yml
|
||||
- ./elasticsearch/slave1/data:/usr/share/elasticsearch/data
|
||||
- ./elasticsearch/slave1/logs:/usr/share/elasticsearch/logs
|
||||
environment:
|
||||
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
||||
|
||||
es-slave2:
|
||||
container_name: es-slave2
|
||||
image: elasticsearch:7.1.1
|
||||
restart: always
|
||||
ports:
|
||||
- 9202:9200
|
||||
- 9302:9300
|
||||
volumes:
|
||||
- ./elasticsearch/slave2/conf/es-slave2.yml:/usr/share/elasticsearch/config/elasticsearch.yml
|
||||
- ./elasticsearch/slave2/data:/usr/share/elasticsearch/data
|
||||
- ./elasticsearch/slave2/logs:/usr/share/elasticsearch/logs
|
||||
environment:
|
||||
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
||||
|
||||
es-head:
|
||||
container_name: es-head
|
||||
image: mobz/elasticsearch-head:5
|
||||
restart: always
|
||||
ports:
|
||||
- 9100:9100
|
||||
depends_on:
|
||||
- es-master
|
||||
- es-slave1
|
||||
- es-slave2
|
||||
|
||||
kibana:
|
||||
container_name: kibana
|
||||
hostname: kibana
|
||||
image: kibana:7.1.1
|
||||
restart: always
|
||||
ports:
|
||||
- 5601:5601
|
||||
volumes:
|
||||
- ./kibana/conf/kibana.yml:/usr/share/kibana/config/kibana.yml
|
||||
environment:
|
||||
- elasticsearch.hosts=http://es-master:9200
|
||||
depends_on:
|
||||
- es-master
|
||||
- es-slave1
|
||||
- es-slave2
|
||||
|
||||
filebeat:
|
||||
# 容器名称
|
||||
container_name: filebeat
|
||||
# 主机名称
|
||||
hostname: filebeat
|
||||
# 镜像
|
||||
image: docker.elastic.co/beats/filebeat:7.1.1
|
||||
# 重启机制
|
||||
restart: always
|
||||
# 持久化挂载
|
||||
volumes:
|
||||
- ./filebeat/conf/filebeat.yml:/usr/share/filebeat/filebeat.yml
|
||||
# 映射到容器中[作为数据源]
|
||||
- ./logs:/home/project/elk/logs
|
||||
- ./filebeat/logs:/usr/share/filebeat/logs
|
||||
- ./filebeat/data:/usr/share/filebeat/data
|
||||
# 将指定容器连接到当前连接,可以设置别名,避免ip方式导致的容器重启动态改变的无法连接情况
|
||||
links:
|
||||
- logstash
|
||||
ports:
|
||||
- 9000:9000
|
||||
# 依赖服务[可无]
|
||||
depends_on:
|
||||
- es-master
|
||||
- es-slave1
|
||||
- es-slave2
|
||||
|
||||
logstash:
|
||||
container_name: logstash
|
||||
hostname: logstash
|
||||
image: logstash:7.1.1
|
||||
command: logstash -f ./conf/logstash-filebeat.conf
|
||||
restart: always
|
||||
volumes:
|
||||
# 映射到容器中
|
||||
- ./logstash/conf/logstash-filebeat.conf:/usr/share/logstash/conf/logstash-filebeat.conf
|
||||
- ./logstash/conf/logstash.yml:/usr/share/logstash/config/logstash.yml
|
||||
ports:
|
||||
- 5044:5044
|
||||
depends_on:
|
||||
- es-master
|
||||
- es-slave1
|
||||
- es-slave2
|
||||
@@ -0,0 +1,28 @@
|
||||
# 集群名称
|
||||
cluster.name: es-cluster
|
||||
# 节点名称
|
||||
node.name: es-master
|
||||
# 是否可以成为master节点
|
||||
node.master: true
|
||||
# 是否允许该节点存储数据,默认开启
|
||||
node.data: false
|
||||
# 网络绑定
|
||||
network.host: 0.0.0.0
|
||||
# 设置对外服务的http端口
|
||||
http.port: 9200
|
||||
# 设置节点间交互的tcp端口
|
||||
transport.port: 9300
|
||||
# 集群发现
|
||||
discovery.seed_hosts:
|
||||
- es-master
|
||||
- es-slave1
|
||||
- es-slave2
|
||||
# 手动指定可以成为 mater 的所有节点的 name 或者 ip,这些配置将会在第一次选举中进行计算
|
||||
cluster.initial_master_nodes:
|
||||
- es-master
|
||||
# 支持跨域访问
|
||||
http.cors.enabled: true
|
||||
http.cors.allow-origin: "*"
|
||||
# 安全认证
|
||||
xpack.security.enabled: false
|
||||
#http.cors.allow-headers: "Authorization"
|
||||
@@ -0,0 +1,28 @@
|
||||
# 集群名称
|
||||
cluster.name: es-cluster
|
||||
# 节点名称
|
||||
node.name: es-slave1
|
||||
# 是否可以成为master节点
|
||||
node.master: true
|
||||
# 是否允许该节点存储数据,默认开启
|
||||
node.data: true
|
||||
# 网络绑定
|
||||
network.host: 0.0.0.0
|
||||
# 设置对外服务的http端口
|
||||
http.port: 9201
|
||||
# 设置节点间交互的tcp端口
|
||||
#transport.port: 9301
|
||||
# 集群发现
|
||||
discovery.seed_hosts:
|
||||
- es-master
|
||||
- es-slave1
|
||||
- es-slave2
|
||||
# 手动指定可以成为 mater 的所有节点的 name 或者 ip,这些配置将会在第一次选举中进行计算
|
||||
cluster.initial_master_nodes:
|
||||
- es-master
|
||||
# 支持跨域访问
|
||||
http.cors.enabled: true
|
||||
http.cors.allow-origin: "*"
|
||||
# 安全认证
|
||||
xpack.security.enabled: false
|
||||
#http.cors.allow-headers: "Authorization"
|
||||
@@ -0,0 +1,28 @@
|
||||
# 集群名称
|
||||
cluster.name: es-cluster
|
||||
# 节点名称
|
||||
node.name: es-slave2
|
||||
# 是否可以成为master节点
|
||||
node.master: true
|
||||
# 是否允许该节点存储数据,默认开启
|
||||
node.data: true
|
||||
# 网络绑定
|
||||
network.host: 0.0.0.0
|
||||
# 设置对外服务的http端口
|
||||
http.port: 9202
|
||||
# 设置节点间交互的tcp端口
|
||||
#transport.port: 9302
|
||||
# 集群发现
|
||||
discovery.seed_hosts:
|
||||
- es-master
|
||||
- es-slave1
|
||||
- es-slave2
|
||||
# 手动指定可以成为 mater 的所有节点的 name 或者 ip,这些配置将会在第一次选举中进行计算
|
||||
cluster.initial_master_nodes:
|
||||
- es-master
|
||||
# 支持跨域访问
|
||||
http.cors.enabled: true
|
||||
http.cors.allow-origin: "*"
|
||||
# 安全认证
|
||||
xpack.security.enabled: false
|
||||
#http.cors.allow-headers: "Authorization"
|
||||
@@ -0,0 +1,37 @@
|
||||
filebeat.inputs:
|
||||
- type: log
|
||||
enabled: true
|
||||
paths:
|
||||
# 当前目录下的所有.log文件
|
||||
- /home/project/elk/logs/*.log
|
||||
multiline.pattern: ^\[
|
||||
multiline.negate: true
|
||||
multiline.match: after
|
||||
- type: tcp
|
||||
enabled: true
|
||||
max_message_size: 10MiB
|
||||
host: "0.0.0.0:9000"
|
||||
|
||||
filebeat.config.modules:
|
||||
path: ${path.config}/modules.d/*.yml
|
||||
reload.enabled: false
|
||||
|
||||
setup.template.settings:
|
||||
index.number_of_shards: 1
|
||||
|
||||
setup.dashboards.enabled: false
|
||||
|
||||
setup.kibana:
|
||||
host: "http://kibana:5601"
|
||||
|
||||
# 不直接传输至ES
|
||||
#output.elasticsearch:
|
||||
# hosts: ["http://es-master:9200"]
|
||||
# index: "filebeat-%{[beat.version]}-%{+yyyy.MM.dd}"
|
||||
|
||||
output.logstash:
|
||||
hosts: ["logstash:5044"]
|
||||
|
||||
processors:
|
||||
- add_host_metadata: ~
|
||||
- add_cloud_metadata: ~
|
||||
@@ -0,0 +1,8 @@
|
||||
# 服务端口
|
||||
server.port: 5601
|
||||
# 服务IP
|
||||
server.host: "0.0.0.0"
|
||||
# ES
|
||||
elasticsearch.hosts: ["http://es-master:9200"]
|
||||
# 汉化
|
||||
i18n.locale: "zh-CN"
|
||||
@@ -0,0 +1,23 @@
|
||||
input {
|
||||
# 来源beats
|
||||
beats {
|
||||
# 端口
|
||||
port => "5044"
|
||||
}
|
||||
}
|
||||
# 分析、过滤插件,可以多个
|
||||
filter {
|
||||
grok {
|
||||
match => { "message" => "%{COMBINEDAPACHELOG}"}
|
||||
}
|
||||
geoip {
|
||||
source => "clientip"
|
||||
}
|
||||
}
|
||||
output {
|
||||
# 选择elasticsearch
|
||||
elasticsearch {
|
||||
hosts => ["http://es-master:9200"]
|
||||
index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
# 服务IP
|
||||
http.host: "0.0.0.0"
|
||||
# ES
|
||||
xpack.monitoring.elasticsearch.hosts: [ "http://es-master:9200" ]
|
||||
|
||||
xpack.monitoring.enabled: true
|
||||
|
||||
xpack.management.enabled: false
|
||||
@@ -0,0 +1,16 @@
|
||||
#./bin/bash
|
||||
# 定义颜色
|
||||
BLUE_COLOR="\033[36m"
|
||||
RED_COLOR="\033[31m"
|
||||
GREEN_COLOR="\033[32m"
|
||||
VIOLET_COLOR="\033[35m"
|
||||
RES="\033[0m"
|
||||
|
||||
echo -e "${BLUE_COLOR}# ######################################################################${RES}"
|
||||
echo -e "${BLUE_COLOR}# Docker ELK UnDeploy Script #${RES}"
|
||||
echo -e "${BLUE_COLOR}# ######################################################################${RES}"
|
||||
|
||||
# 部署项目
|
||||
echo -e "${BLUE_COLOR}==================> Docker UnDeploy Start <==================${RES}"
|
||||
docker-compose stop
|
||||
docker-compose rm
|
||||
@@ -0,0 +1,48 @@
|
||||
version: '3.3'
|
||||
services:
|
||||
elasticsearch:
|
||||
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.11
|
||||
container_name: elasticsearch
|
||||
restart: always
|
||||
ports:
|
||||
- 9200:9200
|
||||
- 9300:9300
|
||||
environment:
|
||||
- discovery.type=single-node
|
||||
- TZ=Asia/Shanghai
|
||||
- bootstrap.memory_lock=true
|
||||
- "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
|
||||
ulimits:
|
||||
memlock:
|
||||
soft: -1
|
||||
hard: -1
|
||||
skywalking-oap:
|
||||
image: docker.io/apache/skywalking-oap-server:9.5.0
|
||||
container_name: skywalking-oap
|
||||
depends_on:
|
||||
- elasticsearch
|
||||
restart: always
|
||||
ports:
|
||||
- 11800:11800
|
||||
- 12800:12800
|
||||
environment:
|
||||
SW_CORE_RECORD_DATA_TTL: 15
|
||||
SW_CORE_METRICS_DATA_TTL: 15
|
||||
SW_STORAGE: elasticsearch
|
||||
SW_STORAGE_ES_CLUSTER_NODES: elasticsearch:9200
|
||||
SW_ENABLE_UPDATE_UI_TEMPLATE: "true"
|
||||
TZ: Asia/Shanghai
|
||||
JAVA_OPTS: "-Xms2048m -Xmx2048m"
|
||||
skywalking-ui:
|
||||
image: docker.io/apache/skywalking-ui:9.5.0
|
||||
container_name: skywalking-ui
|
||||
depends_on:
|
||||
- skywalking-oap
|
||||
links:
|
||||
- skywalking-oap
|
||||
restart: always
|
||||
ports:
|
||||
- 8880:8080
|
||||
environment:
|
||||
SW_OAP_ADDRESS: http://skywalking-oap:12800
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
java -Xms1024m -Xmx1024m -jar app.jar
|
||||
@@ -0,0 +1,76 @@
|
||||
#!/bin/bash
|
||||
|
||||
#设置jar文件名
|
||||
APP_NAME=app.jar
|
||||
|
||||
#使用说明,用来提示输入参数
|
||||
usage() {
|
||||
echo "Usage: sh 执行脚本.sh [start|stop|restart|status]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
#检查程序是否在运行
|
||||
is_exist(){
|
||||
pid=`ps -ef|grep $APP_NAME|grep -v grep|awk '{print $2}' `
|
||||
#如果不存在返回1,存在返回0
|
||||
if [ -z "${pid}" ]; then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
#启动方法
|
||||
start(){
|
||||
is_exist
|
||||
if [ $? -eq "0" ]; then
|
||||
echo "${APP_NAME} is already running. pid=${pid} ."
|
||||
else
|
||||
nohup java -Xms1024m -Xmx1024m -jar $APP_NAME > /dev/null 2>&1 &
|
||||
fi
|
||||
}
|
||||
|
||||
#停止方法
|
||||
stop(){
|
||||
is_exist
|
||||
if [ $? -eq "0" ]; then
|
||||
kill -9 $pid
|
||||
else
|
||||
echo "${APP_NAME} is not running"
|
||||
fi
|
||||
}
|
||||
|
||||
#输出运行状态
|
||||
status(){
|
||||
is_exist
|
||||
if [ $? -eq "0" ]; then
|
||||
echo "${APP_NAME} is running. Pid is ${pid}"
|
||||
else
|
||||
echo "${APP_NAME} is NOT running."
|
||||
fi
|
||||
}
|
||||
|
||||
#重启
|
||||
restart(){
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
#根据输入参数,选择执行对应方法,不输入则执行使用说明
|
||||
case "$1" in
|
||||
"start")
|
||||
start
|
||||
;;
|
||||
"stop")
|
||||
stop
|
||||
;;
|
||||
"status")
|
||||
status
|
||||
;;
|
||||
"restart")
|
||||
restart
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user