def status_perf_data_main():
	try:
		configs = parse_config_obj()
		for section, options in configs.items():
			site = options.get('site')
			query = "GET hosts\nColumns: host_name\nOutputFormat: json\n"
			output = json.loads(rrd_main.get_from_socket(site,query))
			status_perf_data(site,output)
	except SyntaxError, e:
		raise MKGeneralException(("Can not get performance data: %s") % (e))
		log_split = [log_split for log_split in log_attr.split(';')]
		if log_split[0] == "CURRENT SERVICE STATE":
			service_perf_data_live_query(db,site,log_split)
		elif log_split[0] == "SERVICE ALERT" or log_split[0] == "INITIAL SERVICE STATE":
			service_perf_data_live_query(db,site,log_split)
		elif log_split[0] == "SERVICE FLAPPING ALERT":
			service_perf_data_live_query(db,site,log_split)

	query = "GET log\nColumns: log_type log_time log_state_type log_state  host_name service_description "\
		"options host_address current_host_perf_data\nFilter: log_time > %s\nFilter: class = 0\n"\
		"Filter: class = 1\nFilter: class = 2\nFilter: class = 3\nFilter: class = 4\nFilter: class = 6\nOr: 6\n" %(start_epoch) 
	output= rrd_main.get_from_socket(site, query)

	for log_attr in output.split('\n'):
		log_split = [log_split for log_split in log_attr.split(';')]
		if log_split[0] == "CURRENT HOST STATE":
			network_perf_data_live_query(db,site,log_split)	
		elif log_split[0] == "HOST ALERT" or log_split[0] == "INITIAL HOST STATE":
			network_perf_data_live_query(db,site,log_split)	
		elif log_split[0] == "HOST FLAPPING ALERT":
			network_perf_data_live_query(db,site,log_split)	
		
if __name__ == '__main__':
    configs = parse_config_obj()
    for section, options in configs.items():
	extract_nagios_events_live(
			mongo_host=options.get('host'),
			mongo_db=options.get('nosql_db'),
			mongo_port=int(options.get('port'))
	)
def main():
    configs = parse_config_obj()
    for section, options in configs.items():

        network_script = options.get('network').get('script')
        network_migration_script = __import__(network_script)
        network_migration_script.main(
            site=options.get('site'),
            host=options.get('host'),
            user=options.get('user'),
            port=options.get('port'),
            sql_passwd=options.get('sql_passwd'),
            nosql_db=options.get('network').get('nosql_db'),
            sql_db=options.get('network').get('sql_db'),
            table_name=options.get('network').get('table_name'),
            ip=options.get('ip'))

        service_script = options.get('service').get('script')
        service_migration_script = __import__(service_script)
        service_migration_script.main(
            site=options.get('site'),
            host=options.get('host'),
            user=options.get('user'),
            port=options.get('port'),
            sql_passwd=options.get('sql_passwd'),
            nosql_db=options.get('service').get('nosql_db'),
            sql_db=options.get('service').get('sql_db'),
            table_name=options.get('service').get('table_name'),
            ip=options.get('ip'))

        network_event_script = options.get('network_event').get('script')
        network_event_migration_script = __import__(network_event_script)
        network_event_migration_script.main(
            site=options.get('site'),
            host=options.get('host'),
            user=options.get('user'),
            port=options.get('port'),
            sql_passwd=options.get('sql_passwd'),
            nosql_db=options.get('network_event').get('nosql_db'),
            sql_db=options.get('network_event').get('sql_db'),
            table_name=options.get('network_event').get('table_name'),
            ip=options.get('ip'))

        service_event_script = options.get('service_event').get('script')
        service_event_migration_script = __import__(service_event_script)
        service_event_migration_script.main(
            site=options.get('site'),
            host=options.get('host'),
            user=options.get('user'),
            port=options.get('port'),
            sql_passwd=options.get('sql_passwd'),
            nosql_db=options.get('service_event').get('nosql_db'),
            sql_db=options.get('service_event').get('sql_db'),
            table_name=options.get('service_event').get('table_name'),
            ip=options.get('ip'))
        status_script = options.get('status').get('script')
        status_service_migration_script = __import__(status_script)
        status_service_migration_script.main(
            site=options.get('site'),
            host=options.get('host'),
            user=options.get('user'),
            port=options.get('port'),
            sql_passwd=options.get('sql_passwd'),
            nosql_db=options.get('status').get('nosql_db'),
            sql_db=options.get('status').get('sql_db'),
            table_name=options.get('status').get('table_name'),
            ip=options.get('ip'))
        inventory_script = options.get('inventory').get('script')
        inventory_service_migration_script = __import__(inventory_script)
        inventory_service_migration_script.main(
            site=options.get('site'),
            host=options.get('host'),
            user=options.get('user'),
            port=options.get('port'),
            sql_passwd=options.get('sql_passwd'),
            nosql_db=options.get('inventory').get('nosql_db'),
            sql_db=options.get('inventory').get('sql_db'),
            table_name=options.get('inventory').get('table_name'),
            ip=options.get('ip'))