Reply

Is there option to 'inspect' device configuration within Python script?

Techie
Posts: 6
3041     0

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?

Adviser
Posts: 65
3042     0

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?

Techie
Posts: 6
3042     0

Ingmar, thanks for sharing a direction to look into.  I appreciate your reply.

Showing results for 
Search instead for 
Did you mean: 

Recommended for You