Steps to get mail alert using the weblogic server access.log when response time exceeds the threshold limit
1.Copy and paste the below code onto the weblogic server using vi editor
vi /u01/apps/oracle_oc/user_projects/domains/Domain_Production/responseTimeAlert.sh
----------------------------------------------------------------------
#/bin/sh
dat=`date +"%y-%m-%d"`
dat1=`date +"%H:%M:"`
var=`grep $dat1 /u01/apps/oracle_oc/user_projects/domains/Domain_Production/servers/Managed_Server/logs/access.log | grep "/gb/en.html" | awk '$3>50' > /export/home/weblogic/Scripts/Alert_ResponseTime/Alert_ResponseTime_$dat`
echo $var
if [ -s /export/home/weblogic/Scripts/Alert_ResponseTime/Alert_ResponseTime_$dat ]
then
echo $dat
mailx -s 'The Response time of below given urls is greater than 50 sec' Website.Support@gmail.com < /export/home/weblogic/Scripts/Alert_ResponseTime/Alert_ResponseTime_$dat
<fi
------------------------------------------------------------------------
2. Configure the cronjob for the script created
* * * * * /u01/apps/oracle_oc/user_projects/domains/Domain_Production/responseTimeAlert.sh
3. Whenever the response time for any request exceeds 50 sec, a mail would be triggered.
1.Copy and paste the below code onto the weblogic server using vi editor
vi /u01/apps/oracle_oc/user_projects/domains/Domain_Production/responseTimeAlert.sh
----------------------------------------------------------------------
#/bin/sh
dat=`date +"%y-%m-%d"`
dat1=`date +"%H:%M:"`
var=`grep $dat1 /u01/apps/oracle_oc/user_projects/domains/Domain_Production/servers/Managed_Server/logs/access.log | grep "/gb/en.html" | awk '$3>50' > /export/home/weblogic/Scripts/Alert_ResponseTime/Alert_ResponseTime_$dat`
echo $var
if [ -s /export/home/weblogic/Scripts/Alert_ResponseTime/Alert_ResponseTime_$dat ]
then
echo $dat
mailx -s 'The Response time of below given urls is greater than 50 sec' Website.Support@gmail.com < /export/home/weblogic/Scripts/Alert_ResponseTime/Alert_ResponseTime_$dat
<
------------------------------------------------------------------------
2. Configure the cronjob for the script created
* * * * * /u01/apps/oracle_oc/user_projects/domains/Domain_Production/responseTimeAlert.sh
3. Whenever the response time for any request exceeds 50 sec, a mail would be triggered.
No comments:
Post a Comment