|
Helper |
Joined: Thu Apr 15, 2010 12:28 am Posts: 83
|
[quote="Mark"][quote="jonbendtsen"]Peculiar choice of IPv4 address listed, it picks the virtual VMware Network Adapter VMnet1 and not the real Ethernet adapter Local Area Connection:?]
From memory it simply chooses the adapter with the lowest numerical IP Address. I'm open to a better way to do this though - feel free to suggest a way I am thinking that it can be specified when you run the audit.vbs script? Or chosen for each machine. Or maybe if you specify which networks has higher priority than others. Or maybe order by which "Local Area Connection" has the lowest hardware ID?
I my case for this vmware server that runs ontop of windows I have 3, but only one with an IP, it should pick that one rather than vmware adapters. [code]Ethernet adapter Local Area Connection: Ethernet adapter Local Area Connection 2: Ethernet adapter Local Area Connection 3: [/code]
For a vmware guest it says: [code]Ethernet adapter Local Area Connection 2:[/code]
[quote="Mark"]The function to do this lives in the m_ip_address.php model.
[code] function set_initial_address($details) { $start=explode(' ',microtime()); $sql = "SELECT sys_hw_network_card_ip.ip_address_v4, sys_hw_network_card_ip.ip_subnet FROM sys_hw_network_card_ip, sys_hw_network_card WHERE sys_hw_network_card_ip.net_mac_address = sys_hw_network_card.net_mac_address AND sys_hw_network_card.system_id = ? AND (sys_hw_network_card_ip.timestamp = ? OR sys_hw_network_card_ip.timestamp = ?) ORDER BY sys_hw_network_card_ip.ip_address_v4 DESC LIMIT 1"; $data = array("$details->system_id", "$details->original_timestamp", "$details->timestamp"); $query = $this->db->query($sql, $data); $end = explode(' ',microtime()); $this->firephp_export_sql($start, $end, __FUNCTION__ , $query->num_rows(), $this->db->last_query()); foreach ($query->result() as $myrow) { $this->m_system->update_system_man($details->system_id, 'man_ip_address', $myrow->ip_address_v4); } }[/code] This MySQL select statement will not select virtual vmware ethernet adapters. It just has to be inserted into your select statement somehow without damaging the rest of the code. [code]select net_description from sys_hw_network_card where net_description NOT LIKE 'VMware Virtual Ethernet Adapter for VMnet%'; [/code]
I inserted it, but it does still list the server by the wrong IP address. Do I need to delete the server? Do I need to run the audit.vbs script again? [code] function set_initial_address($details) { $start=explode(' ',microtime()); $sql = "SELECT sys_hw_network_card_ip.ip_address_v4, sys_hw_network_card_ip.ip_subnet FROM sys_hw_network_card_ip, sys_hw_network_card WHERE sys_gw_network_card.net_description NOT LIKE 'VMware Virtual Ethernet Adapter for VMnet%' AND sys_hw_network_card_ip.net_mac_address = sys_hw_network_card.net_mac_address AND sys_hw_network_card.system_id = ? AND (sys_hw_network_card_ip.timestamp = ? OR sys_hw_network_card_ip.timestamp = ?) ORDER BY sys_hw_network_card_ip.ip_address_v4 DESC LIMIT 1"; $data = array("$details->system_id", "$details->original_timestamp", "$details->timestamp"); $query = $this->db->query($sql, $data); $end = explode(' ',microtime()); $this->firephp_export_sql($start, $end, __FUNCTION__ , $query->num_rows(), $this->db->last_query()); foreach ($query->result() as $myrow) { $this->m_system->update_system_man($details->system_id, 'man_ip_address', $myrow->ip_address_ v4); } } [/code]
|
|