Skip to main content
Solved

How to get the complete output of Show Command to a variable retrieved by a parser ?

  • October 14, 2021
  • 1 reply
  • 141 views

pradeep.gaddameedi
Forum|alt.badge.img

I would like to perform parsing programmatically. So, what I want is to get the complete output of a “show command”/”snmp query” to a parser variable. Please help. 

Best answer by Rakesh Mandava

I can see two ways to get this done. One way is with simple parser and the other one is with Advanced Parser.

 

1) Normal Parser with mregex as shown below. This method gives the total output of a show command into a variable as string.

 

2) Advanced Parser with "Script" Parsing method. Use _original_result in ParseText function as shown below. Define your variables and parse content into them. Then make a dictionary with interesting/desired values and return the dictionary.

 

 

Hope this is helpful to you !!

1 reply

Rakesh Mandava
Forum|alt.badge.img+1
  • Inspiring
  • 11 replies
  • Answer
  • October 14, 2021

I can see two ways to get this done. One way is with simple parser and the other one is with Advanced Parser.

 

1) Normal Parser with mregex as shown below. This method gives the total output of a show command into a variable as string.

 

2) Advanced Parser with "Script" Parsing method. Use _original_result in ParseText function as shown below. Define your variables and parse content into them. Then make a dictionary with interesting/desired values and return the dictionary.

 

 

Hope this is helpful to you !!