class DbLock: """DbLock sheet""" def __init__(self, workbook): self._workbook = workbook self._name = '数据库长时间锁检查' self._sheet = FitSheetWrapper(self._workbook.add_sheet(self._name)) self._row = 0 self._seq = 1 self._length = 15 self._time = datetime.datetime.now() self._handle_head() def _row_inc(self): self._row += 1 def _seq_inc(self): self._seq += 1 def _handle_head(self): self._sheet.write_merge(self._row, self._row, 0, self._length - 1, '金税三期个人税收系统数据库长时间锁检查', style=STYLE_TITLE) self._row_inc() self._sheet.write(self._row, 0, '填表人') self._sheet.write(self._row, 2, '填表日期') self._sheet.write_merge(self._row, self._row, 3, self._length - 1, self._time.strftime('%Y-%m-%d %H:%M:%S')) self._row_inc() # write column name self._sheet.write(self._row, 0, '序号', style=STYLE_HEAD) self._sheet.write(self._row, 1, 'DBNAME', style=STYLE_HEAD) self._sheet.write(self._row, 2, 'TM', style=STYLE_HEAD) self._sheet.write(self._row, 3, 'SID', style=STYLE_HEAD) self._sheet.write(self._row, 4, 'SQL_ID', style=STYLE_HEAD) self._sheet.write(self._row, 5, 'SQL_CHILD_NUMBER', style=STYLE_HEAD) self._sheet.write(self._row, 6, 'PREV_SQL_ID', style=STYLE_HEAD) self._sheet.write(self._row, 7, 'XID', style=STYLE_HEAD) self._sheet.write(self._row, 8, 'START_TIME', style=STYLE_HEAD) self._sheet.write(self._row, 9, 'TYPE', style=STYLE_HEAD) self._sheet.write(self._row, 10, 'BLOCK', style=STYLE_HEAD) self._sheet.write(self._row, 11, 'CTIME', style=STYLE_HEAD) self._sheet.write(self._row, 12, 'EL_SECOND', style=STYLE_HEAD) self._sheet.write(self._row, 13, 'PREV_SQL_TEXT', style=STYLE_HEAD) self._sheet.write(self._row, 14, 'SQL_TEXT', style=STYLE_HEAD) self._row_inc() def insert(self, *args): self._sheet.write(self._row, 0, self._seq, style=STYLE_BODY) for i, arg in enumerate(args): self._sheet.write(self._row, i + 1, arg, style=STYLE_BODY) self._row_inc() self._seq_inc()
class DiskUse: """disk_use sheet""" def __init__(self, workbook): self._workbook = workbook self._name = '磁盘使用率检查' self._sheet = FitSheetWrapper(self._workbook.add_sheet(self._name)) self._row = 0 self._seq = 1 self._length = 8 self._time = datetime.datetime.now() self._handle_head() def _row_inc(self): self._row += 1 def _seq_inc(self): self._seq += 1 def _handle_head(self): self._sheet.write_merge(self._row, self._row, 0, self._length - 1, '金税三期个人税收系统磁盘使用率检查', style=STYLE_TITLE) self._row_inc() self._sheet.write(self._row, 0, '填表人') self._sheet.write(self._row, 2, '填表日期') self._sheet.write_merge(self._row, self._row, 3, self._length - 1, self._time.strftime('%Y-%m-%d %H:%M:%S')) self._row_inc() # write column name self._sheet.write(self._row, 0, '序号', style=STYLE_HEAD) self._sheet.write(self._row, 1, '主机IP', style=STYLE_HEAD) self._sheet.write(self._row, 2, '文件系统', style=STYLE_HEAD) self._sheet.write(self._row, 3, '容量', style=STYLE_HEAD) self._sheet.write(self._row, 4, '已用', style=STYLE_HEAD) self._sheet.write(self._row, 5, '可用', style=STYLE_HEAD) self._sheet.write(self._row, 6, '已用%', style=STYLE_HEAD) self._sheet.write(self._row, 7, '挂载点', style=STYLE_HEAD) self._row_inc() def insert(self, *args): self._sheet.write(self._row, 0, self._seq, style=STYLE_BODY) for i, arg in enumerate(args): self._sheet.write(self._row, i + 1, arg, style=STYLE_BODY) self._row_inc() self._seq_inc()
class DiskBusy: """Alert sheet""" def __init__(self, workbook): self._workbook = workbook self._name = '磁盘繁忙程度检查' self._sheet = FitSheetWrapper(self._workbook.add_sheet(self._name)) self._row = 0 self._seq = 1 self._length = 7 self._time = datetime.datetime.now() self._handle_head() def _row_inc(self): self._row += 1 def _seq_inc(self): self._seq += 1 def _handle_head(self): self._sheet.write_merge(self._row, self._row, 0, self._length - 1, '金税三期个人税收系统磁盘繁忙程度检查', style=STYLE_TITLE) self._row_inc() self._sheet.write(self._row, 0, '填表人') self._sheet.write(self._row, 2, '填表日期') self._sheet.write_merge(self._row, self._row, 3, self._length - 1, self._time.strftime('%Y-%m-%d %H:%M:%S')) self._row_inc() # write column name self._sheet.write(self._row, 0, '序号', style=STYLE_HEAD) self._sheet.write(self._row, 1, '主机IP', style=STYLE_HEAD) self._sheet.write(self._row, 2, '磁盘名', style=STYLE_HEAD) self._sheet.write(self._row, 3, 'Busy%', style=STYLE_HEAD) self._sheet.write(self._row, 4, 'tps', style=STYLE_HEAD) self._sheet.write(self._row, 5, 'rd_sec/s', style=STYLE_HEAD) self._sheet.write(self._row, 6, 'wr_sec/s', style=STYLE_HEAD) self._row_inc() def insert(self, *args): self._sheet.write(self._row, 0, self._seq, style=STYLE_BODY) for i, arg in enumerate(args): self._sheet.write(self._row, i + 1, arg, style=STYLE_BODY) self._row_inc() self._seq_inc()
class Memory: """Memory sheet""" def __init__(self, workbook): self._workbook = workbook self._name = '内存使用率检查' self._sheet = FitSheetWrapper(self._workbook.add_sheet(self._name)) self._row = 0 self._seq = 1 self._length = 11 self._time = datetime.datetime.now() self._handle_head() def _row_inc(self): self._row += 1 def _seq_inc(self): self._seq += 1 def _handle_head(self): self._sheet.write_merge(self._row, self._row, 0, self._length - 1, '金税三期个人税收系统主机内存使用情况', style=STYLE_TITLE) self._row_inc() self._sheet.write(self._row, 0, '填表人') self._sheet.write(self._row, 2, '填表日期') self._sheet.write_merge(self._row, self._row, 3, self._length - 1, self._time.strftime('%Y-%m-%d %H:%M:%S')) self._row_inc() # write column name self._sheet.write(self._row, 0, '序号', style=STYLE_HEAD) self._sheet.write(self._row, 1, '主机IP', style=STYLE_HEAD) self._sheet.write(self._row, 2, 'free', style=STYLE_HEAD) self._sheet.write(self._row, 3, 'used', style=STYLE_HEAD) self._sheet.write(self._row, 4, 'buff', style=STYLE_HEAD) self._sheet.write(self._row, 5, 'cache', style=STYLE_HEAD) self._sheet.write(self._row, 6, 'total', style=STYLE_HEAD) self._sheet.write(self._row, 7, '利用率', style=STYLE_HEAD) self._sheet.write(self._row, 8, 'swap_total', style=STYLE_HEAD) self._sheet.write(self._row, 9, 'swap_used', style=STYLE_HEAD) self._sheet.write(self._row, 10, 'swap_free', style=STYLE_HEAD) self._row_inc() def insert(self, *args): self._sheet.write(self._row, 0, self._seq, style=STYLE_BODY) for i, arg in enumerate(args): self._sheet.write(self._row, i+1, arg, style=STYLE_BODY) self._row_inc() self._seq_inc()
class Archive: """archive sheet""" def __init__(self, workbook): self._workbook = workbook self._name = '归档情况检查' self._sheet = FitSheetWrapper(self._workbook.add_sheet(self._name)) self._row = 0 self._seq = 1 self._length = 6 self._time = datetime.datetime.now() self._handle_head() def _row_inc(self): self._row += 1 def _seq_inc(self): self._seq += 1 def _handle_head(self): self._sheet.write_merge(self._row, self._row, 0, self._length - 1, '金税三期个人税收系统归档情况检查', style=STYLE_TITLE) self._row_inc() self._sheet.write(self._row, 0, '填表人') self._sheet.write(self._row, 2, '填表日期') self._sheet.write_merge(self._row, self._row, 3, self._length - 1, self._time.strftime('%Y-%m-%d %H:%M:%S')) self._row_inc() # write column name self._sheet.write(self._row, 0, '序号', style=STYLE_HEAD) self._sheet.write(self._row, 1, '数据库', style=STYLE_HEAD) self._sheet.write(self._row, 2, '是否归档', style=STYLE_HEAD) self._sheet.write(self._row, 3, '总空间', style=STYLE_HEAD) self._sheet.write(self._row, 4, '已经空间', style=STYLE_HEAD) self._sheet.write(self._row, 5, '剩余空间', style=STYLE_HEAD) self._row_inc() def insert(self, *args): self._sheet.write(self._row, 0, self._seq, style=STYLE_BODY) for i, arg in enumerate(args): self._sheet.write(self._row, i + 1, arg, style=STYLE_BODY) self._row_inc() self._seq_inc()
class CPU: """CPU sheet""" def __init__(self, workbook): self._workbook = workbook self._name = 'CPU使用率检查' self._sheet = FitSheetWrapper(self._workbook.add_sheet(self._name)) self._row = 0 self._seq = 1 self._length = 9 self._time = datetime.datetime.now() self._handle_head() def _row_inc(self): self._row += 1 def _seq_inc(self): self._seq += 1 def _handle_head(self): self._sheet.write_merge(self._row, self._row, 0, self._length - 1, '金税三期个人税收系统主机CPU使用率', style=STYLE_TITLE) self._row_inc() self._sheet.write(self._row, 0, '填表人') self._sheet.write(self._row, 2, '填表日期') self._sheet.write_merge(self._row, self._row, 3, self._length - 1, self._time.strftime('%Y-%m-%d %H:%M:%S')) self._row_inc() # write column name self._sheet.write(self._row, 0, '序号', style=STYLE_HEAD) self._sheet.write(self._row, 1, '主机IP', style=STYLE_HEAD) self._sheet.write(self._row, 2, 'load1', style=STYLE_HEAD) self._sheet.write(self._row, 3, 'load5', style=STYLE_HEAD) self._sheet.write(self._row, 4, 'load15', style=STYLE_HEAD) self._sheet.write(self._row, 5, 'User%', style=STYLE_HEAD) self._sheet.write(self._row, 6, 'Kern%', style=STYLE_HEAD) self._sheet.write(self._row, 7, 'Wait%', style=STYLE_HEAD) self._sheet.write(self._row, 8, 'Idle%', style=STYLE_HEAD) self._row_inc() def insert(self, *args): self._sheet.write(self._row, 0, self._seq, style=STYLE_BODY) for i, arg in enumerate(args): self._sheet.write(self._row, i+1, arg, style=STYLE_BODY) self._row_inc() self._seq_inc()
class OGG: """Alert sheet""" def __init__(self, workbook): self._workbook = workbook self._name = 'ogg运行状态检查' self._sheet = FitSheetWrapper(self._workbook.add_sheet(self._name)) self._row = 0 self._seq = 1 self._length = 8 self._time = datetime.datetime.now() self._handle_head() def _row_inc(self): self._row += 1 def _seq_inc(self): self._seq += 1 def _handle_head(self): self._sheet.write_merge(self._row, self._row, 0, self._length - 1, '金税三期个人税收系统ogg运行状态检查', style=STYLE_TITLE) self._row_inc() self._sheet.write(self._row, 0, '填表人') self._sheet.write(self._row, 2, '填表日期') self._sheet.write_merge(self._row, self._row, 3, self._length - 1, self._time.strftime('%Y-%m-%d %H:%M:%S')) self._row_inc() # write column name self._sheet.write(self._row, 0, '序号', style=STYLE_HEAD) self._sheet.write(self._row, 1, 'ip地址', style=STYLE_HEAD) self._sheet.write(self._row, 2, '进程类型', style=STYLE_HEAD) self._sheet.write(self._row, 3, '进程状态', style=STYLE_HEAD) self._sheet.write(self._row, 4, '进程名称', style=STYLE_HEAD) self._sheet.write(self._row, 5, 'Lag延时', style=STYLE_HEAD) self._sheet.write(self._row, 6, 'Time延时', style=STYLE_HEAD) self._sheet.write(self._row, 7, '异常时信息', style=STYLE_HEAD) self._row_inc() def insert(self, *args): self._sheet.write(self._row, 0, self._seq, style=STYLE_BODY) for i, arg in enumerate(args): self._sheet.write(self._row, i+1, arg, style=STYLE_BODY) self._row_inc() self._seq_inc()
class Tablespace: """tablespace sheet""" def __init__(self, workbook): self._workbook = workbook self._name = '表空间检查' self._sheet = FitSheetWrapper(self._workbook.add_sheet(self._name)) self._row = 0 self._seq = 1 self._length = 8 self._time = datetime.datetime.now() self._handle_head() def _row_inc(self): self._row += 1 def _seq_inc(self): self._seq += 1 def _handle_head(self): self._sheet.write_merge(self._row, self._row, 0, self._length - 1, '金税三期个人税收系统表空间检查', style=STYLE_TITLE) self._row_inc() self._sheet.write(self._row, 0, '填表人') self._sheet.write(self._row, 2, '填表日期') self._sheet.write_merge(self._row, self._row, 3, self._length - 1, self._time.strftime('%Y-%m-%d %H:%M:%S')) self._row_inc() # write column name self._sheet.write(self._row, 0, '序号', style=STYLE_HEAD) self._sheet.write(self._row, 1, '数据库', style=STYLE_HEAD) self._sheet.write(self._row, 2, '表空间名称', style=STYLE_HEAD) self._sheet.write(self._row, 3, '表空间大小', style=STYLE_HEAD) self._sheet.write(self._row, 4, '数据文件大小', style=STYLE_HEAD) self._sheet.write(self._row, 5, '已用空间', style=STYLE_HEAD) self._sheet.write(self._row, 6, '利用率', style=STYLE_HEAD) self._sheet.write(self._row, 7, '可用空间', style=STYLE_HEAD) self._row_inc() def insert(self, *args): self._sheet.write(self._row, 0, self._seq, style=STYLE_BODY) for i, arg in enumerate(args): self._sheet.write(self._row, i+1, arg, style=STYLE_BODY) self._row_inc() self._seq_inc()