REST API description: Difference between revisions

no edit summary
No edit summary
Line 9: Line 9:
Example requests related to a specific module and statistics can be seen in the web interface by opening the browser development console (Ctrl+Shift+I for Chrome and Firefox, F12 for Edge).
Example requests related to a specific module and statistics can be seen in the web interface by opening the browser development console (Ctrl+Shift+I for Chrome and Firefox, F12 for Edge).


Here an example of the structured JSON data for the IP overview. This data has been extracted with the Google Chrome developer console while accessing the IP statsistics page.
Here an example of the structured JSON data for the IP overview. This data has been extracted with the Google Chrome developer console while accessing the IP statistics page.


[[File:Rest api chrome console.png|800px]]
[[File:Rest api chrome console.png|800px]]
Line 222: Line 222:
The following list parameters are possible:
The following list parameters are possible:


* sort: Sorting criteria for the list. Following criterias are supported for most lists:
* sort: Sorting criteria for the list. Following criteria's are supported for most lists:
** bytes: Received and transmitted bytes (either in selected time interval or since start of the Multimeter).
** bytes: Received and transmitted bytes (either in selected time interval or since start of the Multimeter).
** rxbytes: Received bytes.
** rxbytes: Received bytes.
Line 238: Line 238:
<pre>curl --silent -k -u USER:PASSWORD 'https://allegro-mm/API/stats/modules/ip/ips_paged?sort=bps&reverse=true&page=0&count=1' | jq .displayedItems[0].ip</pre>
<pre>curl --silent -k -u USER:PASSWORD 'https://allegro-mm/API/stats/modules/ip/ips_paged?sort=bps&reverse=true&page=0&count=1' | jq .displayedItems[0].ip</pre>


This exampe shows up to 9999 peers of a specific IP address:
This example shows up to 9999 peers of a specific IP address:


<pre>curl --silent -k -u USER:PASSWORD 'https://allegro-mm/API/stats/modules/ip/ips/10.1.2.3/peers?sort=bytes&reverse=true&page=0&count=9999&timespan=60&values=100' | jq '.displayedItems[].ip'</pre>
<pre>curl --silent -k -u USER:PASSWORD 'https://allegro-mm/API/stats/modules/ip/ips/10.1.2.3/peers?sort=bytes&reverse=true&page=0&count=9999&timespan=60&values=100' | jq '.displayedItems[].ip'</pre>
Line 255: Line 255:
* '''snapPacketLength''': The maximum size of a packet applied on Layer 2 without frame check sequence. If a packet is larger than this value, it is truncated. Use 65535 for unlimited size.
* '''snapPacketLength''': The maximum size of a packet applied on Layer 2 without frame check sequence. If a packet is larger than this value, it is truncated. Use 65535 for unlimited size.
* '''fromCaptureBuffer''': Whether to extract data from the packet ring buffer (= true) or just live traffic (= false).
* '''fromCaptureBuffer''': Whether to extract data from the packet ring buffer (= true) or just live traffic (= false).
* '''captureBufferSlotId''': In case a cluster packet ring buffer is used, the id of the ring buffer must be given. The id of the first ring buffer is 0. If this parameter is ommitted, 0 will be taken as default value.
* '''captureBufferSlotId''': In case a cluster packet ring buffer is used, the id of the ring buffer must be given. The id of the first ring buffer is 0. If this parameter is omitted, 0 will be taken as default value.
* '''captureToMedia''': Whether to store a pcap on an external storage device (= true) or download to your computer (= false).
* '''captureToMedia''': Whether to store a pcap on an external storage device (= true) or download to your computer (= false).
* '''mm-id''': If you are extracting a Pcap from a parallel Pcap analysis job or a multi device connected Allegro Network Multimeter, you have to specify the device and the slot where to get the data from. The syntax is: <code>mm-id=<device name>:<slot id></code>. If the capture shall be performed on the local device, the device name can be ommited (e.g. mm-id=:1 for the first replay slot on the local device).
* '''mm-id''': If you are extracting a Pcap from a parallel Pcap analysis job or a multi device connected Allegro Network Multimeter, you have to specify the device and the slot where to get the data from. The syntax is: <code>mm-id=<device name>:<slot id></code>. If the capture shall be performed on the local device, the device name can be omited (e.g. mm-id=:1 for the first replay slot on the local device).


Example to capture everything from now on:
Example to capture everything from now on:
Line 273: Line 273:
=== Pcap upload and analysis ===
=== Pcap upload and analysis ===


Pcap upload and analyis can also be done via API calls.
Pcap upload and analysis can also be done via API calls.


The PCAP upload is splitted into 3 commands. First, the replay is being initialized. Then the analysing is started. In the last step the PCAP is streamed to the Multimeter. Depending on the size of the PCAP the third step could take some time, but the Allegro already allows access to the statistics of the already analyzed packets via web/API.
The PCAP upload is split into 3 commands. First, the replay is being initialized. Then the analyzing is started. In the last step the PCAP is streamed to the Multimeter. Depending on the size of the PCAP the third step could take some time, but the Allegro already allows access to the statistics of the already analyzed packets via web/API.


The example assumes that PCAP parallel analysis is enabled in the global settings, so the PCAP analysis will be done in slot 1 and a dedicated ringbuffer is available.
The example assumes that PCAP parallel analysis is enabled in the global settings, so the PCAP analysis will be done in slot 1 and a dedicated ring buffer is available.


<pre>
<pre>
325

edits