#!/usr/bin/python
# dell_warranty.py v0.1
# Written by Frode Egeland <egeland[at]gmail.com> - Copyright 2009
# Released under the terms of the GNU GPL v3 - see http://www.gnu.org/licenses/gpl-3.0.html
#
# Version History
# 0.1 - 2009-10-12 - Frode Egeland - Initial version. Tested with a simple csv list of service tags only.
#
import urllib2, csv, re
from BeautifulSoup import BeautifulSoup
url="http://support.dell.com/support/topics/global.aspx/support/my_systems_info/details?c=us&l=en&s=gen&ServiceTag=%s"
stlist = []
# generate a list of servicetags from a csv
csvfile = csv.reader(open('taglist.csv'))
for line in csvfile:
for entry in line:
stlist.append(entry)
fixdate = re.compile("(\d{1,2})\/(\d{1,2})\/(\d{4})")
print "Service Tag, Warranty Type, Provider, Start Date, End Date, Days Remaining"
for currtag in stlist:
page = urllib2.urlopen(url % (currtag,))
for line in page.readlines():
if "Parts only Warranty" in line:
soup = BeautifulSoup(line)
break
table = soup.find('table',{'class':"contract_table"})
rows = table.findAll('tr')
rows = rows[1:]
for row in rows:
output = "%s" % (currtag,)
cells = row.findAll('td')
for cell in cells:
if cell.a: # link / formatted text
txt = cell.a.string
elif cell.b: # bold text
txt = cell.b.string
elif cell.i: # italic
txt = cell.i.string
else: #normal text
txt = cell.string
match = fixdate.search(txt)
if match:
txt = "%d-%d-%d" % (int(match.group(3)),int(match.group(1)),int(match.group(2)))
output = "%s,%s" % (output,txt)
output = output.strip()
print output
Если у Вас есть лак перед единственным бэкендом, можно определить 503 страницы, который отображен, когда бэкенд не достижим. Вы могли увеличить свое льготное время так, чтобы Вы служили старому содержанию, если бэкенд перестал работать.
Если у Вас есть лак перед двумя бэкендами, можно определить директора с healthchecks, который удалит плохой бэкенд, оставляя другой ответ бэкенда.
Можно также прервать 503 для создания отчетов о странице от отдельного бэкенда, который имеет статическую страницу. Директора действительно не поддерживают веса, но так как VCL просто компилируется код C, действительно нет очень, Вы не можете сделать. Вы видите, является ли объект beresp ошибкой, и выберите другой бэкенд, возможно, тот для Вашего сообщения об ошибке.
Если Вы не выполняете лак перед веб-фермой, помещение 503 страниц в Лаке является, вероятно, самым легким.