Skip to content

Instantly share code, notes, and snippets.

@robcowart
robcowart / nprobe.conf
Created May 20, 2018 10:04
Improved nProbe Configuration File
# This configuration for nProbe exposes many more options than is available in the file provided
# when downloading nProbe.
#
# Most likely you will only need to change the -n and -i options for your environment. However, a
# number of other options are documented in case you need them.
#
# The provided template works very well with ElastiFlow - A solution to collect and analyze network
# flow data using the Elastic Stack. ElastiFlow is available from:
# https://github.com/robcowart/elastiflow
@candlerb
candlerb / missing-device-ports.py
Last active September 4, 2019 08:18
Report to highlight devices which are missing ports that are in the DeviceType template
# Install as reports/missing-device-ports.py
# Run as: python3 manage.py runreport missing-device-ports
from extras.reports import Report
from dcim.models import Device
class MissingDevicePorts(Report):
description = "Find devices which are missing ports that are in the device type template"
def test_add_ports(self):
@candlerb
candlerb / fix-device-ports.py
Last active January 16, 2022 15:00
Standalone script to create all the missing device components which exist in DeviceType template but not in Device instances
import django
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'netbox.settings')
django.setup()
from dcim.models import Device, ConsolePort, ConsoleServerPort, PowerPort, PowerOutlet, Interface, RearPort, FrontPort, DeviceBay
for device in Device.objects.all():
# Based on Device.save()
ConsolePort.objects.bulk_create(
import queue
import threading
import time
import random
NUM_WORKERS = 20
class Worker(threading.Thread):
"""A worker thread."""
def __init__(self, input, output=None):