Puts a list of hosts into local instance of nagios checkresults
    Arguments:
      hosts               -- list of dicts, like one obtained from get_checkresults
      services            -- list of dicts, like one obtained from get_checkresults
      check_existance     -- If True, check (and log) if objects already exist before posting
      create_services -- If True, autocreate non-existing services (where the host already exists)
      create_hosts    -- If True, autocreate non-existing hosts

def post(hosts=None, services=None, check_existance=True, create_services=True, create_hosts=False):
    """ Puts a list of hosts into local instance of nagios checkresults
    Arguments:
      hosts               -- list of dicts, like one obtained from get_checkresults
      services            -- list of dicts, like one obtained from get_checkresults
      check_existance     -- If True, check (and log) if objects already exist before posting
      create_services -- If True, autocreate non-existing services (where the host already exists)
      create_hosts    -- If True, autocreate non-existing hosts
    """

    nagios_config = config()
    nagios_config.parse_maincfg()
    check_result_path = nagios_config.get_cfg_value("check_result_path")


    fd, filename = tempfile.mkstemp(prefix='c', dir=check_result_path)
    if not hosts:
        hosts = []
    if not services:
        services = []

    if check_existance:
        checkresults_overhaul(hosts, services, create_services=create_services, create_hosts=create_hosts)
    checkresults = '### Active Check Result File Made by Nago ###\n'
    checkresults += 'file_time=%s' % (int(time.time()))
    checkresults = ''

    for host in hosts:
        checkresults += _format_checkresult(**host)
    for service in services:
        checkresults += _format_checkresult(**service)
    os.write(fd, checkresults)

    # Cleanup and make sure our file is readable by nagios
    os.close(fd)
    os.chmod(filename, 0644)

    # Create an ok file, so nagios knows it's ok to reap our changes
    file('%s.ok' % filename, 'w')