Open cmong-nextech opened 11 months ago
Here's a django log showing similar information:
Internal Server Error: /plugins/netdoc/discoverable/2/discover/ Traceback (most recent call last): File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, callback_kwargs) File "/opt/netbox/venv/lib/python3.9/site-packages/django/views/generic/base.py", line 104, in view return self.dispatch(request, *args, *kwargs) File "/opt/netbox/netbox/netbox/views/generic/base.py", line 26, in dispatch return super().dispatch(request, args, kwargs) File "/opt/netbox/netbox/utilities/views.py", line 99, in dispatch return super().dispatch(request, *args, kwargs) File "/opt/netbox/venv/lib/python3.9/site-packages/django/views/generic/base.py", line 143, in dispatch return handler(request, *args, *kwargs) File "/opt/netbox/venv/lib/python3.9/site-packages/netdoc/views.py", line 393, in post utils.spawn_script("Discover", user=request.user, post_data=data) File "/opt/netbox/venv/lib/python3.9/site-packages/netdoc/utils.py", line 1160, in spawn_script module = ScriptModule.objects.get(data_path="netdoc_scripts.py") File "/opt/netbox/venv/lib/python3.9/site-packages/django/db/models/manager.py", line 87, in manager_method return getattr(self.get_queryset(), name)(args, kwargs) File "/opt/netbox/venv/lib/python3.9/site-packages/django/db/models/query.py", line 637, in get raise self.model.DoesNotExist( extras.models.scripts.ScriptModule.DoesNotExist: ScriptModule matching query does not exist.
I apologize for the repeated comments here. Here is a partial success when using the "discover_immediate" script via cli:
Running task 'multiple_tasks' with args {} on 1 hosts Host '10.10.69.254': running task 'multiple_tasks' Host '10.10.69.254': running task '{"command": "show version", "template": "HOSTNAME", "enable": true, "order": 0}' Host '10.10.69.254': task '{"command": "show version", "template": "HOSTNAME", "enable": true, "order": 0}' failed with traceback: Traceback (most recent call last): File "/opt/netbox/venv/lib/python3.9/site-packages/nornir/core/task.py", line 99, in start r = self.task(self, **self.params) File "/opt/netbox/venv/lib/python3.9/site-packages/nornir_netmiko/tasks/netmiko_send_command.py", line 28, in netmiko_send_command net_connect.enable() File "/opt/netbox/venv/lib/python3.9/site-packages/netmiko/cisco_base_connection.py", line 25, in enable return super().enable( File "/opt/netbox/venv/lib/python3.9/site-packages/netmiko/base_connection.py", line 1942, in enable raise ValueError(msg) ValueError: Failed to enter enable mode. Please ensure you pass the 'secret' argument to ConnectHandler.
Host '10.10.69.254': task 'multiple_tasks' failed with traceback: Traceback (most recent call last): File "/opt/netbox/venv/lib/python3.9/site-packages/nornir/core/task.py", line 99, in start r = self.task(self, **self.params) File "/opt/netbox/venv/lib/python3.9/site-packages/netdoc/discoverers/netmiko_cisco_ios.py", line 49, in multiple_tasks utils.append_nornir_netmiko_tasks( File "/opt/netbox/venv/lib/python3.9/site-packages/netdoc/utils.py", line 243, in append_nornir_netmiko_tasks task.run( File "/opt/netbox/venv/lib/python3.9/site-packages/nornir/core/task.py", line 174, in run raise NornirSubTaskError(task=run_task, result=r) nornir.core.exceptions.NornirSubTaskError: Subtask: {"command": "show version", "template": "HOSTNAME", "enable": true, "order": 0} (failed)
Running task 'additional_tasks' with args {} on 1 hosts
You are posting 2 different errors.
Post 1 and 2 seems regarding to a unsupported version of NetBox/NetDoc. Latest NetDoc works with NetBox 3.5 only. Double check that.
Post 3 is about privilege escalation. The username used for 10.10.69.254 requires an enable password? Are you setting the password in the credential?
Thank you. I got the error from the privEsc post resolved last night; it was a radius provisioning error using AAA.
I seem to have been able to get things working better using the "scripts/discovery_netmiko_command.py" with some slight alterations. Seeing as the Netbox version is unsupported, I understand if you want to close this issue. However, if you're willing to help, maybe continuing this conversation can be productive in respect to a newer revision.
Currently when I attempt to ingest the discovery logs, the "ingest" class fails with the following stacktrace:
An exception occurred: TypeError: Device() got unexpected keyword arguments: 'device_role_id'
Traceback (most recent call last): File "/opt/netbox/netbox/extras/scripts.py", line 504, in _run_script script.output = script.run(data=data, commit=commit) File "/opt/netbox/netbox/scripts/netdoc_scripts.py", line 353, in run log_ingest(log) File "/opt/netbox/venv/lib/python3.9/site-packages/netdoc/utils.py", line 578, in log_ingest module.ingest(log) File "/opt/netbox/venv/lib/python3.9/site-packages/netdoc/ingestors/netmiko_cisco_ios_hostname.py", line 36, in ingest device_o = device.create(data) File "/opt/netbox/venv/lib/python3.9/site-packages/netdoc/schemas/device.py", line 108, in create obj = utils.object_create(Device, kwargs) File "/opt/netbox/venv/lib/python3.9/site-packages/netdoc/utils.py", line 1055, in object_create return model_o.objects.create(kwargs) File "/opt/netbox/venv/lib/python3.9/site-packages/django/db/models/manager.py", line 87, in manager_method return getattr(self.get_queryset(), name)(args, kwargs) File "/opt/netbox/venv/lib/python3.9/site-packages/django/db/models/query.py", line 656, in create obj = self.model(kwargs) File "/opt/netbox/netbox/utilities/tracking.py", line 41, in init super().init(args, kwargs) File "/opt/netbox/venv/lib/python3.9/site-packages/django/db/models/base.py", line 567, in init raise TypeError( TypeError: Device() got unexpected keyword arguments: 'device_role_id'
If you are using Netbox 3.4, please downgrade NetDoc to 0.10.34.
I am using Netbox 3.6.1
Ok, I'll keep this open, but at the moment I'm not working on NetBox 3.6.x
I got this working by changing the "device_role_id" parameter to "role_id". Ingestion is now working for "show cdp neighbors detail"
Now I'm receiving the follow stacktrace after attempting to ingest "show lldp neighbors detail"
Traceback (most recent call last):
File "/opt/netbox/netbox/manage.py", line 10, in
Which NetDoc version are you using?
Version 3.5.0
Found the error: I forgot to release 3.5.1. 3.5.0 should not be used. Please wait a few minutes and update to 3.5.1. Mind that 3.5.1 is tested with NetBox 3.5.
Hi @dainok
Any timeline on getting this to work with netbox 3.6.x?
Not at this time.
When using the script to add and discover an object, the following failure is logged:
`An exception occurred: DoesNotExist: ScriptModule matching query does not exist.
Traceback (most recent call last): File "/opt/netbox/netbox/extras/scripts.py", line 504, in _run_script script.output = script.run(data=data, commit=commit) File "/opt/netbox/netbox/scripts/netdoc_scripts.py", line 180, in run output = discovery( File "/opt/netbox/venv/lib/python3.9/site-packages/netdoc/tasks.py", line 124, in discovery utils.spawn_script("Ingest") File "/opt/netbox/venv/lib/python3.9/site-packages/netdoc/utils.py", line 1160, in spawn_script module = ScriptModule.objects.get(data_path="netdoc_scripts.py") File "/opt/netbox/venv/lib/python3.9/site-packages/django/db/models/manager.py", line 87, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/opt/netbox/venv/lib/python3.9/site-packages/django/db/models/query.py", line 637, in get raise self.model.DoesNotExist( extras.models.scripts.ScriptModule.DoesNotExist: ScriptModule matching query does not exist.`