Menu

#42 CLI for "Import IP addresses to subnet from XLS / CSV"

open
5
2015-07-02
2012-02-23
Anonymous
No

Hello,

First of all thank you for sharing this app.
I looked through the existing feature requests but could not find a similar one (Maybe the REST API thread).

Would you consider adding a CLI interface to the "Import IP addresses to subnet from XLS / CSV file" feature?

The idea behind this would be to update the database every X hours/days with DHCP Lease from the relevant DHCP servers.
This would allow to monitor DHCP Pools usage. A script (written by the user for each type of DHCP server) would extract the current
DHCP Leases and format it to the PHPIPAM CSV format and then inject the update in the database.

As far as I understand you load the CSV File using function loadCSVImport() defined in magis.js and then I am not sure where it is sent.
importCSVline() defined in functions.php seems to parse the file and inject the entries after.
I never took time to learn php or js :) .

Thanks and Regards,
Yann

Discussion

  • Miha Petkovsek

    Miha Petkovsek - 2012-02-27

    Hi, why put it to CSV? Simply update the appropriate subnet in database with active DHCP hosts?

    • You need the subnetId for subnet you want to populate (select id,description from subnets;);
    • Drop all IP's belonging to that subnet (delete from ipaddresses where subnetId = "<id form="" above="">")
    • transform the IP form dotted to decimal (you can use the Transform2decimal function under functions/functions.php)
    • add all other fields that are required (please look at SetInsertQuery funcion) and update ip address list for each DHCP lease.

    It should be relatively simple script and you can execute it every five minutes or so.

     
  • Anonymous

    Anonymous - 2015-07-02

    Hi,

    We don't use DHCP.
    But we generate CSV or flat export from shell script (SNMP + ARP) to discover many IP on switch, and add more (Port name, MAC, Description).
    It would be great if we could feed PHPIPAM with this export, we can adapt the export, but there is no CLI routine to import it ?

    Thanks for your work.
    Regards.

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.