hadoop服务监控

hadoop

监控进程有没有挂的脚本 并发邮件

#!/bin/bash
P_num=`ps -ef |grep ResourceManager | grep -v grep | wc -l`
P_num_tmp=`cat /tmp/P_num.log`
echo $P_num > /tmp/P_num.log
if [ $P_num -eq 0 ] && [ $P_num_tmp -eq 1 ]; then
echo “Feng-Cluster-NN-01 ResourceManager is down please check ” |mail -s “Cluster-NN-01 ResourceManager is down ” lqxxxxx@qq.com
echo “Feng-Cluster-NN-01 ResourceManager is down please check ” |mail -s “Cluster-NN-01 ResourceManager is down ” xxxxx@office.feng.com
echo “`date ‘+%Y-%m-%d %H:%M:%S’` Feng-Cluster-NN-01 ResourceManager is down is DOWN ” >> /logs/ResourceManager.log
fi

P_num2=` ssh 192.168.205.204 ‘ps -ef |grep ResourceManager | grep -v grep | wc -l’`
P_num2_tmp=`cat /tmp/P_num2.log`
echo $P_num2 > /tmp/P_num2.log
if [ $P_num2 -eq 0 ] && [ $P_num2_tmp -eq 1 ]; then
echo “Feng-Cluster-NN-02 ResourceManager is down please check ” |mail -s “Cluster-NN-02 ResourceManager is down ” lqxxxx@qq.com
echo “Feng-Cluster-NN-02 ResourceManager is down please check ” |mail -s “Cluster-NN-02 ResourceManager is down ” xxxx@office.feng.com
echo “`date ‘+%Y-%m-%d %H:%M:%S’` Feng-Cluster-NN-02 ResourceManager is down is DOWN ” >> /logs/ResourceManager.log

文章分类 hadoop, shell

发表评论

电子邮件地址不会被公开。 必填项已用*标注

*