Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
configuration
Commits
bc7ff24e
Commit
bc7ff24e
authored
Jun 26, 2017
by
Joseph Mulloy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add check-ses-limits python script
parent
fa0b9110
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
0 deletions
+59
-0
requirements3.txt
+3
-0
util/jenkins/check-ses-limits.py
+56
-0
No files found.
requirements3.txt
0 → 100644
View file @
bc7ff24e
# Needed for SES limits check job
boto3==1.4.4
awscli==1.11.58
util/jenkins/check-ses-limits.py
0 → 100755
View file @
bc7ff24e
#!/usr/bin/python3
# This script is used by the monioring/check-seslimits Jenkins job
import
boto3
import
argparse
import
sys
# Copied from https://stackoverflow.com/a/41153081
class
ExtendAction
(
argparse
.
Action
):
def
__call__
(
self
,
parser
,
namespace
,
values
,
option_string
=
None
):
items
=
getattr
(
namespace
,
self
.
dest
)
or
[]
items
.
extend
(
values
)
setattr
(
namespace
,
self
.
dest
,
items
)
if
__name__
==
"__main__"
:
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'-c'
,
'--critical'
,
required
=
True
,
type
=
float
,
help
=
"Critical threshold in percentage"
)
parser
.
add_argument
(
'-w'
,
'--warning'
,
required
=
False
,
type
=
float
,
help
=
"Warning threshold in percentage (Optional)"
)
parser
.
add_argument
(
'-r'
,
'--region'
,
dest
=
'regions'
,
nargs
=
'+'
,
action
=
ExtendAction
,
required
=
True
,
help
=
"AWS regions to check"
)
args
=
parser
.
parse_args
()
if
args
.
warning
and
args
.
warning
>=
args
.
critical
:
warn_str
=
"Warning threshold ({})"
.
format
(
args
.
warning
)
crit_str
=
"Critical threshold ({})"
.
format
(
args
.
critical
)
print
(
"ERROR: {} >= {}"
.
format
(
warn_str
,
crit_str
))
sys
.
exit
(
1
)
exit_code
=
0
session
=
boto3
.
session
.
Session
()
for
region
in
args
.
regions
:
ses
=
session
.
client
(
'ses'
,
region_name
=
region
)
data
=
ses
.
get_send_quota
()
limit
=
data
[
"Max24HourSend"
]
current
=
data
[
"SentLast24Hours"
]
percent
=
current
/
limit
level
=
None
if
percent
>=
args
.
critical
:
level
=
"CRITICAL"
elif
args
.
warning
and
percent
>=
args
.
warning
:
level
=
"WARNING"
if
level
:
print
(
"{} {}/{} ({}
%
) - {}"
.
format
(
region
,
current
,
limit
,
percent
,
level
))
exit_code
+=
1
sys
.
exit
(
exit_code
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment