PRTG giám sát dịch vụ tomcat up/down thông qua bash script – PRTG monitoring service tomcat up/down via bash script

on
  1. Monitoring on CentOS 6
    mkdir -p /home/scripts
    vim /home/scrips/monitor_serivce_tomcat.sh
    Add the script below into the monitor_serivce_tomcat.sh file

!/bin/bash
serviceIsRunning=false
var1=$(/etc/init.d/tomcat status | awk ‘{print $3}’)
if [ “$var1” == ‘running’ ]
then
serviceIsRunning=true
echo “0:200:Running”
fi
if [ $serviceIsRunning == false ]
then
echo “2:404:stop”
fi

Leave a Reply

Your email address will not be published. Required fields are marked *