Ejemplo n.º 1
0
def createReports(srdfObj,site,datacenter):
    Alerts = {}
    alert = 0
    www = HTML()
    f = Files()
    mailObj = EMail()
    dates = DateString()
    page = []
    csvpage = []
    htmlfile = '/www/SRDF.html'
    csvfile = '/www/SRDF.csv'
    reportDate =  str(time.strftime("%c")) 
    page.append(www.start_html('SRDF Report'))
    html = '<p>Report Date: ' + reportDate + '<br><br>'
    html += 'SRDF Status Report<br><br>'
    page.append(html)
    for group in srdfObj.SRDF_Groups:
      # Print header table
      page.append('<p><br><table align=center  border=3>\n')
      row = ['Group ID','SymID','RemoteSymID','Tracks Pending','Delta Time']
      page.append(www.th_list(row))  
      csvpage.append(', '.join(row) + '\n')
      info = srdfObj.SRDF_Groups_Info[group]
      row = [  group, info['symid'],info['remote_symid'],info['tracks'],info['delta']  ]
      page.append(www.tr_list(row)) 
      page.append(www.end_table)
      csvpage.append(', '.join(row) + '\n')
      # Print Pair data
      page.append('<p><br><table align=center  border=3>\n')
      row = ['Source','Target','Link State','Mode','Replication State']
      page.append(www.th_list(row)) 
      csvpage.append(', '.join(row) + '\n')     
      pairs = srdfObj.SRDF_Groups_Pairs[group]
      for pair in pairs:
        list = pair.split(',')
        if  list[4] != 'Consistent':
          bgcolor="#B0B3AF"
          alert += 1
          Alerts[group] = "SRDF is not in a consistent state for " + group
        else:
          bgcolor="#69F24E"
        page.append(www.tr_list(list,bgcolor)) 
        csvpage.append(', '.join(list) + '\n')     
      page.append(www.end_table)
     
    
    page.append(www.end_html)
    f.write_file(htmlfile,page)
    f.write_file(csvfile,csvpage)

    if alert > 0:
      alertMessage = "The Following SRDF Groups are not Consistent\n\n"
      for groupalert in Alerts:
        alertMessage += Alerts[groupalert]     
      mailObj.subject = "VMAX SRDF Alert " + site + ', ' + datacenter
      mailObj.message = alertMessage
      mailObj.send_mail()   
