-
Notifications
You must be signed in to change notification settings - Fork 61
/
ks3monitor.py
60 lines (54 loc) · 4.35 KB
/
ks3monitor.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
# -*- encoding:utf-8 -*-
from kscore.session import get_session
import json
if __name__ == "__main__":
s = get_session()
# 不同Region的bucket需要设置对应的参数去查询
# 北京region cn-beijing-6
# 上海region cn-shanghai-2
# 杭州region cn-shanghai-2
# 香港region cn-hongkong-2
# 俄罗斯region eu-east-1
#GetMetricStatistics
client = s.create_client("monitor", "cn-beijing-6", use_ssl=True)
#获取一天的标准存储量总量
m=client.get_metric_statistics(InstanceID="test-wn",Namespace="KS3",MetricName="ks3.bucket.capacity.total.sd",StartTime="2018-07-03T00:00:05Z",EndTime="2018-07-04T00:00:05Z",Period="86400",Aggregate="Max")
print json.dumps(m,sort_keys=True,indent=4)
'''
#获取一天的标准存储量增量
m=client.get_metric_statistics(InstanceID="test-wn",Namespace="ks3",MetricName="ks3.bucket.capacity.add.sd",StartTime="2018-03-18T00:00:00Z",EndTime="2018-03-19T00:00:00Z",Period="86400",Aggregate="Max")
print json.dumps(m,sort_keys=True,indent=4)
# 获取一天的标准存储量删除量
m = client.get_metric_statistics(InstanceID="test-wn", Namespace="ks3", MetricName="ks3.bucket.capacity.del.sd",StartTime="2018-03-18T00:00:00Z",EndTime="2018-03-19T00:00:00Z", Period="86400",Aggregate="Max")
print json.dumps(m, sort_keys=True, indent=4)
# 获取一天的低频存储量总量
m = client.get_metric_statistics(InstanceID="test-wn", Namespace="ks3", MetricName="ks3.bucket.capacity.total.ia",StartTime="2018-03-18T00:00:00Z",EndTime="2018-03-19T00:00:00Z", Period="86400",Aggregate="Max")
print json.dumps(m, sort_keys=True, indent=4)
# 获取一天的低频存储量增量
m = client.get_metric_statistics(InstanceID="test-wn", Namespace="ks3", MetricName="ks3.bucket.capacity.add.ia",StartTime="2018-03-18T00:00:00Z",EndTime="2018-03-19T00:00:00Z", Period="86400",Aggregate="Max")
print json.dumps(m, sort_keys=True, indent=4)
# 获取一天的低频存储量增量
m = client.get_metric_statistics(InstanceID="test-wn", Namespace="ks3", MetricName="ks3.bucket.capacity.del.ia",StartTime="2018-03-18T00:00:00Z", EndTime="2018-03-19T00:00:00Z", Period="86400",Aggregate="Max")
print json.dumps(m, sort_keys=True, indent=4)
# 获取一天的标准存储的下载流量
m = client.get_metric_statistics(InstanceID="test-wn", Namespace="ks3", MetricName="ks3.bucket.flow.down.sd",StartTime="2018-03-18T00:00:00Z", EndTime="2018-03-19T00:00:00Z", Period="86400",Aggregate="Max")
print json.dumps(m, sort_keys=True, indent=4)
# 获取一天的低频存储的下载流量
m = client.get_metric_statistics(InstanceID="test-wn", Namespace="ks3", MetricName="ks3.bucket.flow.down.ia",StartTime="2018-03-18T00:00:00Z", EndTime="2018-03-19T00:00:00Z", Period="86400",Aggregate="Max")
print json.dumps(m, sort_keys=True, indent=4)
# 获取一天的标准存储的get请求数
m = client.get_metric_statistics(InstanceID="test-wn", Namespace="ks3", MetricName="ks3.bucket.getcount.sd",StartTime="2018-03-18T00:00:00Z", EndTime="2018-03-19T00:00:00Z", Period="86400",Aggregate="Max")
print json.dumps(m, sort_keys=True, indent=4)
# 获取一天的标准存储的put请求数
m = client.get_metric_statistics(InstanceID="test-wn", Namespace="ks3", MetricName="ks3.bucket.putcount.sd",StartTime="2018-03-18T00:00:00Z", EndTime="2018-03-19T00:00:00Z", Period="86400",Aggregate="Max")
print json.dumps(m, sort_keys=True, indent=4)
# 获取一天的低频存储的get请求数
m = client.get_metric_statistics(InstanceID="test-wn", Namespace="ks3", MetricName="ks3.bucket.getcount.ia",StartTime="2018-03-18T00:00:00Z", EndTime="2018-03-19T00:00:00Z", Period="86400",Aggregate="Max")
print json.dumps(m, sort_keys=True, indent=4)
# 获取一天的低频存储的put请求数
m = client.get_metric_statistics(InstanceID="test-wn", Namespace="ks3", MetricName="ks3.bucket.putcount.ia",StartTime="2018-03-18T00:00:00Z", EndTime="2018-03-19T00:00:00Z", Period="86400",Aggregate="Max")
print json.dumps(m, sort_keys=True, indent=4)
# 获取一天的低频存储的数据取回量
m = client.get_metric_statistics(InstanceID="test-wn", Namespace="ks3", MetricName="ks3.bucket.putcount.ia",StartTime="2018-03-18T00:00:00Z", EndTime="2018-03-19T00:00:00Z", Period="86400",Aggregate="Max")
print json.dumps(m, sort_keys=True, indent=4)
'''