if __name__ == '__main__':
    # Parse command line options
    from optparse import OptionParser
    parser = OptionParser()
    parser.add_option("-c", "--config", dest="config_file", help="Configuration file with local settings")
    (options, args) = parser.parse_args()

    # Open up the configuration file and read for later use
    from ConfigParser import ConfigParser
    config = ConfigParser()
    config.read(options.config_file)

    # Setup logging
    logging.basicConfig()
    Checker.createLogger(config, ["checker"])

    # Setup and run the server
    sqlhub.processConnection = connectionForURI(config.get("Checker", "db")) 
    immediate_checker.updateConfig(config)
    
    try: port = config.getint('Checker', 'immediate_check_server_port')
    except: port = 9090
    run(host='0.0.0.0', port=port, reloader=False, debug=False)    

    """checker = ImmediateChecker(config)

    print checker.check('service', 
                        schedule = { "monitor_point_id" : 1, "fqdn": "google.com", "ip_address": None, "port": 80, "service_type": "tcp.http.fullpage" },
                        metadata = { "http_match_type": "present_exact", "http_match_string": "Gmail2", "http_request_type": "GET" })