-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsizingpipelines.py
119 lines (114 loc) · 2.83 KB
/
sizingpipelines.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
110
111
112
113
114
115
116
pipeline = [
{
'$match': {
'collections': {
'$exists': 1
}
}
}, {
'$group': {
'_id': '$sourcefile',
'data_size_without_compression_GB': {
'$sum': {
'$divide': [
'$dataSize', 1073741824
]
}
},
'index_size_GB': {
'$sum': {
'$divide': [
'$indexSize', 1073741824
]
}
},
'index_size_GB': {
'$sum': {
'$divide': [
'$indexSize', 1073741824
]
}
},
'storage_size_compressed_GB': {
'$sum': {
'$divide': [
'$storageSize', 1073741824
]
}
},
'total_objects': {
'$sum': '$objects'
},
'total_objects_in_Millions': {
'$sum': {
'$divide': [
'$objects', 1000000
]
}
},
'total_indices': {
'$sum': '$indexes'
},
'total_collections': {
'$sum': '$collections'
},
'databases': {
'$push': {
'database': '$db',
'collections': '$collections',
'numIndices': '$indexes'
}
}
}
}
]
status_pipeline = [{
"$project": {
"network_Out_GB":{
'$divide': [
"$network.bytesOut",
1073741824
]
},
"network_In_GB":{
'$divide': [
"$network.bytesIn",
1073741824
]
},
"uptime_Days":{
"$divide": [
"$uptime", 86400
]
},
"uptime_Years":{
"$divide": [
"$uptime", 31536000
]
},
"query_stats_In_Millions": {
"inserts" : {
"$divide":["$opcounters.insert",1000000]
},
"query" : {
"$divide":["$opcounters.query",1000000]
},
"getmore" : {
"$divide":["$opcounters.getmore",1000000]
},
"command" : {
"$divide":["$opcounters.command",1000000]
},
"delete" : {
"$divide":["$opcounters.delete",1000000]
}
},
"query_stats_raw": {
"inserts" : "$opcounters.insert",
"query" : "$opcounters.query",
"getmore" : "$opcounters.getmore",
"command" : "$opcounters.command",
"delete" : "$opcounters.delete",
},
"replicationStats":"$replicationStats"
}}]