forked from pranavprakash20/Ceph-Trace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathceph_trace.py
37 lines (31 loc) · 992 Bytes
/
ceph_trace.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
from trace.tracer import Tracer
import docopt
import yaml
# Set doc description
doc = """
This script fetches all the options require for ceph trace
Usage:
ceph_trace.py (--conf <conf>)
[--reporting <reporting>]
[--end-trace <end-tace>]
ceph_trace.py --help
Options:
-h --help Shows the command usage.
-c --conf <str> ceph trace config file
-r --reporting <str> Reporting type [csv | db]
-e --end-trace End trace
"""
if __name__ == "__main__":
# Get args with docopt
args = docopt.docopt(doc)
# Get parameters from args
conf = args.get("--conf").lower()
# Load conf file
conf_data = yaml.safe_load(open(conf, "r"))
end_trace = args.get("--end-trace")
if end_trace:
Tracer(conf_data).stop()
else:
reporting_type = args.get("--reporting").lower()
# Run ceph trace
Tracer(conf_data, reporting_type).start()