This section introduces how to create an API parser to extract key metrics from a Cisco ACI network.
1.Click the icon on the taskbar and select New Parser.
2.In the Device Type list, select a device type that the API parser applies to. By default, the All Device Types option is selected.
Tip: To filter the devices that the parser applies to, click Advanced Filter and define more criteria. See Advanced Filter for details.
3.In the Parser Type list, select API and further select Cisco ACI from the source type list.
4.Define the functions to retrieve data from devices. This step contains three functions. Define these functions step by step:
5.Click Retrieve and select a device to retrieve sample data.
6.Define the functions to parse key metrics from the retrieved data. This step contains two functions. Define these functions step by step:
No. |
Function Name |
Explanation |
1 |
Declare variable tree |
This function is to declare the metrics (variables) and their types that you want to parse from the retrieved device data, and generate a variable tree. The following parameters of a variable are defined: ▪name — the name of the variable ▪type — the value type of a variable. The type includes string, int, bool, double and table. This function is in the JSON format and a sample code is as follows: ''' |
2 |
def ParseText(original_result) |
This function is used to return the specific metric values and assign the values to corresponding variables in the variable tree. The following is a sample code of this function: import re |
7.Click Save on the upper right corner of the page. The parser will be saved in the Parser Library.