优秀的编程知识分享平台

网站首页 > 技术文章 正文

Zabbix如何通过模板监控Kafka消息队列

nanyue 2024-12-12 14:09:05 技术文章 7 ℃

1.基本配置信息

1.1在安装zabbix-server服务器端安装(zabbix_java_gateway)

yum install zabbix-java-gateway
systemctl restart zabbix-java-gateway

1.2修改zabbix_server的配置文件

vim /etc/zabbix/zabbix_server.conf
#配置信息
### Option: JavaGateway
# IP address (or hostname) of Zabbix Java gateway.
# Only required if Java pollers are started.
#
# Mandatory: no
# Default:
JavaGateway=192.168.10.102 ##服务器ip地址信息
### Option: JavaGatewayPort
# Port that Zabbix Java gateway listens on.
#
# Mandatory: no
# Range: 1024-32767
# Default:
JavaGatewayPort=10052 ##默认端口号
### Option: JavaGatewayPort
# Port that Zabbix Java gateway listens on.
#
# Mandatory: no
# Range: 1024-32767
# Default:
StartJavaPollers=5 ##从java_gateway采集的线程数

1.3启动zabbix-java-gateway、zabbix-server

#启动zabbix-java-gateway
systemctl start zabbix-java-gateway
#重启zabbix-server服务
systemctl restart zabbix-server

1.4在安装kafka服务器上,修改对应的配置信息

##kafka的安装目录信息
vim /soft/kafka/bin/kafka-server-start.sh

##加入export JMX_PORT=12345,启用JMX端口

#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
export JMX_PORT=12345
if [ $# -lt 1 ];
then
echo "USAGE: $0 [-daemon] server.properties [--override property=value]*"
exit 1
fi
base_dir=$(dirname $0)
if [ "x$KAFKA_LOG4J_OPTS" = "x" ]; then
export KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:$base_dir/../config/log4j.properties"
fi
if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then
export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G"
fi
EXTRA_ARGS=${EXTRA_ARGS-'-name kafkaServer -loggc'}
COMMAND=$1
case $COMMAND in
-daemon)
EXTRA_ARGS="-daemon "$EXTRA_ARGS
shift
;;
*)
;;
esac
exec $base_dir/kafka-run-class.sh $EXTRA_ARGS kafka.Kafka "$@"
##重新启动kafka,输入以下这个命令
ss -nelp | grep 12345

2.在Zabbix_Web页面配置

2.1点击配置/主机(选中安装kafka主机)

2.2配置JMX信息

2.3配置监控kafka指标模板

2.4查看主机中kafka最新数据

最近发表
标签列表