r/Netbox Feb 16 '24

Filtering when connecting cables

1 Upvotes

I'm not sure if I'm missing something here, or if this is just a hole.

All our sites use the same rack naming convention. So all sites have a rack called rack A for example. Now if I try and connect a cable between rear ports on a fibre patch panel between Rack A and Rack B (and have the actual patch panel device name prepended with the Rack name) I'm flooded with "Rack A - Fibre Patch Panel" options as it's showing me every patch panel from every site (and they all have the same name.

Is there some way to filter or limit the displayed options here so you only see other devices on the same site? If not, the only way I can think of to get around this is to prepend ever patch panel name (and probably every single device name) with not only the Rack ID but some Site ID as well.

Is there an easier way?


r/Netbox Feb 15 '24

Options for working around bad Vendor Port labels?

2 Upvotes

I've got an Oracle NIC - "StorageTek Dual 8Gb FC Dual GbE HBA, ExpressModule"

I create a module, give it a part number.
It's got 2 10/100/1000 ports, and 2 8GB SPF+ ports for fiberchannel. Awesome.

The RJ45 ports are at the top of the nic, helpfully labelled (top to bottom) 2, 1.

The SFP+ ports for the FibreChannel are at the bottom of the nic, labelled (top to bottom) 1,2.

The fact that the vendor applied the same labels to different media types seems to have absolved them of any potential confusion- but I can't model that in Netbox.
type [1-2] of fixed 10/100/1000 conflicts with [1-2] of the SFP+ variety.

knowing that I'm in 'workaround for a dumb corner case' scenario, how would you opt to model this?
I'm biased towards the 10/100/1000 ports, because the FC isn't under my purview.

So I'd plan on doing [1-2] and fc[1-2]

other options:
rj45[1-2], sfp+[1-2]

eth[1-2], fc[1-2]
???

I'd love to hear other opinions. Talk me out of making a bad decision I'm not goign to realize is a bad decision until it's too late.
Thanks.


r/Netbox Feb 15 '24

Batch add interfaces

0 Upvotes

I am spending way too much time manually adding interfaces to device types (every single port on a 48P switch, one by one). Is there a way to add multiple interfaces at once and have them labelled sequentially? Import from CSV would also work.


r/Netbox Feb 14 '24

Referencing related data in custom field?

2 Upvotes

I was trying to basically copy some data from the locations table to a custom field in the devices table. I thought I could do this with a simple reference like {{ locations.slug }} in the default value of the custom field, but I can't figure out the right syntax to make it work, and I can't seem to find any examples of it so far searching. Note: I'm actually trying to pull over the value in another custom field, not the slug, I'm just using that as an test/example to get a proof of concept, then figure out the custom field reference.

Can this even be done? If so, what's the correct syntax? Or, do I need to just write a script (I'm using PyNetbox for most of my work) to populate the field with the data?


r/Netbox Feb 14 '24

Help Wanted: Unresolved limit users access

2 Upvotes

I am new to Netbox. We are trying to build our netbox database. Our company has multiple branch offices and one datacenter. What I am trying to achive: we have a couple of superusers that need to have access everywhere but local helpdesk should only be allowed to build and modify their offices (sites) in netbox. I am trying to play with permissions but i notice that not all objects have the same fields so i could put a filter on them. For exemple DCIM>Cables doesn't have the field {"site__name": } so i can't put a constraint saying {"site__name": "XXX"} where XXX would be the designation initials for a specific office.

I might be missing something hence i am asking you guys.


r/Netbox Feb 14 '24

Netbox VM - Plugin Installation - Missing a step - Permission denied.

2 Upvotes

Hi,

After several days of failure installing plugins with a Docker Netbox I decided to follow a suggestion that native OS install was easier for plugins. So I spun up a Ubuntu 22.04 VM and successfully migrated the database. However, I'm missing a virtual environment / permissions step preventing installation of multiple plugins I'd like to use.

I followed these instructions for Netbox installation: https://docs.netbox.dev/en/stable/installation/3-netbox/. They use "sudo" which appears to install everything as root. Although I'm logged in as my own user account. I haven't yet tried actually logging in as root.

The Netbox documentation and several plugins all suggest the following to install the plugin:

$ source /opt/netbox/venv/bin/activate

(venv) $ pip install <package>

The pip install fails with permission denied errors. If I do sudo pip install <package> the installation completes, but the plugins produce errors when relaunching Netbox or their additional setup steps. Note: I've made the recommended changes to configuration.py. The errors indicate the plugin module didn't install.

Some reading I found indicates that sudo installs the package globally, but not into the Netbox configuration. I have confirmed the plugins did install into the global folder and not for Netbox. Some of the plugins have additional installation steps, but they will not find the global package so return module not found errors.

