def main():

    # create a sysv ipc (message queue).
    mq = sysv_ipc.MessageQueue(KEY, max_message_size=MAX_MSG_SIZE)
    
    nagios_queue = Queue()
    instances_queue = Queue()
    
    
    # get message for nagios from sysv ipc message queue.
    queue_ipc = get_msg_from_sysv_mq(mq,nagios_queue)
    queue_ipc.start()
    
    
    for i in range(200):
        tp = post_notification_to_http(nagios_queue)
        tp.start()
    
    
    #######################################
    # check nova instances and update all status to db
    tc = check_nova_instances(instances_queue)
    tc.start()
    
    thread_list = []
    for i in range(200):
        tu = update_instances_to_db(instances_queue)
        thread_list.append(tu)
    for j in thread_list:
        j.start()
    
    #######################################
    
    
    # periodic check instances from nova, make sure they are exists. 
    ti = check_nova_instance_if_enable()
    ti.start()
    
    
    # get moniting and notification config for instances
    tg = get_nova_instances_config()
    tg.start()
    
    
    # run network and system check for instances.(get config from instances.dat)
    run_network_and_system_check()
    
    #notify nagios for rrdfile
    do_notify()
def main():

    # create a sysv ipc (message queue).
    mq = sysv_ipc.MessageQueue(KEY, max_message_size=MAX_MSG_SIZE)
    
    nagios_queue = Queue()
    instances_queue = Queue()
    
    
    # get message for nagios from sysv ipc message queue.
    queue_ipc = get_msg_from_sysv_mq(mq,nagios_queue)
    queue_ipc.start()
    
    
    # update notification from nagios to http server.
    http_q = list()
    for i in range(2):
        http_q.append(process_start_post_notification_to_http(nagios_queue))
    for j in http_q:
        j.start()
    
    
    #######################################
    # check nova instances and update all status to db
    tc = check_nova_instances(instances_queue)
    tc.start()
    
    tu = process_start_update_instances_to_db(instances_queue)
    tu.start()
    #######################################
    
    
    # periodic check instances from nova, make sure they are exists. 
    ti = check_nova_instance_if_enable()
    ti.start()
    
    
    # get moniting and notification config for instances
    tg = get_nova_instances_moniting_and_notification_config()
    tg.start()
    
    
    # run network and system check for instances.(get config from instances.dat)
    run_network_and_system_check()