- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Is there option to 'inspect' device configuration within Python script?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2021 07:04 AM
I was wondering, since NetMRI stores the running/saved configurations for devices, is there a way to programmatically 'inspect' the configuration in a Python script/job? I have noticed scripts that make use of 'show run' and 'include <xyz>' followed by RegEx, but it seems I shouldn't need to run the Cisco command, if I can read what MRI has stored to determine if a statement/block requires updating.
Any thoughts on this? Has anyone created a Python script to in essence read the NetMRI config database?
Thanks in advance for any direction/assistance.
Jim
Re: Is there option to 'inspect' device configuration within Python script?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2021 02:51 PM
There are multiple ways to skin this cat, like with most API usecases.
It really depends on what your goal is.
Check out $yourNetMRIinstance/api/3.6/data_collection_statuses/docs
This will give you a good idea on finding the device you are looking to parse the conf for, it will also allow you to check if the config you have is current.
For the conf itself that one is under $yourNetMRIinstance/api/3.6/config_revisions/docs
Note that /api/3.6/config_revisions/get_configs will not get you the config but tell NetMRI to fetch the latest config of the device.
If you know the ConfigRevisionID you can call /api/3.6/config_revisions/text
If you need to get the ConfigRevisionID you can get that from the index /api/3.6/config_revisions/index You can call this with a series of arguments to limit what is returned to you.
Re: Is there option to 'inspect' device configuration within Python script?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2021 10:12 AM
Ingmar, thanks for sharing a direction to look into. I appreciate your reply.