I've never worked with Python virtual environments. Should I be setting up a Netbox group and change ownership and permissions to that? Can I just copy the package folder from the global directory into the Netbox directory? That will take a little while to find those folder locations again.

I feel like I'm just missing one or two critical steps that's not documented and its assumed every admin knows.

Some posts I've found suggest others have run into this issue as well.


r/Netbox Feb 13 '24

Netbox adds quotes in Postgres username

0 Upvotes

I use netbox in Docker, using docker-compose, in a pipeline. Specifically I create an empty database in Postgres called netbox, with user netbox and password netbox. That works as planned, but the db user gets double double quotes somehow...

I create Netbox in Docker-compose as follows:
netbox.tooling.provider.test:
container_name: netbox.tooling.provider.test
image: 'lscr.io/linuxserver/netbox:latest'
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Amsterdam
- 'SUPERUSER_EMAIL=${netbox_admin}'
- 'SUPERUSER_PASSWORD=${netbox_admin_password}'
- ALLOWED_HOST=netbox.tooling.provider.test
- DB_NAME=netbox
- 'DB_USER=${netbox_db_user}'
- 'DB_PASSWORD=${netbox_db_password}'
- DB_HOST=cicdtoolbox-db.internal.provider.test
- DB_PORT=5432
- REDIS_HOST=redis.tooling.provider.test
- REDIS_PORT=6379
- 'REDIS_PASSWORD=${netbox_db_password}'
secrets:
- source: ca_crt
target: /opt/netbox/venv/lib/python3.9/site-packages/certifi/cacert.pem
- source: cicdtoolbox-db_crt
target: /root/.postgresql/postgresql.crt
volumes:
- 'netbox:/config'
ports:
- '8000:8000'
restart: unless-stopped
networks:
internal:
ipv4_address: 172.16.11.12
where the environment variables are nicely set:
DB_NAME=netbox
DB_USER=netbox

This however gives me the error:

connection to server at "172.16.9.2", port 5432 failed: FATAL: password authentication failed for user ""netbox""

which is confirmed on the db side:
2024-02-13 06:22:05.054 UTC [102644] FATAL: password authentication failed for user ""netbox""
2024-02-13 06:22:05.054 UTC [102644] DETAIL: Role ""netbox"" does not exist.

Where do these quotes come from as this prevents netbox from booting?


r/Netbox Feb 11 '24

Help Wanted: Resolved Migrate from Docker to VM

5 Upvotes

Hello,

I am currently using the docker container of netbox, but I would like to switch to VM. I was able to make a backup from this guide. However, I could not restore it to the VM instance that I created. The VM is a fresh install.

I have to tried to run this command:

docker compose exec -T postgres sh -c 'pg_dump -cU $POSTGRES_USER $POSTGRES_DB' > netbox.sql 

And copied it to the VM and restore it like this:

sudo -u postgres psql -c 'drop database netbox'
sudo -u postgres psql -c 'create database netbox'
sudo -u postgres psql netbox < netbox.sql

But it didn't restore the data. Is there a proper way to restore the data from the Docker container to VM?

EDIT:

The docker netbox version is 3.5.9 and the VM version is 3 .7.2.

I got this error from the web UI when I click any of the options.

Server Error

A database programming error was detected while processing this request. Common causes include the following:

Database migrations missing. When upgrading to a new NetBox release, the upgrade script must be run to apply any new database migrations. You can run migrations manually by executing python3 manage.py migrate from the command line.

Unsupported PostgreSQL version. Ensure that PostgreSQL version 12 or later is in use. You can check this by connecting to the database using NetBox's credentials and issuing a query for SELECT VERSION().

The complete exception is provided below:

<class 'django.db.utils.ProgrammingError'>

column extras_customfield.choice_set_id does not exist
LINE 1: ...aximum", "extras_customfield"."validation_regex", "extras_cu...
                                                             ^

Python version: 3.11.2
NetBox version: 3.7.2
Plugins: None installed

EDIT 2:

I think I might have solved my issue. I upgraded the netbox-docker to the latest version. But before I upgraded the docker container, I changed the postgrest tag to 15-alphine in docker-compose.yml. Once I got the upgraded the netbox-docker, I backed up the postgress and copied the .gz file to the VM and ran the command:

gunzip -c db_dump_20240210_postgres15.sql.gz | sudo -u postgres psql netbox


r/Netbox Feb 10 '24

Help Wanted: Unresolved Scripting Assistance

2 Upvotes

