Skip to main content

Is there some way to be able to execute CLI commands from the API and pull the files or output? It doesn’t seem there is a way to do it so I wanted to see if anyone has other methods that they have found that would work for this use case?

 

 

Hi @slodowic 

we are facing the same issue and we found a workaround but it is somewhat cumbersome. 

  1. Create a QAPP with your CLI command.
  2. Go to Domain Management - Scheduled Task - Scheduled QAPP and create a scheduled task with your QAPP.
  3. You can have it run on a schedule and export the results to a network share or have them send via EMAIL.

Carsten


@Carsten.Schmidt , it looks like this may be a possibility : Devices Management/Get Device Data API.md

From here you can pull the command data from NetBrain

 

 


Remember response Output is baseline (cache) data and you might need to add your specific CLI command into a benchmark task to start collecting the data for it!

If you ask for live execution for CLI command this can be done via our Triggered Automation Framework to trigger an NI that contains your command and the output could be parsed into API response.

Reach out to your assigned Automation Engineer or Sales Rep to get more help.


@Marco, can you explain how the data could be parsed into the API response? This is actually a surprising feature that I didn’t realize you could do. I have Trigger APIs, but I am not certain how to get the data out of it. I’d like to be able to pull a device’s mac address table for example, but I am not sure how to do this via the API.


@thelinuxfan , I am not sure I can be of any help. The idea is to trigger an Intent. This intent should execute your CLI command and you can put the CLI output as NI Status code that then can be retrieved via this API:
https://github.com/NetBrainAPI/NetBrain-REST-API-R11.1a/blob/main/REST%20APIs%20Documentation/TAF%20(Triggered%20Automation%20Framework)/3%20-%20Get%20Trigger%20Result%20API.md

And in case here is the full triggered automaton framework guide:
https://github.com/NetBrainAPI/NetBrain-REST-API-R11.1a/blob/main/REST%20APIs%20Documentation/TAF%20(Triggered%20Automation%20Framework)/TAF%20User%20Guide/TAF%20User%20Guide.md


Send me Email marco.speckert@netbraintech.com and I can find out how to better assist if there a still open questions


@thelinuxfan reading your request again… :-)

If you “just” want to receive NCT Data like MAC Table you could easier use this API to get your data:
https://github.com/NetBrainAPI/NetBrain-REST-API-R11.1a/blob/main/REST%20APIs%20Documentation/Devices%20Management/Get%20Device%20Data%20API.md


Reply