Monitoring script for OS level and Server level Daily Health

Share this post
issues-after-qlikview-version-upgrade-on-passive-node-of-production-servers

Get daily monitoring health check report and monitor entire servers including services of that servers and statistics of the server.

Please find below script for daily health check monitoring and please find below output of the script. It contains the status of MEMORY, DISK, PROCESSES, CPU, Hawk services, TIBCO ADMIN, TIBCO EMS and all services which are running or stopped on that particular servers (like OS level and Server level monitoring). The Output of the server will get as health check report.txt over an email and we scheduled it twice in a day by using cron job.

Monitoring-Script.sh

***************************************

#!/bin/bash

#DAILY MONITORING SCRIPT

HOSTNAME=`hostname`

FILENAME=Scripts/Daily_Monitoring/$HOSTNAME.`date “+%m%d%Y%H%M”`.txt

DATE=`date “+%b-%d-%Y-%H:%M”`

RECIEPIENT=”ABC@XYZ.com”

echo “Hostname –>” $HOSTNAME >> $FILENAME

echo ”  ” >> $FILENAME

echo “Date and Time –>” $DATE >> $FILENAME

echo ”  ” >> $FILENAME

echo ”                                  MEMORY STATUS” >> $FILENAME

echo ”  ” >> $FILENAME

free -m >> $FILENAME

echo ”  ” >> $FILENAME

echo ”                                  DISK FREE STATUS” >> $FILENAME

echo ”  ” >> $FILENAME

df -h >> $FILENAME

echo ”                                  DISK USAGE STATUS” >> $FILENAME

echo ”  ” >> $FILENAME

du -sh >> $FILENAME

echo ”                                  DISK USAGE STATUS OF /OPT/TIBCO/” >> $FILENAME

echo ”  ” >> $FILENAME

du -sh /opt/mis/apps/tibco/ >> $FILENAME

echo ”                                  PROCESS MONITORING STATUS” >> $FILENAME

echo ”  ” >> $FILENAME

top -b -n 1 -u tibcoprd >> $FILENAME

echo ”                                  OVERALL CPU STATUS” >> $FILENAME

echo ”  ” >> $FILENAME

ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10 >> $FILENAME

echo ”  ” >> $FILENAME

echo ”                         TIBCO Admin RUNNING STATUS” >> $FILENAME

echo ”  ” >> $FILENAME

ps -eaf |grep -v grep | grep “tibcoadmin” >> $FILENAME

echo ”  ” >> $FILENAME

ps -ef | grep -v grep | grep “tibcoadmin” > /dev/null

if [ $? -ne 0 ]; then

echo “TIBCO admin Is Not Running, Please Check” >> $FILENAME

else

echo “TIBCO admin Is Running Fine” >> $FILENAME

fi

***********************************************

Health_chcek_report.txt

****************************************************

Hostname –> XYZ

Date and Time –> Feb-08-2021-04:00

MEMORY STATUS

total        used        free      shared   buff/cache   available

Mem:          64498       33443       27319          35        3736       30362

Swap:          1023           0        1023

                                  VMSTAT STATUS

DISK FREE STATUS

Filesystem                                    Size Used     Avail Use% Mounted on

tmpfs                                          32G     0   32G   0% /dev/shm

DISK USAGE STATUS

16G

DISK USAGE STATUS OF /OPT/TIBCO/

16G     /opt/mis/apps/

TIBCO Admin RUNNING STATUS

tibcoprd   11817      1    0 Jan29?        01:35:18. /tibcoadmin_omprd –innerProcess

TIBCO admin Is Running Fine

Share this post