标签:自动 脚本监控 脚本 节点配置 影响 shel src log grep -v
storm主从节点配置监控脚本脚本详情
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#日志输出
Nimerror=/tmp/sup-Nimerror.log
superror=/tmp/sup-error.log
#监控主节点,主节点需先启动NimbusServer进程,再启动upervisor进程
NimbusServer=/usr/local/jdk1.7.0_45/bin/jps | grep NimbusServer | grep -v grep | awk ‘{print $2}‘
#监控从节点,从节点仅包含Supervisor进程
supervisor=/usr/local/jdk1.7.0_45/bin/jps | grep Supervisor | grep -v grep | awk ‘{print $2}‘
if [ -z "$NimbusServer" ]
then
{
echo "date
: NimbusServer is down" >>$Nimerror
/usr/local/jstorm-0.9.6.2/bin/jstorm nimbus&
}
elif [ -z "$supervisor" ]
then
{
echo "date
: supervisor is down" >>$superror
/usr/local/jstorm-0.9.6.2/bin/jstorm supervisor&
}
fi
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2.配置jstorm从节点
配置从节点监控脚本:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#!/bin/sh
#日志输出
suplog=/tmp/sup-start.log
superror=/tmp/sup-error.log
supervisor=/usr/local/jdk1.7.0_45/bin/jps | grep Supervisor | grep -v grep | awk ‘{print $2}‘
if [ -z "$supervisor" ]
then
{
echo "date
: listen port is down" >>$superror
/usr/local/jstorm-0.9.6.2/bin/jstorm supervisor&
}
else
{
echo "date
:正常 " >>$suplog
}
fi
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
转载请注明出处,谢谢。
标签:自动 脚本监控 脚本 节点配置 影响 shel src log grep -v
原文地址:https://blog.51cto.com/lmy666/2521328