Ejemplo n.º 2
0
def createReports(sgObj, site, datacenter):
    www = HTML()
    mailObj = EMail()

    dates = DateString()
    page = []
    csvpage = []
    temppage = []
    today = dates.today
    yesterday = dates.yesterday
    tomorrow = dates.tomorrow
    pagedirs = ['download', 'history']
    subdirs = [today, tomorrow, yesterday]
    f = Files()
    for dir in pagedirs:
        f.dir = '/var/www/html/' + dir
        f.mkdir()
        for sub in subdirs:
            f.dir = '/var/www/html/' + dir + '/' + sub
            f.mkdir()
    csvfile = '/www/download/' + today + '/' + datacenter + site + '_failed_disks.csv'
    csvfileperm = '/www/download/' + datacenter + site + '_failed_disks.csv'
    csvlink = '<a href=/download/' + today + '/' + datacenter + site + '_failed_disks.csv>CSV</a>'
    yesterdaylink = '<a href=/history/' + yesterday + '/' + datacenter + site + '_Failed_disks.html>' + yesterday + '</a>'
    tomorrowlink = '<a href=/history/' + tomorrow + '/' + datacenter + site + '_Failed_disks.html>' + tomorrow + '</a>'
    htmlfile1 = '/www/history/' + today + '/' + datacenter + site + '_Failed_disks.html'
    tempfile = '/www/history/' + tomorrow + '/' + datacenter + site + '_Failed_disks.html'
    htmlfile2 = '/www/' + datacenter + site + '_Failed_disks.html'
    logfile = '/www/' + site + '_Failed_disks.log'
    log = []

    reportDate = str(time.strftime("%c"))

    page.append(www.start_html('Failed Disk Report for ' + site))
    page.append(www.EMC_Header(site, datacenter, '', csvlink))

    page.append('<p><br><table align=center  border=3>\n')
    row = ['Failed Disk Report', tomorrowlink, yesterdaylink]
    page.append(www.th_list(row))
    page.append(www.end_table)

    page.append(www.start_table(3, site))
    heading = [
        'Disk_ID', 'DA_Port', 'Spindle_ID', 'Tech', 'Speed', 'Vendor', 'Size',
        'Failed'
    ]
    page.append(www.th_list(heading))
    csvpage.append(', '.join(heading) + '\n')

    alertMessage = 'Disk Error...\n\n'
    alertMessage += ', '.join(heading) + '\n\n'
    alerts = 0

    for disk in sgObj.FailedDisks:
        alerts += 1
        info = sgObj.FailedDisks[disk].split()
        row = [
            info[0], info[1], info[2], info[3], info[4], info[5], info[6],
            info[7]
        ]
        alertMessage += ', '.join(row) + '\n\n'
        csvpage.append(', '.join(row) + '\n')
        page.append(www.tr_list(row))

    page.append(www.end_table)
    page.append(www.end_html)
    f.write_file(htmlfile2, page)
    f.write_file(htmlfile1, page)
    f.write_file(csvfile, csvpage)
    f.write_file(csvfileperm, csvpage)
    temppage.append(www.start_html())
    temppage.append(
        www.Not_Found_Header('Report not created yet for ' + tomorrow))
    temppage.append(www.end_html)
    f.write_file(tempfile, temppage)
    if alerts > 0:

        mailObj.subject = "WARNING: DISK ERROR - VMAX Failed Disk Alert " + site + ', ' + datacenter
        mailObj.message = alertMessage
        mailObj.send_mail()

        if len(sgObj.New_Failures.keys()) > 0:
            reportDate = str(time.strftime("%x - %X"))
            for failed_disk in sgObj.New_Failures.keys():
                log.append(reportDate + " :" + mailObj.subject + " " +
                           failed_disk + "\n")
            f.write_file(logfile, log)
