How Did I Create a Dashboard deployed on EBS Apache to monitor My Server Mounts using Bash Scripting and HTML 


In this post, I am going to share my experience on how did I created a Dashboard to monitor my Oracle database server Archive Locations.
Also, we can have various tools to monitor like OEM etc, but this was done to monitor all of them in one-shot in almost real-time.

You can make any changes as you want. I am just sharing my experience.

Pre-Requisites

  • I am having a shared location for all my servers. In this blog just sharing 3-4 servers as an example.
  • An EBS/Oracle Apps environment Running. You can also use any standalone Apache for this.


Step 1:

Make a Directory on the Shared file system

mkdir -p /shared/oracle/DASHBOARD

Step 2:

Create a shell script to monitor the archive location

cd  /shared/oracle/DASHBOARD

vi generate_report.sh

REPORT_LOCATION=/shared/oracle/DASHBOARD
REP_FILE=`hostname -a`.txt
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" > $REPORT_LOCATION/$REP_FILE
echo "Archive Location Report for--> `hostname`"  >> $REPORT_LOCATION/$REP_FILE
df -h |head -1 >> $REPORT_LOCATION/$REP_FILE
df -h |grep -i archlog >> $REPORT_LOCATION/$REP_FILE
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" >> $REPORT_LOCATION/$REP_FILE


Step 3:

I have scheduled the script in cron to run every 5 minutes on the servers which I want to monitor. 

*/5 * * * * /shared/oracle/DASHBOARD/generate_report.sh  > /dev/null 2>&1
It will generate reports like server1.txt, server2.txt etc..

Step 4:

Go to your EBS server.
Connect as EBS OS user and for to below directory

cd $INST_TOP/portal

make a soft link to shared directory

ln -s /shared/oracle/DASHBOARD DASHBOARD 

cd $INST_TOP/portal

vi archive_report.html

paste the code below


<!DOCTYPE html>
<html>
<head>
<title>
Report for Archive Mounts</title>
<meta http-equiv="refresh" content="300">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="This report is generated from Database Servers to monitor the archive location usage.">
<style>
body {background-color:#ffffff;background-repeat:no-repeat;background-position:top left;background-attachment:fixed;}
h1{font-family:Arial, sans-serif;color:#000000;background-color:#ccd1d1;}
p {font-family:Georgia, serif;font-size:14px;font-style:normal;font-weight:normal;color:#000000;background-color:#ffffff;}
</style>
</head>
<body>
<h1>Report for Archive Mounts</h1>
<div id="list">
  <p><iframe src="DASHBOARD/server1.txt" frameborder="0" height="150"
      width="95%"></iframe></p>
   <p><iframe src="DASHBOARD/server2.txt" frameborder="0" height="110"
      width="95%"></iframe></p>
             <p><iframe src="DASHBOARD/server3.txt" frameborder="0" height="110"
      width="95%"></iframe></p>
             <p><iframe src="DASHBOARD/server4.txt" frameborder="0" height="110"
      width="95%"></iframe></p>
</div>
<p></p>
</body>
</html>

Save and close. 
Note: The page is written to automatic refresh every 5 minutes.

Step 5:

Now open your browser and put the EBS  URL hostname and port along with name to html report.

http://ebs122.lab:8010/archive_report.html

Thats it...



If you like please follow and comment