forked from oceanbase/obdiag
-
Notifications
You must be signed in to change notification settings - Fork 0
/
obdiag_main.py
109 lines (87 loc) · 3.07 KB
/
obdiag_main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/usr/bin/env python
# -*- coding: UTF-8 -*
# Copyright (c) 2022 OceanBase
# OceanBase Diagnostic Tool is licensed under Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
# http://license.coscl.org.cn/MulanPSL2
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
"""
@file: obdiag_main.py
@desc:
"""
from common.logger import logger
from obdiag_client import OBDIAGClient
from utils.parser_utils import ArgParser
CONFIG_PARSE_IGNORE_ATTR = ["start_date", "end_date"]
DEFAULT_SINCE_HOURS = 12
def pharse_config(args):
try:
if args.config:
args.config(args)
except AttributeError:
logger.info("object has no attribute 'config' pass quick config\n")
def gather_log(args):
try:
if args.gather_log:
args.gather_log(args)
except AttributeError:
logger.info("object has no attribute 'gather_log' pass gather log\n")
def gather_awr(args):
try:
if args.gather_awr:
args.gather_awr(args)
except AttributeError:
logger.info("object has no attribute 'gather_awr' pass gather awr\n")
def gather_sysstat(args):
try:
if args.gather_sysstat:
args.gather_sysstat(args)
except AttributeError:
logger.info("object has no attribute 'gather_sysstat' pass gather sysstat info\n")
def gather_perf(args):
try:
if args.gather_perf:
args.gather_perf(args)
except AttributeError:
logger.info("object has no attribute 'gather_perf' pass gather perf info\n")
def gather_plan_monitor(args):
try:
if args.gather_plan_monitor:
args.gather_plan_monitor(args)
except AttributeError:
logger.info("object has no attribute 'gather_plan_monitor' pass gather ob sql plan monitor\n")
def gather_clog(args):
try:
if args.gather_clog:
args.gather_clog(args)
except AttributeError:
logger.info("object has no attribute 'gather_clog' pass gather clog\n")
def gather_slog(args):
try:
if args.gather_slog:
args.gather_slog(args)
except AttributeError:
logger.info("object has no attribute 'gather_slog' pass gather slog\n")
def gather_obproxy_log(args):
try:
if args.gather_obproxy_log:
args.gather_obproxy_log(args)
except AttributeError:
logger.info("object has no attribute 'gather_obproxy_log' pass gather obproxy log\n")
if __name__ == '__main__':
obdiag = OBDIAGClient().init()
arg_parser = ArgParser(obdiag)
obdiag_args = arg_parser.parse_argv()
pharse_config(obdiag_args)
gather_log(obdiag_args)
gather_awr(obdiag_args)
gather_sysstat(obdiag_args)
gather_perf(obdiag_args)
gather_plan_monitor(obdiag_args)
gather_clog(obdiag_args)
gather_slog(obdiag_args)
gather_obproxy_log(obdiag_args)