Ejemplo n.º 3
0
def createReports(sgObj, site, datacenter):
    www = HTML()
    mailObj = EMail()

    dates = DateString()
    tiers = ['EFD', 'FC', 'SATA']
    alertLimits = {}
    alertLimits['EFD'] = 99
    alertLimits['FC'] = 80
    alertLimits['SATA'] = 85
    page = []
    csvpage = []
    temppage = []
    today = dates.today
    yesterday = dates.yesterday
    tomorrow = dates.tomorrow
    pagedirs = ['download', 'history']
    subdirs = [today, tomorrow, yesterday]
    f = Files()
    for dir in pagedirs:
        f.dir = '/var/www/html/' + dir
        f.mkdir()
        for sub in subdirs:
            f.dir = '/var/www/html/' + dir + '/' + sub
            f.mkdir()
    csvfile = '/www/download/' + today + '/' + site + '_pools.csv'
    csvfileperm = '/www/download/' + site + '_pools.csv'
    csvlink = '<a href=/download/' + today + '/' + site + '_pools.csv>CSV</a>'
    yesterdaylink = '<a href=/history/' + yesterday + '/' + datacenter + site + '_EMC_Summary.html>' + yesterday + '</a>'
    tomorrowlink = '<a href=/history/' + tomorrow + '/' + datacenter + site + '_EMC_Summary.html>' + tomorrow + '</a>'
    htmlfile1 = '/www/history/' + today + '/' + datacenter + site + '_EMC_Summary.html'
    tempfile = '/www/history/' + tomorrow + '/' + datacenter + site + '_EMC_Summary.html'
    htmlfile2 = '/www/' + datacenter + site + '_EMC_Summary.html'

    reportDate = str(time.strftime("%c"))

    page.append(www.start_html('Thin Pool Report for ' + site))
    page.append(www.EMC_Header(site, datacenter, '', csvlink))

    page.append('<p><br><table align=center  border=3>\n')
    row = ['EMC Storage Summary Report', tomorrowlink, yesterdaylink]
    page.append(www.th_list(row))
    page.append(www.end_table)

    page.append(www.start_table(3, site))
    heading = [
        'Pool', 'Capacity', 'Used', 'Percent Used', 'Free', 'Provisioned',
        'Subscription', 'Subscription Limit', 'PRC', 'Technology', 'Protection'
    ]
    page.append(www.th_list(heading))
    total_usable = 0
    total_provisioned = 0
    total_used = 0
    total_free = 0
    #csvpage.append('Thin Pool Report for ' + site + '\n\n')
    csvpage.append(', '.join(heading) + '\n')

    alertMessage = 'The following pools exceed set thresholds...\n\n'
    alerts = 0
    for tier in tiers:
        for pool in sgObj.pools.keys():
            comparepool = str(pool)
            comparepool = pool.upper()
            if tier in comparepool:
                ##########
                compression = sgObj.pooldetails[pool]['COMPRESSION']
                subscription_limit = sgObj.pooldetails[pool][
                    'SUBSCRIPTION_LIMIT']
                PRC = sgObj.pooldetails[pool]['PRC']
                tech = sgObj.pooldetails[pool]['TECH']
                protection = sgObj.pooldetails[pool]['LAYOUT']
                ##########
                usable = float(sgObj.pools[pool]['total_usable_tracks_gb'])
                used = float(sgObj.pools[pool]['total_used_tracks_gb'])
                percent_used = sgObj.pools[pool]['percent_full']
                free = float(sgObj.pools[pool]['total_free_tracks_gb'])
                subscription = sgObj.pools[pool]['subs_percent']
                usable = int(round(usable, 0))
                used = int(round(used, 0))
                free = int(round(free, 0))
                if int(subscription) == 0:
                    provisioned = 0
                else:
                    provisioned = usable * (float(subscription) / 100)
                total_provisioned += provisioned
                total_usable += usable
                total_used += used
                total_free += free
                html = www.tr
                if int(percent_used) >= alertLimits[tier]:
                    html = www.alerttr
                    alertMessage += "Thin pool " + comparepool + " is " + str(
                        percent_used) + "% used.\n"
                    alertMessage += str(free) + " GB free remain in the pool\n"
                    alertMessage += " The threshold for " + comparepool + ' is set to ' + str(
                        alertLimits[tier]) + '%\n\n'
                    alerts += 1
                row = [
                    pool,
                    str(usable),
                    str(used),
                    str(percent_used),
                    str(free),
                    str(provisioned), subscription, subscription_limit, PRC,
                    tech, protection
                ]
                csvpage.append(', '.join(row) + '\n')

                page.append(www.tr_list(row))

    total_pct_used = int((int(total_used) / float(total_usable)) * 100)
    total_subscription = int(
        (int(total_provisioned) / float(total_usable)) * 100)
    row = [
        'Totals',
        str(total_usable),
        str(total_used),
        str(total_pct_used),
        str(total_free),
        str(total_provisioned),
        str(total_subscription), '___', '___', '___', '___'
    ]

    page.append(www.tr_list(row))
    page.append(www.end_table)
    page.append(www.end_html)
    f.write_file(htmlfile2, page)
    f.write_file(htmlfile1, page)
    f.write_file(csvfile, csvpage)
    f.write_file(csvfileperm, csvpage)
    temppage.append(www.start_html())
    temppage.append(
        www.Not_Found_Header('Report not created yet for ' + tomorrow))
    temppage.append(www.end_html)
    f.write_file(tempfile, temppage)
    if alerts > 0:
        mailObj.subject = "Storage Capacity Alert, " + site + ', ' + datacenter
        mailObj.message = alertMessage
        mailObj.send_mail()
