码迷,mamicode.com
首页 > 其他好文 > 详细

logstash服务检测与拉起

时间:2016-05-07 10:38:25      阅读:475      评论:0      收藏:0      [点我收藏+]

标签:

检测logstash的conf脚本

check_logstash_serve.sh

#!bin/bash
# check logstash running ? if not,start it
# example: sh check_logstash_serve.sh flumelck /opt/modules/logstash/exec_sh/lck/lck_start.sh

#传入脚本名
serveName=$1

num=`ps -ef | grep $serveName |grep jruby | wc -l`
echo $num

if [ $num -eq 0 ]
then
echo "The $serveName is not running...we will start it..."

#传入启动脚本路径
exec_start_sh=$2

if [ ! -f $exec_start_sh ]; then
echo "The second arg is not file ,please check it..."
exit 3
fi

sh $exec_start_sh

#sendmail to someone
sh /auto_cron/cron-running/tool/logstash-auto-check/sendmail_logstash_start.sh $serveName

else
echo "The $serveName is running!!!!!!!!!!"
fi


在写一个一个脚本可以批量监控多个logstash服务:

autorun-dp-logstash_check_all.sh

#!bin/bash

#owner:dp
#cronTime:*/10 * * * *
#author:
#mail:
#commitDate:
#inputData:
#outputData:
#private:none
#cronDir:/auto_cron/cron-running/tool/logstash-auto-check
#cronfile:autorun-dp-logstash_check_all.sh
#cronlogDir:
#describe:
#sql:none
#other:none
#new conf serve for logstash , add check_sh here ,easy check it!

path='/auto_cron/cron-running/tool/logstash-auto-check/'

cd /opt/logstash/bin/

#flumelck
sh ${path}check_logstash_serve.sh conf/conf_kafka_flumelck.conf /opt/logstash/bin/run_logstash_flumelck.sh

#apputrack
sh ${path}check_logstash_serve.sh conf/conf_kafka_apputrack.conf /opt/logstash/bin/run_logstash_apputrack.sh

#mobile
sh ${path}check_logstash_serve.sh conf/conf_kafka_mobile.conf /opt/logstash/bin/run_logstash_mobile.sh


所以最后通过crontab就可以监控logstash服务,挂掉的服务可以重新拉起。



logstash服务检测与拉起

标签:

原文地址:http://blog.csdn.net/shan1369678/article/details/51332013

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!