-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a report of software upgrade logs #2466
base: master
Are you sure you want to change the base?
Add a report of software upgrade logs #2466
Conversation
Kudos, SonarCloud Quality Gate passed! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2466 +/- ##
=======================================
Coverage 60.21% 60.21%
=======================================
Files 601 601
Lines 43981 43981
=======================================
Hits 26481 26481
Misses 17500 17500 ☔ View full report in Codecov by Sentry. |
Any pointers for the missing information? |
The old software version is saved in the varmap. Is there any way to access that? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine to me so far :)
The old software version is saved in the varmap. Is there any way to access that?
I can't recall what the attribute names are. Care to remind me? :)
https://github.com/johannaengland/nav/blob/master/python/nav/ipdevpoll/shadows/__init__.py#L304 |
I checked this out, and, unfortunately (as I suspected): varmap items aren't automatically copied over from An eventengine plugin needs to explicitly copy over variables that we want to keep a historic record of. Otherwise, they're just around for the eventq/alertq for alert profile filter and alert message template expansion. You can explicitly check the history of upgrade-type alert with something like this: SELECT
*
FROM
alerthistvar
WHERE
alerthistid IN (
SELECT
ah.alerthistid
FROM
alerthist ah
JOIN alerttype at USING (alerttypeid)
WHERE
alerttype ILIKE '%upgrade'
ORDER BY
start_time DESC
LIMIT 1);
An example of a plugin that copies over the varmap is this plugin (for maintenance events, see line 42 for the defining moment): nav/python/nav/eventengine/plugins/maintenancestate.py Lines 37 to 46 in bec0462
You can confirm this for maintenance events by re-using the above SQL: SELECT
*
FROM
alerthistvar
WHERE
alerthistid IN (
SELECT
ah.alerthistid
FROM
alerthist ah
JOIN alerttype at USING (alerttypeid)
WHERE
alerttype ILIKE '%maintenance'
ORDER BY
start_time DESC
LIMIT 1); So: I think we need a new eventengine plugin before this PR makes sense. Are you up to the task? :) |
I have checked this manually in combination with #2515 and it works as expected. Now only |
Kudos, SonarCloud Quality Gate passed! |
Kudos, SonarCloud Quality Gate passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is still going in the right direction :)
To add more information about entities, you need to join the netboxentity
table, which describes the internal entities in a device.
One silly detail may be that netboxentity
uses raw entPhysicalClass
values from ENTITY-MIB, and there is no translation table in the database, so you may need to translate the values back into strings in order for the sub-device listing to make sense (see the cisco_serials
report for a short example that only translates two of the possible values)
2d87f95
to
0f9f276
Compare
0f9f276
to
a9f14f2
Compare
Closes #2457.
Sub-device id/name and sub-device serial number are still missing.