Ejemplo n.º 4
0
def createReports(sgObj,site,datacenter):
    www = HTML()
    mailObj = EMail()
    
    dates = DateString()
    tiers = ['EFD','FC','SATA']
    alertLimits = {}
    alertLimits['EFD'] = 99
    alertLimits['FC'] = 80
    alertLimits['SATA'] = 85
    page = []
    csvpage = []
    temppage = []    
    today =  dates.today
    yesterday = dates.yesterday
    tomorrow = dates.tomorrow
    pagedirs = ['download','history']
    subdirs = [today,tomorrow,yesterday]
    f = Files()
    for dir in pagedirs:
      f.dir = '/var/www/html/' + dir
      f.mkdir() 
      for sub in subdirs:
        f.dir = '/var/www/html/' + dir + '/' + sub
        f.mkdir() 
    csvfile = '/www/download/' + today + '/' + site + '_pools.csv'
    csvfileperm = '/www/download/' + site + '_pools.csv'
    csvlink = '<a href=/download/' + today + '/' + site + '_pools.csv>CSV</a>'
    yesterdaylink = '<a href=/history/' + yesterday + '/' + datacenter + site + '_EMC_Summary.html>' + yesterday + '</a>'  
    tomorrowlink = '<a href=/history/' + tomorrow + '/' + datacenter + site + '_EMC_Summary.html>' + tomorrow + '</a>' 
    htmlfile1 = '/www/history/' + today + '/' + datacenter + site + '_EMC_Summary.html'
    tempfile = '/www/history/' + tomorrow + '/' + datacenter + site + '_EMC_Summary.html'
    htmlfile2 = '/www/' + datacenter + site + '_EMC_Summary.html'

        
    reportDate =  str(time.strftime("%c")) 

    page.append(www.start_html('Thin Pool Report for ' + site))
    page.append(www.EMC_Header(site,datacenter,'',csvlink))
    
    page.append('<p><br><table align=center  border=3>\n')
    row = ['EMC Storage Summary Report',tomorrowlink,yesterdaylink]
    page.append(www.th_list(row)) 
    page.append(www.end_table)
    
    
    page.append(www.start_table(3,site))
    heading = ['Pool','Capacity','Used','Percent Used','Free','Provisioned','Subscription','Subscription Limit','PRC','Technology','Protection']
    page.append(www.th_list(heading))
    total_usable = 0 
    total_provisioned = 0 
    total_used = 0
    total_free = 0
    #csvpage.append('Thin Pool Report for ' + site + '\n\n')
    csvpage.append(', '.join(heading) + '\n')

    
    alertMessage = 'The following pools exceed set thresholds...\n\n'
    alerts = 0
    for tier in tiers:
      for pool in sgObj.pools.keys():
        comparepool = str(pool)
        comparepool = pool.upper()
        if tier in comparepool:
          ##########
          compression = sgObj.pooldetails[pool]['COMPRESSION']
          subscription_limit = sgObj.pooldetails[pool]['SUBSCRIPTION_LIMIT']
          PRC = sgObj.pooldetails[pool]['PRC']
          tech = sgObj.pooldetails[pool]['TECH']
          protection = sgObj.pooldetails[pool]['LAYOUT']
          ##########
          usable = float(sgObj.pools[pool]['total_usable_tracks_gb'])
          used = float(sgObj.pools[pool]['total_used_tracks_gb'])
          percent_used = sgObj.pools[pool]['percent_full']
          free = float(sgObj.pools[pool]['total_free_tracks_gb'])
          subscription = sgObj.pools[pool]['subs_percent']
          usable = int(round(usable,0))
          used = int(round(used,0))
          free = int(round(free,0))
          if int(subscription) == 0:
            provisioned = 0;
          else:
            provisioned = usable * ( float(subscription) / 100)
          total_provisioned += provisioned
          total_usable += usable
          total_used += used
          total_free += free
          html = www.tr
          if int(percent_used) >= alertLimits[tier]:
            html = www.alerttr
            alertMessage += "Thin pool " + comparepool + " is " + str(percent_used) + "% used.\n"
            alertMessage += str(free) + " GB free remain in the pool\n"
            alertMessage +=  " The threshold for " + comparepool + ' is set to ' + str(alertLimits[tier]) + '%\n\n'
            alerts += 1
          row = [pool,str(usable),str(used),str(percent_used),str(free),str(provisioned),subscription,subscription_limit,PRC,tech,protection]
          csvpage.append(', '.join(row) + '\n')
          
          page.append(www.tr_list(row))
          
    total_pct_used = int((int(total_used) / float(total_usable)) * 100)
    total_subscription = int((int(total_provisioned) / float(total_usable)) * 100)
    row = ['Totals',str(total_usable),str(total_used),str(total_pct_used),str(total_free),str(total_provisioned),str(total_subscription),'___','___','___','___']
    
    page.append(www.tr_list(row))  
    page.append(www.end_table)
    page.append(www.end_html)
    f.write_file(htmlfile2,page)
    f.write_file(htmlfile1,page)
    f.write_file(csvfile,csvpage)
    f.write_file(csvfileperm,csvpage)
    temppage.append(www.start_html())
    temppage.append(www.Not_Found_Header('Report not created yet for '+tomorrow))
    temppage.append(www.end_html)
    f.write_file(tempfile,temppage)
    if alerts > 0:
      mailObj.subject = "Storage Capacity Alert, " + site + ', ' + datacenter
      mailObj.message = alertMessage
      mailObj.send_mail()   
