Closed ndom91 closed 3 years ago
Excellent job!
Everyone must be aware that no tags will be written into NetBox in this version. For instance, in my environment, tags mark the data source (Nmap, Prime, NetXMS...), so it helps me troubleshooting.
For documentation purposes, from NetBox v2.9 tags are written through their IDs, so new routines must be created for tag creation and tag ID lookup (this ID will be written, not the tag name).
So based upon the comments in #20 and my work getting this to work recently I made a few changes, hope you don't mind!
nbs/__init__.py
for now because the subroutine you mentioned to get the existing tag ID and use that instead doesn't exist yet and I'm not experienced enough with python to write it. This way it runs with current (and older) Netbox at least.samples/nmap
subdirectory already so people don't get confused (also the program was confused without the full path for me in that variable in the conf).nmap-scan.sh
script. First of all, your shebang for just 'sh' didn't work on mine and my colleagues machine because sh wasn't symlinked to bash. The best practice here is to use#!/usr/bin/env bash
. Also theNETWORKS
variable isnt actually declared if you put spaces around the=
, so I removed those. In addition, nmap wouldn't write a filename with an unescaped\
in it (from the full$net
variable) so I made a temporary$rawNet
variable which just chops off the last 3 chars of$net
and writes the nmap file with the IP as suffix. Oh also tar was complaining because of unescaped.
and:
as well, so I dropped those from theTODAY
variable.This way it finally ran on my system on the latest Netbox (2.9.9) and it should still be compatible with older versions.
Like you mentioned in that issue, a real function to grab the ID of the required tag and use that in place of the name so we can uncomment that line again would be crucial.
Thanks 🎉