dainok / netdoc

Automatic Network Documentation plugin for NetBox
GNU General Public License v3.0
89 stars 13 forks source link

Library Files Missing and No Ingest #28

Closed Lurick73 closed 1 year ago

Lurick73 commented 1 year ago

I just recently ran through the netbox and netdoc install documents and afterwards I noticed two things: Netdoc doesn't seem to make or add any files to the following directory causing issues: /opt/netbox/venv/lib/python3.10/site-packages/netdoc/library/ (depending on the install it might be /opt/netbox-3.4.10/... instead)

However even after manually pulling down the library files and adding them all to that location netdoc still doesn't' ingest anything. I see it run when I trigger a discovery and then look at the logs and nothing is being ingested, everything shows x

netdoc

Lurick73 commented 1 year ago
Jun 25 13:02:00 netbox python3[2100]: ^^^^ END additional_tasks ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jun 25 13:02:00 netbox python3[2100]: No Netmiko Cisco NX-OS device found
Jun 25 13:02:00 netbox python3[2100]: No Netmiko Cisco XR device found
Jun 25 13:02:00 netbox python3[2100]: No Netmiko HPE Comware device found
Jun 25 13:02:00 netbox python3[2100]: No Netmiko Linux device found
Jun 25 13:02:00 netbox python3[2100]: 13:02:00 default: Job OK (a9fd3b49-a820-4656-ae94-327509df3285)
Jun 25 13:02:00 netbox python3[2100]: 13:02:00 Result is kept for 500 seconds
Jun 25 13:02:00 netbox python3[1976]: 13:02:00 default: extras.scripts.run_script(data={}, job_result=<JobResult: 62b922ac-32a4-40bd-a7aa-ccad0ca1aa33>, request=<utilities.utils.NetBoxFakeRequest object at 0x7f9742af6fe0>) (62b922ac-32a4-40bd-a7aa-ccad0ca1aa33)
Jun 25 13:02:44 netbox systemd[1]: session-8.scope: Deactivated successfully.
Jun 25 13:05:01 netbox CRON[2127]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 25 13:07:00 netbox python3[2106]: An exception occurred: `JobTimeoutException: Task exceeded maximum timeout value (300 seconds)`
Jun 25 13:07:00 netbox python3[2106]: ```
Jun 25 13:07:00 netbox python3[2106]: Traceback (most recent call last):
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/netbox/extras/scripts.py", line 476, in _run_script
Jun 25 13:07:00 netbox python3[2106]:     script.output = script.run(data=data, commit=commit)
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/netbox/scripts/NetDoc.py", line 290, in run
Jun 25 13:07:00 netbox python3[2106]:     log_ingest(log)
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/venv/lib/python3.10/site-packages/netdoc/utils.py", line 384, in log_ingest
Jun 25 13:07:00 netbox python3[2106]:     module.ingest(log)
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/venv/lib/python3.10/site-packages/netdoc/ingestors/netmiko_cisco_nxos_show_mac_address_table.py", line 30, in ingest
Jun 25 13:07:00 netbox python3[2106]:     macaddresstableentry_o = macaddresstableentry.get(
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/venv/lib/python3.10/site-packages/netdoc/schemas/macaddresstableentry.py", line 65, in get
Jun 25 13:07:00 netbox python3[2106]:     obj.save()
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/venv/lib/python3.10/site-packages/netdoc/models.py", line 454, in save
Jun 25 13:07:00 netbox python3[2106]:     super().save(*args, **kwargs)
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/base.py", line 812, in save
Jun 25 13:07:00 netbox python3[2106]:     self.save_base(
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/base.py", line 878, in save_base
Jun 25 13:07:00 netbox python3[2106]:     post_save.send(
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/dispatch/dispatcher.py", line 176, in send
Jun 25 13:07:00 netbox python3[2106]:     return [
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/dispatch/dispatcher.py", line 177, in <listcomp>
Jun 25 13:07:00 netbox python3[2106]:     (receiver, receiver(signal=self, sender=sender, **named))
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/netbox/extras/signals.py", line 87, in handle_changed_object
Jun 25 13:07:00 netbox python3[2106]:     enqueue_object(queue, instance, request.user, request.id, action)
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/netbox/extras/webhooks.py", line 72, in enqueue_object
Jun 25 13:07:00 netbox python3[2106]:     'data': serialize_for_webhook(instance),
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/netbox/extras/webhooks.py", line 27, in serialize_for_webhook
Jun 25 13:07:00 netbox python3[2106]:     return serializer.data
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/venv/lib/python3.10/site-packages/rest_framework/serializers.py", line 555, in data
Jun 25 13:07:00 netbox python3[2106]:     ret = super().data
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/venv/lib/python3.10/site-packages/rest_framework/serializers.py", line 253, in data
Jun 25 13:07:00 netbox python3[2106]:     self._data = self.to_representation(self.instance)
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/venv/lib/python3.10/site-packages/rest_framework/serializers.py", line 522, in to_representation
Jun 25 13:07:00 netbox python3[2106]:     ret[field.field_name] = field.to_representation(attribute)
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/venv/lib/python3.10/site-packages/rest_framework/serializers.py", line 686, in to_representation
Jun 25 13:07:00 netbox python3[2106]:     return [
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/query.py", line 394, in __iter__
Jun 25 13:07:00 netbox python3[2106]:     self._fetch_all()
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/query.py", line 1867, in _fetch_all
Jun 25 13:07:00 netbox python3[2106]:     self._result_cache = list(self._iterable_class(self))
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/query.py", line 87, in __iter__
Jun 25 13:07:00 netbox python3[2106]:     results = compiler.execute_sql(
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 1385, in execute_sql
Jun 25 13:07:00 netbox python3[2106]:     sql, params = self.as_sql()
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 593, in as_sql
Jun 25 13:07:00 netbox python3[2106]:     extra_select, order_by, group_by = self.pre_sql_setup()
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 71, in pre_sql_setup
Jun 25 13:07:00 netbox python3[2106]:     self.setup_query()
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 62, in setup_query
Jun 25 13:07:00 netbox python3[2106]:     self.select, self.klass_info, self.annotation_col_map = self.get_select()
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 294, in get_select
Jun 25 13:07:00 netbox python3[2106]:     sql, params = self.compile(col)
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 506, in compile
Jun 25 13:07:00 netbox python3[2106]:     sql, params = node.as_sql(self, self.connection)
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/expressions.py", line 1109, in as_sql
Jun 25 13:07:00 netbox python3[2106]:     sql = ".".join(map(compiler.quote_name_unless_alias, identifiers))
Jun 25 13:07:00 netbox python3[2106]:   File "/opt/netbox/venv/lib/python3.10/site-packages/rq/timeouts.py", line 63, in handle_death_penalty
Jun 25 13:07:00 netbox python3[2106]:     raise self._exception('Task exceeded maximum timeout value ' '({0} seconds)'.format(self._timeout))
Jun 25 13:07:00 netbox python3[2106]: rq.timeouts.JobTimeoutException: Task exceeded maximum timeout value (300 seconds)
Jun 25 13:07:00 netbox python3[2106]: ```
Jun 25 13:07:00 netbox python3[2106]: Exception raised during script execution: Task exceeded maximum timeout value (300 seconds)

Noticed this in the system logs after a bit of waiting, not sure if this helps at all.

dainok commented 1 year ago

You are describin that netdoc is copying files around the systems. That's true, NetDoc is updateing NetBox scripts and reports at every restart. I didn't found a better solution. BTW this is not causing any issue, and I don't see a specific log in your output.

Second, you have a timeout issue: Exception raised during script execution: Task exceeded maximum timeout value (300 seconds). I guess the ingest phase is exceeding 5 minutes (go to other -> jobs and confirm the name of the job). And I guess you have a lot of MAC addresses (macaddresstableentry_o)

You can:

See https://github.com/dainok/netdoc/wiki/FAQ

Lurick73 commented 1 year ago

Thanks! Not sure how I missed the FAQ. Adjusting the timeout and removing show mac and arp seems to have helped a ton!

dainok commented 1 year ago

I'm happy you solved!