Ejemplo n.º 5
0
def createReports(sgObj,site,datacenter):
    www = HTML()
    mailObj = EMail()
    
    dates = DateString()
    page = []
    csvpage = []
    temppage = []    
    today =  dates.today
    yesterday = dates.yesterday
    tomorrow = dates.tomorrow
    pagedirs = ['download','history']
    subdirs = [today,tomorrow,yesterday]
    f = Files()
    for dir in pagedirs:
      f.dir = '/var/www/html/' + dir
      f.mkdir() 
      for sub in subdirs:
        f.dir = '/var/www/html/' + dir + '/' + sub
        f.mkdir() 
    csvfile = '/www/download/' + today + '/' + site + '_failed_disks.csv'
    csvfileperm = '/www/download/' + site + '_failed_disks.csv'
    csvlink = '<a href=/download/' + today + '/' + site + '_failed_disks.csv>CSV</a>'
    yesterdaylink = '<a href=/history/' + yesterday + '/' + datacenter + '_Failed_disks.html>' + yesterday + '</a>'  
    tomorrowlink = '<a href=/history/' + tomorrow + '/' + datacenter + '_Failed_disks.html>' + tomorrow + '</a>' 
    htmlfile1 = '/www/history/' + today + '/' + datacenter + '_Failed_disks.html'
    tempfile = '/www/history/' + tomorrow + '/' + datacenter + '_Failed_disks.html'
    htmlfile2 = '/www/' + datacenter + site + '_Failed_disks.html'
    logfile = '/www/' + site + '_Failed_disks.log'
    log = []
        
    reportDate =  str(time.strftime("%c")) 

    page.append(www.start_html('Failed Disk Report for ' + site))
    page.append(www.EMC_Header(site,datacenter,'',csvlink))
    
    page.append('<p><br><table align=center  border=3>\n')
    row = ['Failed Disk Report',tomorrowlink,yesterdaylink]
    page.append(www.th_list(row)) 
    page.append(www.end_table)
    
    
    page.append(www.start_table(3,site))
    heading = ['Disk_ID','DA_Port','Spindle_ID','Tech','Speed','Vendor','Size','Failed']
    page.append(www.th_list(heading))
    csvpage.append(', '.join(heading) + '\n')

    
    alertMessage = 'Disk Error...\n\n'
    alertMessage += ', '.join(heading) + '\n\n'
    alerts = 0

    for disk in sgObj.FailedDisks:
      alerts += 1
      info = sgObj.FailedDisks[disk].split()
      row = [info[0],info[1],info[2],info[3],info[4],info[5],info[6],info[7]]
      alertMessage += ', '.join(row) + '\n\n'
      csvpage.append(', '.join(row) + '\n')
      page.append(www.tr_list(row))
          

    page.append(www.end_table)
    page.append(www.end_html)
    f.write_file(htmlfile2,page)
    f.write_file(htmlfile1,page)
    f.write_file(csvfile,csvpage)
    f.write_file(csvfileperm,csvpage)
    temppage.append(www.start_html())
    temppage.append(www.Not_Found_Header('Report not created yet for '+tomorrow))
    temppage.append(www.end_html)
    f.write_file(tempfile,temppage)
    if alerts > 0:
      
      mailObj.subject = "WARNING: DISK ERROR - VMAX Failed Disk Alert " + site + ', ' + datacenter
      mailObj.message = alertMessage
      mailObj.send_mail()

      if len(sgObj.New_Failures.keys()) > 0:
        reportDate =  str(time.strftime("%x - %X"))
        for failed_disk in sgObj.New_Failures.keys():
          log.append(reportDate + " :" + mailObj.subject + " " + failed_disk + "\n")      
        f.write_file(logfile,log)