File tree 4 files changed +95
-0
lines changed
4 files changed +95
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Amazon Simple Email Service Quota monitor
2
+ # Monitors the maximum number of emails you can send in a 24 hour period and actual sent emails.
3
+ # Created by Valery Vishnyakov
4
+ class AwsSesQuota < Scout ::Plugin
5
+ needs 'aws/ses'
6
+
7
+ OPTIONS = <<-EOS
8
+ awskey:
9
+ name: AWS Access Key
10
+ notes: Your Amazon Web Services Access key. 20-char alphanumeric, looks like 022QF06E7MXBSH9DHM02
11
+ awssecret:
12
+ name: AWS Secret
13
+ notes: Your Amazon Web Services Secret key. 40-char alphanumeric, looks like kWcrlUX5JEDGMLtmEENIaVmYvHNif5zBd9ct81S
14
+ EOS
15
+
16
+ def build_report
17
+ access_key_id = option ( 'awskey' )
18
+ secret_access_key = option ( 'awssecret' )
19
+
20
+ ses = AWS ::SES ::Base . new (
21
+ :access_key_id => access_key_id ,
22
+ :secret_access_key => secret_access_key
23
+ )
24
+
25
+ response = ses . quota
26
+
27
+ if ( response . sent_last_24_hours . to_i >= response . max_24_hour_send . to_i )
28
+ alert ( 'You have reached the maximum quota per 24 hours' ) unless memory ( :notified )
29
+ remember ( :notified => true )
30
+ else
31
+ remember ( :notified => false )
32
+ end
33
+
34
+ report :sent => response . sent_last_24_hours ,
35
+ :max => response . max_24_hour_send
36
+ end
37
+
38
+ end
Original file line number Diff line number Diff line change
1
+ metadata :
2
+ sent :
3
+ precision : 0
4
+ label : Sent Emails (w/n 24 hours)
5
+ max :
6
+ precision : 0
7
+ label : Sending quota
Original file line number Diff line number Diff line change
1
+ # Amazon Simple Email Service Statistics (http://aws.amazon.com/ses/)
2
+ # Displays Amazon SES automatically collected statistics regarding your sending activity:
3
+ # * Successful delivery attempts
4
+ # * Rejected messages
5
+ # * Bounces
6
+ # * Complaints
7
+
8
+ class AwsSesStatisticsPlugin < Scout ::Plugin
9
+ needs 'aws/ses'
10
+
11
+ OPTIONS = <<-EOS
12
+ awskey:
13
+ name: AWS Access Key
14
+ notes: Your Amazon Web Services Access key. 20-char alphanumeric, looks like 022QF06E7MXBSH9DHM02
15
+ awssecret:
16
+ name: AWS Secret
17
+ notes: Your Amazon Web Services Secret key. 40-char alphanumeric, looks like kWcrlUX5JEDGMLtmEENIaVmYvHNif5zBd9ct81S
18
+ EOS
19
+
20
+ def build_report
21
+ access_key_id = option ( 'awskey' )
22
+ secret_access_key = option ( 'awssecret' )
23
+
24
+ ses = AWS ::SES ::Base . new (
25
+ :access_key_id => access_key_id ,
26
+ :secret_access_key => secret_access_key
27
+ )
28
+
29
+ response = ses . statistics
30
+ data_point = response . data_points . sort_by { |r | Time . parse ( r [ 'Timestamp' ] ) } . last
31
+
32
+
33
+ report :bounces => data_point [ 'Bounces' ] ,
34
+ :deliveries => data_point [ 'DeliveryAttempts' ] ,
35
+ :rejects => data_point [ 'Rejects' ] ,
36
+ :complaints => data_point [ 'Complaints' ]
37
+ end
38
+
39
+ end
Original file line number Diff line number Diff line change
1
+ metadata :
2
+ complaints :
3
+ precision : 0
4
+ rejects :
5
+ precision : 0
6
+ label : Rejected messages
7
+ bounces :
8
+ precision : 0
9
+ deliveries :
10
+ precision : 0
11
+ label : Successful delivery attempts
You can’t perform that action at this time.
0 commit comments