mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-07 21:17:17 +08:00
add prometheus docker-compose for monitor
This commit is contained in:
parent
9ee525ab6a
commit
b62684c2ff
1460
config/prometheus-dashboard.yaml
Normal file
1460
config/prometheus-dashboard.yaml
Normal file
File diff suppressed because it is too large
Load Diff
85
config/prometheus.yml
Normal file
85
config/prometheus.yml
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
# 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.29.166.17:9093'] #alertmanager地址
|
||||||
|
|
||||||
|
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
|
||||||
|
rule_files:
|
||||||
|
# - "node_down.yml"
|
||||||
|
# - "first_rules.yml"
|
||||||
|
# - "second_rules.yml"
|
||||||
|
|
||||||
|
# A scrape configuration containing exactly one endpoint to scrape:
|
||||||
|
# Here it's Prometheus itself.
|
||||||
|
scrape_configs:
|
||||||
|
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
|
||||||
|
# prometheus抓取的监控的信息
|
||||||
|
- job_name: 'node-exporter'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '172.29.166.17:19100' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
|
||||||
|
# prometheus抓取应用服务
|
||||||
|
- job_name: 'openimserver-openim-api'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '172.29.166.17:20100' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-msggateway'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '172.29.166.17:20140' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-msgtransfer'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '172.29.166.17:21400','172.29.166.17:21401','172.29.166.17:21402','172.29.166.17:21403' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-push'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '172.29.166.17:20170' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-rpc-auth'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '172.29.166.17:20160' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-rpc-conversation'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '172.29.166.17:20230' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-rpc-friend'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '172.29.166.17:20120' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-rpc-group'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '172.29.166.17:20150' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-rpc-msg'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '172.29.166.17:20130' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-rpc-third'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '172.29.166.17:21301' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-rpc-user'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '172.29.166.17:20110' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
85
deployments/templates/prometheus.yaml
Normal file
85
deployments/templates/prometheus.yaml
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
# 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.29.166.17:9093'] #alertmanager地址
|
||||||
|
|
||||||
|
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
|
||||||
|
rule_files:
|
||||||
|
# - "node_down.yml"
|
||||||
|
# - "first_rules.yml"
|
||||||
|
# - "second_rules.yml"
|
||||||
|
|
||||||
|
# A scrape configuration containing exactly one endpoint to scrape:
|
||||||
|
# Here it's Prometheus itself.
|
||||||
|
scrape_configs:
|
||||||
|
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
|
||||||
|
# prometheus抓取的监控的信息
|
||||||
|
- job_name: 'node-exporter'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '${NODE_EXPORTER_ADDRESS}:${NODE_EXPORTER_PORT}' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
|
||||||
|
# prometheus抓取应用服务
|
||||||
|
- job_name: 'openimserver-openim-api'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '${OPENIM_SERVER_ADDRESS}:${API_PROM_PORT}' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-msggateway'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '${OPENIM_SERVER_ADDRESS}:${MSG_GATEWAY_PROM_PORT}' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-msgtransfer'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '${MSG_TRANSFER_PROM_ADDRESS_PORT}' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-push'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '${OPENIM_SERVER_ADDRESS}:${PUSH_PROM_PORT}' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-rpc-auth'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '${OPENIM_SERVER_ADDRESS}:${AUTH_PROM_PORT}' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-rpc-conversation'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '${OPENIM_SERVER_ADDRESS}:${CONVERSATION_PROM_PORT}' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-rpc-friend'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '${OPENIM_SERVER_ADDRESS}:${FRIEND_PROM_PORT}' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-rpc-group'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '${OPENIM_SERVER_ADDRESS}:${GROUP_PROM_PORT}' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-rpc-msg'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '${OPENIM_SERVER_ADDRESS}:${MESSAGE_PROM_PORT}' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-rpc-third'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '${OPENIM_SERVER_ADDRESS}:${THIRD_PROM_PORT}' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-rpc-user'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '${OPENIM_SERVER_ADDRESS}:${USER_PROM_PORT}' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
@ -67,17 +67,17 @@ services:
|
|||||||
ipv4_address: ${REDIS_NETWORK_ADDRESS}
|
ipv4_address: ${REDIS_NETWORK_ADDRESS}
|
||||||
|
|
||||||
zookeeper:
|
zookeeper:
|
||||||
image: bitnami/zookeeper:3.8
|
image: bitnami/zookeeper:3.8
|
||||||
container_name: zookeeper
|
container_name: zookeeper
|
||||||
ports:
|
ports:
|
||||||
- "${ZOOKEEPER_PORT}:2181"
|
- "${ZOOKEEPER_PORT}:2181"
|
||||||
volumes:
|
volumes:
|
||||||
- "/etc/localtime:/etc/localtime"
|
- "/etc/localtime:/etc/localtime"
|
||||||
environment:
|
environment:
|
||||||
- ALLOW_ANONYMOUS_LOGIN=yes
|
- ALLOW_ANONYMOUS_LOGIN=yes
|
||||||
- TZ="Asia/Shanghai"
|
- TZ="Asia/Shanghai"
|
||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
server:
|
server:
|
||||||
ipv4_address: ${ZOOKEEPER_NETWORK_ADDRESS}
|
ipv4_address: ${ZOOKEEPER_NETWORK_ADDRESS}
|
||||||
|
|
||||||
@ -142,3 +142,36 @@ services:
|
|||||||
server:
|
server:
|
||||||
ipv4_address: ${OPENIM_WEB_NETWORK_ADDRESS}
|
ipv4_address: ${OPENIM_WEB_NETWORK_ADDRESS}
|
||||||
|
|
||||||
|
prometheus:
|
||||||
|
image: prom/prometheus
|
||||||
|
container_name: prometheus
|
||||||
|
hostname: prometheus
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- ./config/prometheus.yml:/etc/prometheus/prometheus.yml
|
||||||
|
ports:
|
||||||
|
- "${PROMETHEUS_PORT}:9090"
|
||||||
|
networks:
|
||||||
|
- server
|
||||||
|
|
||||||
|
node-exporter:
|
||||||
|
image: quay.io/prometheus/node-exporter
|
||||||
|
container_name: node-exporter
|
||||||
|
hostname: node-exporter
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "${NODE_EXPORTER_PORT}:9100"
|
||||||
|
networks:
|
||||||
|
- server
|
||||||
|
|
||||||
|
grafana:
|
||||||
|
image: grafana/grafana
|
||||||
|
container_name: grafana
|
||||||
|
hostname: grafana
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "${GRAFANA_PORT}:3000"
|
||||||
|
volumes:
|
||||||
|
- ${DATA_DIR}/components/grafana:/var/lib/grafana
|
||||||
|
networks:
|
||||||
|
- server
|
||||||
|
|||||||
13
prometheus.md
Normal file
13
prometheus.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
## prometheus 使用
|
||||||
|
|
||||||
|
通过docker-compose安装完Prometheus,node_exporter和grafana,默认grafana的对外端口号是3000,
|
||||||
|
打开grafana,
|
||||||
|
默认账户密码是admin:admin,
|
||||||
|
然后配置grafana的Prometheus数据源,在如下界面配置,
|
||||||
|