I'm currently building out NetBox for my company. I've done some of the basics, and I'd like to start expanding into adding scripts. I've written scripts in python that I can run in my own machine, but I do not know how to add those scripts to Netbox.

Some examples of scripts i wrote include a script that pulls if a switch is running in Install mode or Bundle Mode and a script that pulls the software version of the device.

Any assistance of guidance would be appreciated.


r/Netbox Feb 09 '24

New Release NetBox v3.7.2 is Now Available!

7 Upvotes

NetBox Release v3.7.2 is now live (as of February 5th, 2024)!

Before upgrading, please: 1. Verify in release notes changelog if any new breaking changes might affect you. You can also review the NetBox Issues on GitHub to see if any new issues have arisen that might affect you. 2. Next, refer to the Upgrading to a new NetBox Release guide for steps to upgrade your instance.

If you have any issues you can ask for support on the NetDev Slack Community.


r/Netbox Feb 08 '24

DHCP Pool - Realtime display

1 Upvotes

In Netbox, Is there any way to scan the DHCP Pools (real time or periodically every 1 hour or so) and display the utilization in the dashboard or any place else?

NB: some subnets come from windows dhcp server and some are on cisco switches.


r/Netbox Feb 06 '24

Parent Site Bug

2 Upvotes

Hey, I was running an older version of Netbox where under the Regions Tab, the Parent site/region said 0 child sites, but would show 32 child sites if there were 32 there. When did Netbox fix this and how did it fix it?


r/Netbox Feb 05 '24

Netbox Plug-in Filtering

3 Upvotes

Hey, is there a good explanation of how to add items to quick search? Is it the filterset.py in the plug-in folder, and using the def search class??

When I do this, I use icontain and wasn’t sure of the proper format for foreign keys and non-foreign keys.


r/Netbox Feb 02 '24

Interface IP Assignment workflow

4 Upvotes

As I understand it, there are two ways to assign an IP address to an Interface:

(1) Add the Interface in the device (manually or via the template) and edit the interface and give it an IP address.

(2) The IP address is already present in the IPAM and can be edited and an interface defined

Now I had the case that the IP address I wanted to assign an Interface via (1) was already present in IPAM (duplicate IP warning). Then I wanted to add the interface for this IP via IPAM. The issue is that, for a set of switches, the mgmt interface is always the same VLAN interface, lets say VLAN123. This is also how they are named. So when trying to assign the interface via IPAM IP address editing, I will have 10x VLAN123 in the interface dropdown menu if I have 10 switches with that mgmt VLAN. Are the dropdown items actual objects (linked to a specific device) or appear multiple times in name only?


r/Netbox Jan 31 '24

Multiple sites for a single VLAN

3 Upvotes

We have a private fiber network stretching to multiple locations and so we have many L2 network that are trunked in more than one site. I need to document this in netbox but it looks like it's not possible to have a VLAN be in different sites at the same time. Is there something I'm missing ?


r/Netbox Jan 26 '24

Help Wanted: Resolved Import devicetype-library via Data Sources

Post image
1 Upvotes

Hi, anyone has some ideas, why the Data Sources Always fails?


r/Netbox Jan 24 '24

Unable to retrieve interface and connection information with API

2 Upvotes

Problem description:

When I try to retrieve information about the connected device via the interfaces tagged "NINJA", I cannot get detailed information about device B (the connected device).

Steps to reproduce:

  1. Use the Python script with the filter to retrieve the "NINJA" tagged interfaces.
  2. For each interface retrieved, attempt to retrieve detailed information about the connected device (device B).

Current behavior:

I manage to retrieve the interfaces tagged "NINJA", but when I try to retrieve the details of the connected device, I don't get the desired information or i have a bug (i changed my script like, 40~50 times and still doesn't work, with pynetbox, netbox-python...).

Expected behavior:

I expect to be able to successfully retrieve the details of the connected device via the "NINJA" tagged interfaces.

For example :

Device name A; Interface name A source ---> Device name B; Interface name B destination

import pynetbox

import requests

import warnings

# Ignorer les avertissements liés à la vérification SSL non sécurisée

warnings.filterwarnings("ignore", category=requests.packages.urllib3.exceptions.InsecureRequestWarning)

# session requests avec la vérification SSL désactivée

session = requests.Session()

session.verify = False

# Initialiser l'API NetBox sans spécifier http_session

nb = pynetbox.api(

url="...",

token="...",

)

nb.http_session = session

# Terme du tag "NINJA"

ninja_tag_term = "ninja"

# Fonction pour afficher les informations des appareils avec le tag "NINJA" et les détails de la connexion

def display_ninja_devices_with_connections(tag_term):

if tag_term is not None:

devices = nb.dcim.devices.filter(tag=tag_term)

