ZABBIX开发Zookeeper中间件服务状态监控
脚本内容:
#!/bin/sh
###################################################
# Used to obtain the Zookeeper middleware service status
# script by shell
# writed by Deliver
# huchangxi 2022/11/15
###################################################
# 获取Zookeeper中间件当前服务运行状态。
zk_port=$1
ruok=`(echo ruok;sleep 2) |telnet localhost $zk_port 2>/dev/null | sed -n '4p'`
if [ -n "$ruok" ];then
echo $ruok
else
echo NO
fi