-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcheck-size
49 lines (35 loc) · 1.9 KB
/
check-size
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
#!/bin/python
import argparse
from alert.size import run_checks
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='EFS Metered Size Alert System',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--efs-name', type=str, required=True,
help='Name of EFS file system to check')
parser.add_argument('--max-size', type=int, required=True,
help='Max allowed size of file system')
parser.add_argument('--from-email', type=str, required=True,
help='Email address from which to send emails')
parser.add_argument('--to-email', type=str, required=True,
help='Email address to send emails to')
parser.add_argument('--efs-dir', type=str, default=None,
help='Local directory where EFS is mounted')
parser.add_argument('--max-user-size', type=int, default=None,
help=('Maximum allowed size of a directory, in Bytes. '
'If None, reverts to MAX_SIZE'))
parser.add_argument('---user-dir-depth', '-d', type=int, default=1,
help='Directories at this depth from `EFS-Directory` will be checked')
parser.add_argument('--email-users', action='store_true', default=False,
help='If True, emails users about storage limits')
parser.add_argument('--dry-run', action='store_true', default=False,
help='If True, emails will not be sent, but results printed to screen')
args = parser.parse_args()
run_checks(args.efs_name,
args.max_size,
args.from_email,
args.to_email,
args.efs_dir,
args.user_dir_depth,
args.max_user_size,
args.email_users,
args.dry_run)