|
||||||
|

|
||||||
|
注意ip地址和端口号是服务器局域网ip和Prometheus端口,比如172.29.166.17:19090。
|
||||||
|
然后在如下页面导入dashboard,dashboard的yaml在文件中
|
||||||
|

|
||||||
|

|
||||||
@ -250,6 +250,9 @@ def "RPC_LISTEN_IP" "0.0.0.0" # RPC的监听IP
|
|||||||
def "PROMETHEUS_PORT" "19090" # Prometheus的端口
|
def "PROMETHEUS_PORT" "19090" # Prometheus的端口
|
||||||
def "PROMETHEUS_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # Prometheus的地址
|
def "PROMETHEUS_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # Prometheus的地址
|
||||||
|
|
||||||
|
###################### node-exporter 配置 ######################
|
||||||
|
def "NODE_EXPORTER_PORT" "19100" # node-exporter的端口
|
||||||
|
def "NODE_EXPORTER_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # node-exporter的地址
|
||||||
###################### Grafana 配置信息 ######################
|
###################### Grafana 配置信息 ######################
|
||||||
def "GRAFANA_PORT" "3000" # Grafana的端口
|
def "GRAFANA_PORT" "3000" # Grafana的端口
|
||||||
def "GRAFANA_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # Grafana的地址
|
def "GRAFANA_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # Grafana的地址
|
||||||
@ -367,7 +370,7 @@ readonly THIRD_PROM_PORT=${THIRD_PROM_PORT:-'21301'}
|
|||||||
|
|
||||||
# Message Transfer 服务的 Prometheus 端口列表
|
# Message Transfer 服务的 Prometheus 端口列表
|
||||||
readonly MSG_TRANSFER_PROM_PORT=${MSG_TRANSFER_PROM_PORT:-'21400, 21401, 21402, 21403'}
|
readonly MSG_TRANSFER_PROM_PORT=${MSG_TRANSFER_PROM_PORT:-'21400, 21401, 21402, 21403'}
|
||||||
|
readonly MSG_TRANSFER_PROM_ADDRESS_PORT="${DOCKER_BRIDGE_GATEWAY}:21400, ${DOCKER_BRIDGE_GATEWAY}:21401, ${DOCKER_BRIDGE_GATEWAY}:21402, ${DOCKER_BRIDGE_GATEWAY}:21403"
|
||||||
###################### OpenIM openim-api ######################
|
###################### OpenIM openim-api ######################
|
||||||
def "OPENIM_API_HOST" "127.0.0.1"
|
def "OPENIM_API_HOST" "127.0.0.1"
|
||||||
def "OPENIM_API_BINARY" "${OPENIM_OUTPUT_HOSTBIN}/openim-api" # OpenIM openim-api 二进制文件路径
|
def "OPENIM_API_BINARY" "${OPENIM_OUTPUT_HOSTBIN}/openim-api" # OpenIM openim-api 二进制文件路径
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user