开源监控-hertzbeat
开源版本,监控时间,最低30S每次, 对于要求性比较高的,可以忽略这个监控
全局变量 .env
root@monitor-1:/data/monitor/hertzbeat# more .env
DOCKER_BRIDGE_SUBNET=172.28.0.0/16
DOCKER_BRIDGE_GATEWAY=172.28.0.1
INFLUXDB_NETWORK_ADDRESS=172.28.0.2
MYSQL_NETWORK_ADDRESS=172.28.0.3
HERTZBEAT_NETWORK_ADDRESS=172.28.0.4
HERTZBEAT_COLLECTOR_NETWORK_ADDRESS=172.28.0.5
application.yaml 使用部分
这个配置文件,可以单独启动一个容器,从容器中复制出来,修改下 mysql (存储)和 influxb (时序)
---
spring:
config:
activate:
on-profile: prod
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: 123456
url: jdbc:mysql://hertzbeat-mysql:3306/hertzbeat?useUnicode=true&characterEncoding=utf-8&useSSL=false
hikari:
max-lifetime: 120000
warehouse:
store:
influxdb:
enabled: true
server-url: http://hertzbeat-influxdb:8086
username: root
password: root
expire-time: '30d'
replication: 1
docker-compose.yaml
root@monitor-1:/data/monitor/hertzbeat# cat docker-compose.yml
version: '3.3'
networks:
server:
driver: bridge
ipam:
driver: default
config:
- subnet: '${DOCKER_BRIDGE_SUBNET:-172.28.0.0/16}'
#gateway: '${DOCKER_BRIDGE_GATEWAY:-172.28.0.1}'
services:
hertzbeat-influxdb:
image: 'influxdb:1.8'
container_name: hertzbeat-influxdb
restart: always
#environment:
# - INFLUXDB_DB=mydb
# - INFLUXDB_ADMIN_USER=admin
# - INFLUXDB_ADMIN_PASSWORD=admin_password
# - INFLUXDB_USER=root
# - INFLUXDB_USER_PASSWORD=root
volumes:
- '${PWD}/data/influxdb-data:/var/lib/influxdb'
expose:
- 8086
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "5"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8086/ping"]
interval: 10s
timeout: 5s
retries: 3
networks:
server:
ipv4_address: ${INFLUXDB_NETWORK_ADDRESS:-172.28.0.2}
hertzbeat-mysql:
image: 'mysql:5.7'
container_name: hertzbeat-mysql
restart: always
environment:
- TZ=Asia/Shanghai
- MYSQL_ROOT_PASSWORD=123456
- MYSQL_DATABASE=hertzbeat
- MYSQL_USER=hertzbeat
- MYSQL_PASSWORD=123456
- MYSQL_ROOT_HOST=%
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
volumes:
- '${PWD}/data/mysql-data:/var/lib/mysql'
expose:
- 3306
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "5"
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-uroot", "-p123456",]
interval: 30s
timeout: 10s
networks:
server:
ipv4_address: ${MYSQL_NETWORK_ADDRESS:-172.28.0.3}
hertzbeat:
image: tancloud/hertzbeat
container_name: hertzbeat
restart: always
volumes:
#- '${PWD}/sureness.yml:/opt/hertzbeat/config/sureness.yml'
- '${PWD}/application.yml:/opt/hertzbeat/config/application.yml'
- '${PWD}/data/hertzbeat-logs:/opt/hertzbeat/logs'
- '${PWD}/data/hertzbeat-data:/opt/hertzbeat/data'
environment:
- TZ=Asia/Shanghai
- LANG=zh_CN.UTF-8
ports:
- '1158:1158'
- '1157:1157'
depends_on:
- hertzbeat-mysql
- hertzbeat-influxdb
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "5"
networks:
server:
ipv4_address: ${HERTZBEAT_NETWORK_ADDRESS:-172.28.0.4}
hertzbeat-collector:
image: tancloud/hertzbeat-collector
container_name: hertzbeat-collector
restart: always
environment:
- MANAGER_PORT=1158
- MANAGER_HOST=hertzbeat
- MODE=public
- IDENTITY=localhost-collector
depends_on:
- hertzbeat
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "5"
networks:
server:
ipv4_address: ${HERTZBEAT_COLLECTOR_NETWORK_ADDRESS:-172.28.0.5}
Last updated