Shell script to alert us when specified background process exceeds limit
Hello Everyone, The below script will help us to find number of processes runs in the background and send us alerts based on warning and critical thresholds. Script : # ]$ cat /home/oracle/DBA/bin/running_process.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#!/bin/bash # Syntax to run this script # ./running_process.sh oracle 100 170 # ./running_process.sh PROCESS_NAME WARNING CRITICAL export MAILIST='ajaykumar@ktexperts.com, process_name=$1 _limit1=$2 _limit2=$3 _proc=`ps -ef | grep $process_name | wc -l` if [ "$_proc" -ge "$_limit2" ] then echo "Current Running $process_name Proccess is running too high $_proc " > /tmp/proc.log cat /tmp/proc.log cat /tmp/proc.log | mailx -s "${TODAY} - Current Running $process_name Proccess is running too high/Critical $_proc " ${MAILIST} else if [ "$_proc" -ge "$_limit1" ] then echo "Current Running $process_name Proccess is running more than expected $_proc " > /tmp/proc.log cat /tmp/proc.log cat /tmp/proc.log | mailx -s "${TODAY} - Current Running $process_name Proccess is running more than expected $_proc " ${MAILIST} fi fi |
Script execution : Syntax : ./running_process.sh <PROCESS_NAME> <WARNING> <CRITICAL> Here I… Read More