Create Script To Check 3par Replication using HTML and Bash

Kamis, September 17, 20200 komentar

Hi Guys,

If you are a Storage Administrator, you will face the replication configuration and how to monitor the replication. I have a simple script to run everyday to monitor your replication. This script is mixed between bash and html. Please find below my simple script. Hope it will be useful for you.

Before to do this, you have to make passwordless between your server to 3par Storage. 


#!/bin/bash

##### Constants

TITLE="Status Replication"
RIGHT_NOW="$(date +"%x %r %Z")"
TIME_STAMP="Updated on $RIGHT_NOW by $USER"

##### Functions


source_disk ()
{
    echo "<h2>Source Disk </h2>"
    echo "<pre>"
    ssh 3paradm@your3parIp showrcopy |egrep -i 'A|B|C|D' |awk '{print $3}'
    echo "</pre>"

}   

target_disk()
{
    echo "<h2>Target Disk</h2>"
    echo "<pre>"
    ssh 3paradm@your3parIP showrcopy |egrep -i 'X|Y|Z|Q' |awk '{print $1}'
    echo "</pre>"

}   



status_rep()
{
    echo "<h2>Status Sync</h2>"
    echo "<pre>"
    ssh 3paradm@your3parIP showrcopy |egrep -w 'Synced|Syncing|Stop|Stale' |awk '{print $5}'
    echo "</pre>"

}   



##### Main

cat <<- _EOF_
  <html>
  <head>
      <title>$TITLE</title>
  </head>
  <body>
      <h1>$TITLE</h1>
      <p>$TIME_STAMP</p>
        <table style="width:100%">
  <tr>
    <td>$(source_disk)</td>
    <td>$(target_disk)</td>
    <td>$(status_rep)</td>
  </tr>

</table>
  </body>
  </html>
</body>
  </html>
_EOF_



*note : 
A|B|C|D = disk name pattern of your source disk.
X|Y|Z|Q = disk name pattern of your target disk. 


You will have a sample like below :








You can add more in html side, you can add border or something. 
Keep learning. 
Share this article :
 
Support : Awan Argoho San Storage Solution
Copyright © 2011. SHARE MY IT EXPERIENCES - All Rights Reserved
Email | awanargoho@gmail.com Whatsapp | 08111929925
Proudly powered by Blogger