File tree Expand file tree Collapse file tree 1 file changed +13
-12
lines changed
Expand file tree Collapse file tree 1 file changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -93,19 +93,20 @@ def get_aws_waf_stats(start_dt, end_dt):
9393 client = boto3 .client ('cloudwatch' , region_name = AWS_REGION )
9494
9595 def get_metric (metric_name ):
96+ response = client .get_metric_statistics (
97+ Namespace = 'AWS/WAFV2' ,
98+ MetricName = metric_name ,
99+ Dimensions = [
100+ {'Name' : 'WebACL' , 'Value' : WAF_WEB_ACL_NAME },
101+ {'Name' : 'Rule' , 'Value' : 'ALL' },
102+ {'Name' : 'Region' , 'Value' : AWS_REGION },
103+ ],
104+ StartTime = start_dt ,
105+ EndTime = end_dt ,
106+ Period = 86400 ,
107+ Statistics = ['Sum' ]
108+ )
96109 try :
97- response = client .get_metric_statistics (
98- Namespace = 'AWS/WAFV2' ,
99- MetricName = metric_name ,
100- Dimensions = [
101- {'Name' : 'WebACL' , 'Value' : WAF_WEB_ACL_NAME },
102- {'Name' : 'Region' , 'Value' : AWS_REGION },
103- ],
104- StartTime = start_dt ,
105- EndTime = end_dt ,
106- Period = 86400 ,
107- Statistics = ['Sum' ]
108- )
109110 if response ['Datapoints' ]:
110111 return int (sum ([dp ['Sum' ] for dp in response ['Datapoints' ]]))
111112
You can’t perform that action at this time.
0 commit comments