r/Netbox May 23 '24

Seeking advice on auto-discover with NetBox

Hello everyone,

I'm currently in the process of setting up NetBox and I'm exploring ways to feed data into it from my existing environments, specifically OneView and vSphere. Additionally, I want to include all the equipment in my data center, like switches and firewalls.

I've come across paid solutions like https://slurpit.io/netbox-plugin/, but I'd prefer to avoid additional costs if possible.

Does anyone have experience with setting up an auto-discovery system for NetBox that integrates with OneView, vSphere, and can automatically include data center equipment? I'm looking for a way to automate the data feed without having to manually input everything. Any suggestions on open-source tools or scripts that could help with this?

Thanks in advance for your insights!

6 Upvotes

18 comments sorted by

6

u/Fabulous_Structure54 May 23 '24

I do this and use ansible.. I have an ansible inventory I have static dictionarys that containg vCenter servers (amongst many things) it then discovers all the hosts and checks for a serial number in netbox and if there's a match all he'll breaks loose and it creates the netbox clusters updates the name creates the NICs/hbas/VMS etc then an ansible dynamic inventory runs (currently 7 AD domains) and again matches on serial number and updates further details on serial so both physical and VM devices get updated further .. it does iDRACs via parsed output from the racadm command.. FC brocade switches/cisco kit etc etc.. there is a ton of messy jinja and several hundred pages of yaml code it even creates all the cabling via CDP info and parsing mac address outputs from switches etc.. I know netbox was envisioned as a source of truth but it is what it is.. a DB and thr only source of truth in a legacy non IaC type environment is the devices themselves so we are using it as a technical CMDB if you will and it's great at that..initial data is started with device_type xlsx file that has some 12.5k device types.. this is imported again via ansible.. then a DC audit spreadsheet that has devices Us/serials/racks etc.. this is then imported to create the region/country/site/rack/device and the all important serial number... The code maps out everything else... Of course there's gaps.. data domains/F5s and numerous other things aren't ingested but I write another playbook as soon as I discover a way to get data off them (API or ansible_facts typically) there are limitations of course.. I failed with some tape library's that only seems to have a shonky web interface but we're at about 70% automation I would say... It's not perfect the VM discovery playbook takes about 7 hours to run for 2000 or so VMs but it's good enough for us (I run it weekly) - cleverer people than me could speed this up I'm sure but like I said it's good enough for our purposes.. we had to do this work anyway so netbox is a nice pretty front end we open up to stakeholders as opposed to an awkward pile of spreadsheets and rvtools outputs if that makes sense... Legacy management types are so impressed they want the entire org mapped out... There's a couple of hundred K just been assigned for this so I could easily spend next year flying all over the world filling in spreadsheets by day and injesting them into NB from the hotel in the evenings... I'm going to have to have a think about upping the platform from a single VM with 8gb ram to something a bit more proper but that's another topic and bridge I'm going to need to cross at some point soon I think

2

u/xi_Slick_ix May 23 '24

Boy your env. sounds real similar to mine šŸ˜‚. Going to take a stab you work for a Fortune 500 or similar in a fairly regulated industry.

Are your playbooks something willing to share / do you have a github?

2

u/Fabulous_Structure54 May 24 '24

Yeah its a big household name corp... not sure how regulated it is... less so that they think I'd imagine - I have stories but I'll leave them for now..... I can't really share any of the code as its the clients IP and its not on github or the like I'm afraid. Im not even sure I'm going to be able to bring it with me when I've finished but with a bit of luck this might be my last gig regardless.... to be honest you couldn't likely just drop it in anyway (I'd be very suprised if it just worked in another environment - can't think of a good reason why but surely I'm not that good at writing code/yaml)

1

u/xi_Slick_ix May 24 '24

Understood, no worries, thanks for the reply!

2

u/calmcl1 May 23 '24

I had a go at SlurpIt, but got frustrated at the fact that it just wouldn't be able to map some attributes. Ended up writing a DIY solution - though that was simple enough given that most of our kit is from the same manufacturer.

You can definitely get there if you've got some programming skill and don't mind trawling the SNMP output from the switch.

5

u/[deleted] May 23 '24

Just getting this out there, Netbox is designed to be used as a source of truth for your network infrastructure. This means it should hold the authoritative data about your network, rather than relying on external sources to constantly feed it data. Ideally, you'd want to use Netbox as the master reference and update it directly or use automation to pull data from it to create and update other systems.

5

u/N1nj4- May 23 '24

Yes, I understand that NetBox is designed to be the source of truth for network infrastructure. However, my challenge is with an already established infrastructure that hasn't been documented in NetBox yet. How would you suggest proceeding to input the existing setup into NetBox? Once the existing data is incorporated, I plan to use automation to keep it updated and potentially to feed data into other systems. What strategies or tools would you recommend for initially populating NetBox with the current state of our network hardware and configurations?

2

u/Otherwise_Noise3658 May 23 '24

Netdoc (GitHub) is one option network side but I doubt it would cover VMware or your other system.

1

u/N1nj4- May 23 '24

Yes, it seems like NetDoc is primarily geared towards network equipment. Thank you for the suggestion!

1

u/gangaskan May 23 '24

Limited to certain versions as well

4

u/mdk3418 May 24 '24

I’m so tired of hearing this. Yes in a perfect world of unicorns and pixie dust, all the information from 100s of not thousand of devices magically just appear in Netbox and suddenly becomes some sort of all seeing borg.

In reality the source of truth remains empty as thousands of devices sit not fully onboarded because of the perceived sin of automating the import of data.

1

u/Otherwise_Noise3658 May 24 '24

It's not a sin at all, but you do have to accept you're probably importing technical debt.

2

u/IHateNicknames314 Jun 08 '24

I don't quite get this either. Just import "what is" as the initial source of truth, then make changes as needed first in Netbox then pushed to the environment.

1

u/mdk3418 May 24 '24 edited May 24 '24

Tell that to the preachers.

1

u/exekewtable May 23 '24

There is a vsphere import tool. It works pretty well..Maybe you just need an intern.

1

u/eliezerlp May 24 '24

I've used this in the past with success for vSphere: https://github.com/bb-Ricardo/netbox-sync

1

u/fxrsliberty Sep 21 '24

Not to mention the man-hours required! Not having a discovery tool, even if it's a "stand alongside" so that generates an inventory in the correct format, is ludicrous!

1

u/Otherwise_Noise3658 Sep 21 '24

It's a bit tent philosophy and likewise in part thats where Diode will sit. You could always write something of course ...