def create_request(path): id = dl_lib.get_container_id(path) details = { 'mac': host_mac, 'hostname': "{} ({})".format(dl_lib.container_real_host_name(), host_name), 'os_name': 'docker', 'os_version': '', 'processes': dl_lib.get_processes(id), 'container': '001', 'interfaces': dl_lib.get_network(id), 'mode': 'SOLO', 'name': "{} ({})".format(dl_lib.get_container_name(id), id) } finger = dl_lib.hash_id(path) url = "%s/agents/%s/ping" % (api_host, finger,) return grequests.post(url, json=details, headers=headers)
def container_host_name(): try: return [dl_lib.container_real_host_name()] except Exception as E: logger.error("failed to get container hostname: %s" % E) return []
def container_host_name(): return [dl_lib.container_real_host_name()]