[racktables-users] Extract Hostname and IP

  • From: itsme2501@xxxxxxxxxxx
  • To: racktables-users@xxxxxxxxxxxxx
  • Date: Thu, 26 Mar 2015 17:35:05 +0100 (CET)

Hi all ! 

I am trying to extract the hostname and the ip of each objects of my 
RackTables, i found this usefull script on the wiki : 

<?php 
$script_mode = TRUE; 
require 'wwwroot/inc/init.php'; 
foreach (scanRealmByText ('object', '{server}') as $object) 
{ 
amplifyCell ($object); 
foreach ($object['ipv4'] + $object['ipv6'] as $ip_bin => $alloc) 
echo implode ("\t", [ $object['name'], $alloc['osif'], ip_format ($ip_bin) ]) . 
"\n"; 
} 

But it will extract only server objects, i am trying to edit it to extract 
everything without testing the name, i want servers, routers, switch, i dont't 
care about the name. 

I know it is a really basic questions but i am not able to edit it properlly to 
match everything. 

Thank you 

Other related posts: