conf script for detecting Logstash
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# Incoming script name servename=$1num= ' Ps-ef | grep $serveName |grep JRuby | Wc-l ' echo $numif [$num-eq 0]thenecho "The $serveName is not running...we would start it ..." #传入启动脚本路径exec_start_sh =$2if [!-f $exec _start_sh]; Thenecho "The second arg is not a file, please check it ..." Exit 3fish $exec _start_sh#sendmail to Someonesh/auto_cron/cron-r Unning/tool/logstash-auto-check/sendmail_logstash_start.sh $serveNameelseecho "The $serveName is running!!!!!!!!!!" Fi
Write a script that can monitor multiple Logstash services in bulk:
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/#flumelcksh ${path}check_logstash_ serve.sh Conf/conf_kafka_flumelck.conf/opt/logstash/bin/run_logstash_flumelck.sh#apputracksh ${path}check_ logstash_serve.sh Conf/conf_kafka_apputrack.conf/opt/logstash/bin/run_logstash_apputrack.sh#mobilesh ${path} Check_logstash_serve.sh conf/conf_kafka_mobile.conf/opt/logstash/bin/run_logstash_mobile.sh
So finally through Crontab can monitor the Logstash service, hang off the service can be pulled up again.
Logstash service detection and pull up