def main():

    args = parseArguments()

    # read the config file
    config = ConfigParser.RawConfigParser()
    try:
        # insert a section header into the config so
        # ConfigParser will read it without complaint
        with open(args.config, "r") as config_file:
            ini_str = '[root]\n' + config_file.read()
            ini_fp = StringIO.StringIO(ini_str)
            config.readfp(ini_fp)
    except __HOLE__:
        print "Error opening file " + args.file
        return


    try:
        region = config.get('root', 'region')
        access_id = config.get('root', 'aws_access_key_id')
        secret_key = config.get('root', 'aws_secret_access_key')
    except ConfigParser.NoOptionError as e:
        print e
        return

    # AWS CloudWatch connection
    cloudwatch_conn = boto.ec2.cloudwatch.connect_to_region(region,
                 aws_access_key_id=access_id,
                 aws_secret_access_key=secret_key)


    #metrics = cloudwatch_conn.list_metrics()
    metrics = cloudwatch_conn.list_metrics(namespace='AWS/' + args.service)
    for m in metrics:
         print m.name, m.namespace, m.dimensions
dataset/ETHPy150Open prelert/engine-python/cloudwatch/listMetrics.py/main