#/bin/bash
fy_login=0
fy_idle=0
fy_busy=0
hn_login=0
hn_idle=0
hn_busy=0
info="2022-10-18 15:12:53.560 INFO 2218 --- [scheduling-1] c.e.a.w.service.impl.MonitorService : 监控指标为,丰网速运/淮南职场[登录数:15,置闲数:9,会话数:24],丰网速运[登录数:14,置闲数:0,会话数:0],丰网速运/阜阳职场[登录数:19,置闲数:7,会话数:20]"
echo $info
if [[ $info =~ 淮南职场\[登录数:([0-9]+),置闲数:([0-9]+),会话数:([0-9]+) ]]; then
hn_login=${BASH_REMATCH[1]}
hn_idle=${BASH_REMATCH[2]}
hn_busy=${BASH_REMATCH[3]}
echo "淮南数据:登陆数,空闲数,会话数"
echo $hn_login
echo $hn_idle
echo $hn_busy
fi
if [[ $info =~ 阜阳职场\[登录数:([0-9]+),置闲数:([0-9]+),会话数:([0-9]+) ]]; then
fy_login=${BASH_REMATCH[1]}
fy_idle=${BASH_REMATCH[2]}
fy_busy=${BASH_REMATCH[3]}
echo "阜阳数据:登陆数,空闲数,会话数"
echo $fy_login
echo $fy_idle
echo $fy_busy
fi