# Path: collectors/lib/utils.py
# PY3 = sys.version_info[0] > 2
# USER = "nobody"
# def drop_privileges(user=USER):
# def is_sockfile(path):
# def err(msg):
#     def is_numeric(value):
#     def is_numeric(value):
# 
# Path: collectors/etc/aws_cloudwatch_conf.py
# def enabled():
# def get_validate_env_var(var, default):
# def get_accesskey_secretkey():
# def get_aws_profile():


import os
import sys
import time
import datetime
import re
import json
import threading
    import boto3
from collections import OrderedDict
from time import mktime
from collectors.lib import utils
from collectors.etc import aws_cloudwatch_conf
    from botocore.exceptions import ClientError
    from queue import Queue
    from Queue import Queue
    # noinspection PyCompatibility
except ImportError:
    # noinspection PyUnresolvedReferences

ILLEGAL_CHARS_REGEX = re.compile('[^a-zA-Z0-9\- _./]')

path = os.path.dirname(os.path.realpath(__file__))
COLLECTION_INTERVAL = int(path.split('/')[-1])

if COLLECTION_INTERVAL == 0:
    utils.err("AWS Cloudwatch Stats is not a long running collector\n")
    sys.exit(13)

if COLLECTION_INTERVAL < 60:
    utils.err("AWS Cloudwatch Stats is an heavy collector and should not be run more than once per minute.\n")
    sys.exit(13)

STATISTICS = frozenset([
    'Minimum',
    'Maximum',
    'Average',
    'Sum',
    'SampleCount'
])

sendQueue = Queue()


def validate_config():
    aws_profile = aws_cloudwatch_conf.get_aws_profile()

# Path: collectors/lib/utils.py
# PY3 = sys.version_info[0] > 2
# USER = "nobody"
# def drop_privileges(user=USER):
# def is_sockfile(path):
# def err(msg):
#     def is_numeric(value):
#     def is_numeric(value):
# 
# Path: collectors/etc/aws_cloudwatch_conf.py
# def enabled():
# def get_validate_env_var(var, default):
# def get_accesskey_secretkey():
# def get_aws_profile():


# Path: collectors/300/aws_cloudwatch_stats.py
import os
import sys
import time
import datetime
import re
import json
import threading
    import boto3
from collections import OrderedDict
from time import mktime
from collectors.lib import utils
from collectors.etc import aws_cloudwatch_conf
    from botocore.exceptions import ClientError
    from queue import Queue
    from Queue import Queue

    # noinspection PyCompatibility
except ImportError:
    # noinspection PyUnresolvedReferences

ILLEGAL_CHARS_REGEX = re.compile('[^a-zA-Z0-9\- _./]')

path = os.path.dirname(os.path.realpath(__file__))
COLLECTION_INTERVAL = int(path.split('/')[-1])

if COLLECTION_INTERVAL == 0:
    utils.err("AWS Cloudwatch Stats is not a long running collector\n")
    sys.exit(13)

if COLLECTION_INTERVAL < 60:
    utils.err("AWS Cloudwatch Stats is an heavy collector and should not be run more than once per minute.\n")
    sys.exit(13)

STATISTICS = frozenset([
    'Minimum',
    'Maximum',
    'Average',
    'Sum',
    'SampleCount'
])

sendQueue = Queue()


def validate_config():
    aws_profile = aws_cloudwatch_conf.get_aws_profile()

    access_key, secret_access_key = aws_cloudwatch_conf.get_accesskey_secretkey()