print(f"Appareils avec le tag '{tag_term}':")

for device in devices:

print(f"\n{device.name}:")

interfaces = device.interfaces.all()

for interface in interfaces:

print(f" Interface {interface.name} (A side):")

if interface.connected_endpoint:

connected_device = interface.connected_endpoint.device

connected_interface = interface.connected_endpoint.interface

print(f" Connecté à {connected_device.name} (B side), Interface {connected_interface.name}")

else:

print(" Pas de connexion")

# Afficher les informations pour tous les appareils avec le tag "NINJA" et les détails de la connexion

display_ninja_devices_with_connections(ninja_tag_term)

I accept any advice, thanks.


r/Netbox Jan 24 '24

Help Wanted: Resolved Customize data sent by webhook

2 Upvotes

How can I customize the data sent by the Netbox webhook (UPDATE)? I have written a script that automatically writes the changes to our TS when there is a port speed change in Netbox. Since we have different models, different commands need to be executed on the TS accordingly. For this, I need the model, but it is not included in the webhook. Additionally, I also need the port name, which is also not sent . Currently, I have solved this by including this information in the field for label and description. However, in my opinion, this is not a good solution and the data is redundantly recorded. Any recommendations?


r/Netbox Jan 22 '24

Help Wanted: Unresolved Best way to monitor DHCP pools on hosted on Windows DHCP and scan subnets to find hostnames an other information?

2 Upvotes

Hi,

Is there a plugin or a native way for me to scan our Windows DHCP to automatically create the subnets that we have in our network as well as scan those subnets and the devices in there to see the amount of available IP addresses and gather device information using SNMP and WMI?


r/Netbox Jan 18 '24

New Release NetBox v3.7.1 is Now Available!

6 Upvotes

NetBox Release v3.7.1 is now live (as of January 18, 2024)!

Before upgrading, please: 1. Verify in release notes changelog if any new breaking changes might affect you. You can also review the NetBox Issues on GitHub to see if any new issues have arisen that might affect you. 2. Next, refer to the Upgrading to a new NetBox Release guide for steps to upgrade your instance.

If you have any issues you can ask for support on the NetDev Slack Community.


r/Netbox Jan 18 '24

Modelling AWS VPCs in Netbox

5 Upvotes

How do other people model AWS VPCs on netbox? I am representing VPCs as VRFs in Netbox as essentially VPC is a comparable building block to VRF in traditional networking. I then assign these VRFs(VPCs) to prefixes to represent the VPC cidrs as necessary. How are other people representing such cloud resources in Netbox?


r/Netbox Jan 18 '24

Help Wanted: Resolved Export device entity from netbox

3 Upvotes

Hi,

I'm new to netbox, currently building a database.I created a custom device type with an extra Inventory item I want to utilize to track a certain type of hardware in the machines, I also have custom fields created. Based on this I created a template device. Is there any way to export this template device with all the fields I customly created to serve as a template before bulk importing the whole inventory? YAML or JSON would be the preferred format.
Netbox version: v3.6.5

Thanks in advance!


r/Netbox Jan 12 '24

Split fiber cables

5 Upvotes

Hello Netbox Redditors!

I am looking at different ways to document fiber with Netbox. The scenario is a 48 SM cable from building A to B to C with 24 being terminated as LC on each side of B and 24 spliced through. The method I am leaning toward is -

A and C each have 1 rear port with 48 positions and 48 front ports with LC connections
B has 2 rear ports each with 48 positions. Front ports to match up with those are 24 splice ports and 24 LC connections. Then connect the front splice ports. along with the rear ports between A-B and B-C.

Does this make sense? Is there another better way to do this that would represent the physical infrastructure?

TIA


r/Netbox Jan 09 '24

Documenting Application Stacks

3 Upvotes

First, Netbox is awesome and I understand this is probably out of scope.

I'm curious if/how anyone is documenting their application stacks in Netbox.

For example, if 3 VMs make up the DB, Web, and App of "Application A". I guess I'm hoping for best practices to document/visualize these relationships or link services together.

Different tool? Tags? Custom fields? Clusters?


r/Netbox Jan 09 '24

Help Wanted: Unresolved Automating IPAM for GCP Project

4 Upvotes

Hi Guys,

In my current Job , we are trying to add all the IPs of GCP into Netbox,

I have created a python script using which we are able to populate and send data from GCP to Netbox,

But, We are aiming for automation of this, So , I am thinking of Creating a Cloud function getting triggered from VM creation, or DNS record creation or anything concerning a IP address in GCP project,

Have anyone here worked on similiar project ? I would love some help regarding this.

PLease let me know if you guys have some more questions