netbox-community / customizations Goto Github PK
View Code? Open in Web Editor NEWA collection of community submitted and maintained customizations including reports, scripts, validators and export templates
License: MIT License
A collection of community submitted and maintained customizations including reports, scripts, validators and export templates
License: MIT License
Hi
When updating a device with the script add_device_type_components.py, both interfaces, module bays and console ports are populated. However, the tab menues for module bays and console ports does not get updated with the new data. In this screenshot, you may see how the device has got 17 module bays, but only showing 1 (which was there from before) in the menu:
If there are no module bays or console ports, the tab menu item is not displayed. Hence you will not have the oportunity to use them. As shown here:
Interfaces works as expected.
Any idea what could cause this?
Netbox v3.6.6
put the script in ./scripts of netbox-docker.
When accesing the "scripts" main menu item, netbox throws a server error (below).
I've seen that generally people use 'LinkStatusChoices', maybe it is deprecated, but i'm not really sure what's happening.
<class 'ImportError'>
cannot import name 'LinkStatusChoices' from 'dcim.choices' (/opt/netbox/netbox/dcim/choices.py)
Python version: 3.9.5
NetBox version: 3.0.6
Hello. I have code:
manufacturer = ObjectVar(
label='Manufacturer',
description="Manufacturer of the device",
model=Manufacturer,
required=False
)
device_type = ObjectVar(
label='Device model',
description="Model of the device",
model=DeviceType,
query_params={
'manufacturer_id': '$manufacturer'
}
)
up_link_interface = ObjectVar(
label='Up-Link interface',
model=InterfaceTemplate,
description="Up-Link interface",
query_params={
'device_type_id': '$device_type',
}
The problem is that this code does not filter interfaces in "up_link_interface" (gives a complete list of all interfaces from all templates). Please explain what the error is. Thanks.
I have some CustomValidators that I suspect would be useful to others, how do the maintainers & community feel about about a new folder called "custom_validators" in this repo?
Cosmetic bug in that dns-reports.py class Check_DNS_AAA_Record
should probably be called Check_DNS_AAAA_Record
dns-reports checks for dns entries for devices with IPs assigned to an interface. This line filters out devices with no interfaces, but in my case, it still returns devices with no interfaces, because it returns an empty QuerySet
https://github.com/netbox-community/reports/blob/9b4a4fab71c5a10469988f362f410b295b9f317e/reports/ipam-reports/dns-reports.py#L13
I've fixed the issue locally by replacing it with this line.
if not device.interfaces.exists():
http://docs.djangoproject.com/en/dev/ref/models/querysets/#exists
Hello,
so far this repository collects reports and scripts, thus the name seems already a bit misleading.
I propose that this repository should be renamed (maybe something like "user_generated_content") and the ability to add export templates is added.
Benefit: Users are encouraged to submit their templates, we all can learn a bit from it or get new ideas.
Several of the reports seem to be broken on v2.7.* as a result of the change to some of the constants in python.
Here is an example Server Error
The complete exception is provided below:
<class 'NameError'>
name 'IPADDRESS_ROLE_LOOPBACK' is not defined
I'm not a coder, so I'm asking for help. Is anyone up to the task of creating a script very much like the "add_device_type_components.py" script, but for module types? I have 400+ modules that I need to add an interface to. I'd like to do this in bulk without going to every single one of those 400+ modules.
Thanks!
An exception occurred: TypeError: RearPortTemplate.instantiate() takes 1 positional argument but 2 were given
Traceback (most recent call last):
File "/opt/netbox/netbox/extras/scripts.py", line 461, in _run_script
script.output = script.run(data=data, commit=commit)
File "/etc/netbox/scripts/add_device_type_components.py", line 44, in run
items = [
File "/etc/netbox/scripts/add_device_type_components.py", line 45, in <listcomp>
x.instantiate(device)
TypeError: RearPortTemplate.instantiate() takes 1 positional argument but 2 were given
Getting this error on v3.2.7
Update missing_device_type_components.py to check more than just names of items.
Hi.
I would like to have a report that shows me the amount of IP that a prefix has.
If the prefix has no registered ip, it will be a log_failure and in case have at least one ip is log_info.
I don't know how to relate IPs to prefixes using ipaddress and prefix objects.
Can you help me?
Thank you
The reports we (at Wikimedia) made to keep our data consistent are available on https://gerrit.wikimedia.org/g/operations/software/netbox-reports, with a mirror on https://github.com/wikimedia/operations-software-netbox-reports
I don't think they would be of any value as-it, as they are tailored for our needs, but might be worth a link from your repo to ours. At least to get ideas and inspiration.
See our README for a quick description.
Fyi, all our Netbox related work is tracked on https://phabricator.wikimedia.org/tag/netbox/
As per the title, I am running Netbox v2.8.3 and tried to run the create_vm.py
script but it failed with the error below:
An exception occurred: FieldError: Cannot resolve keyword 'family' into field. Choices are: address, created, custom_field_values, description, dns_name, id, interface, interface_id, last_updated, nat_inside, nat_inside_id, nat_outside, primary_ip4_for, primary_ip6_for, role, services, status, tagged_items, tags, tenant, tenant_id, vrf, vrf_id
Traceback (most recent call last):
File "/opt/netbox/netbox/extras/scripts.py", line 408, in run_script
output = script.run(**kwargs)
File "/opt/netbox/netbox/scripts/create_vm.py", line 98, in run
add_addr(data["primary_ip4"], 4)
File "/opt/netbox/netbox/scripts/create_vm.py", line 78, in add_addr
vrf=data.get("vrf"),
File "/opt/netbox/venv/lib/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/opt/netbox/venv/lib/python3.6/site-packages/cacheops/query.py", line 390, in get
return qs._no_monkey.get(qs, *args, **kwargs)
File "/opt/netbox/venv/lib/python3.6/site-packages/django/db/models/query.py", line 404, in get
clone = self._chain() if self.query.combinator else self.filter(*args, **kwargs)
File "/opt/netbox/venv/lib/python3.6/site-packages/django/db/models/query.py", line 904, in filter
return self._filter_or_exclude(False, *args, **kwargs)
File "/opt/netbox/venv/lib/python3.6/site-packages/django/db/models/query.py", line 923, in _filter_or_exclude
clone.query.add_q(Q(*args, **kwargs))
File "/opt/netbox/venv/lib/python3.6/site-packages/django/db/models/sql/query.py", line 1351, in add_q
clause, _ = self._add_q(q_object, self.used_aliases)
File "/opt/netbox/venv/lib/python3.6/site-packages/django/db/models/sql/query.py", line 1382, in _add_q
check_filterable=check_filterable,
File "/opt/netbox/venv/lib/python3.6/site-packages/django/db/models/sql/query.py", line 1251, in build_filter
lookups, parts, reffed_expression = self.solve_lookup_type(arg)
File "/opt/netbox/venv/lib/python3.6/site-packages/django/db/models/sql/query.py", line 1088, in solve_lookup_type
_, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
File "/opt/netbox/venv/lib/python3.6/site-packages/django/db/models/sql/query.py", line 1484, in names_to_path
"Choices are: %s" % (name, ", ".join(available)))
django.core.exceptions.FieldError: Cannot resolve keyword 'family' into field. Choices are: address, created, custom_field_values, description, dns_name, id, interface, interface_id, last_updated, nat_inside, nat_inside_id, nat_outside, primary_ip4_for, primary_ip6_for, role, services, status, tagged_items, tags, tenant, tenant_id, vrf, vrf_id
I am not a python dev, so I just worked around this issue by commenting out lines 77 and 84 which removes this text:
family=addr.version,
I assume this might not be a backward compatible change, but someone who knows better will have to decide. I just wanted to highlight it.
Thanks for the fine work.
I had to do a "pip install dnspython" though, to get it going.
Server Error
There was a problem with your request. Please contact an administrator.
The complete exception is provided below:
<class 'TypeError'>
__init__() got an unexpected keyword argument 'display_field'
Python version: 3.9.2
NetBox version: 3.3.4
This includes multiple tasks:
Throws this error when accessing the script.
<class 'ValueError'>
too many values to unpack (expected 2)
Python version: 3.8.10
NetBox version: 3.2.1
In this repository, various reports from different people have been merged into the same source file - e.g. the single file reports/ipam-reports/ip-reports.py contains various IPAddress-related reports from different people.
I don't think this is a good idea. Reasons:
What I propose is that if an author submits a file, or a gist is copied in, then it should remain as-is - complete with its header of imports (and copyright/licence if present). It should only be necessary to rename the file or classes if they clash with an existing report.
I don't mind if the top-level folders ("ipam-reports" and "dcim-reports") are kept. It's not always going to be clear which category a particular report ends up in, but it doesn't really matter if it's miscategorised.
Hi
do we have a report that we can run to give us a list of all change log deleted items in the last hour/day/week?
can we have a script or report to notify the admins if tehre was a bulk of deleted objects in the last hour? (someone deleted >10 devices for example)
also, can we schedule jobs to send email results?
please advice
thanks
The report "Missing Device Type Components" is not checking Module Bays correctly. It doesn't show when a Module Bay is missing from a device while it's present in the device type.
Audit cable connections in NetBox using NAPALM LLDP check from the UI, but do it in a single report for all devices where NAPALM LLDP is available.
# cp scripts/device_type_init.py /opt/netbox/netbox/scripts
# cp -r device-types /opt/netbox/netbox/scripts
You can create all, or specify the Manufacturer to create. There are the following options, generated from the catalog
Looks like when a selected cluster have a site the script returns an error.
I'm running Netbox 3.3.2 with Python 3.10.
Maybe it is something related to the newer Netbox version.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.