REST API description: Difference between revisions

Jump to navigation Jump to search
Line 205: Line 205:


This example extracts the amount of received and transmitted bytes for an IP address since the processing start of the Allegro. It queries via the REST API the JSON and then adds the values second value  ( row 1, rx bytes ) and 4th value ( row 3, tx bytes ) of the interval counters together.  
This example extracts the amount of received and transmitted bytes for an IP address since the processing start of the Allegro. It queries via the REST API the JSON and then adds the values second value  ( row 1, rx bytes ) and 4th value ( row 3, tx bytes ) of the interval counters together.  
<pre>
<pre>
$ curl --silent -k -u 'admin:allegro'  "https://allegro-mm/API/stats/modules/ip/ips/10.54.0.254" | jq '.interval[1] + .interval[3]'
$ curl --silent -k -u 'admin:allegro'  "https://allegro-mm/API/stats/modules/ip/ips/10.54.0.254" | jq '.interval[1] + .interval[3]'
7539471845
</pre>
</pre>


Line 220: Line 220:
<pre>
<pre>
$ curl --silent -k -u 'admin:allegro'  "https://allegro-mm/API/stats/modules/ip/ips/10.54.0.254?starttime=$(date --date="1 day ago" +%s)&endtime=$(date +%s)&skiphistorydata=true" | jq '.interval[1] + .interval[3]'
$ curl --silent -k -u 'admin:allegro'  "https://allegro-mm/API/stats/modules/ip/ips/10.54.0.254?starttime=$(date --date="1 day ago" +%s)&endtime=$(date +%s)&skiphistorydata=true" | jq '.interval[1] + .interval[3]'
216087873
</pre>
 
=== Virtual Link Groups ===
 
The Allegro REST API allows to access all link groups by the parameter '''group'''. The group index starts at zero, which is the default value. If a virtual link group is enabled.
 
This example extracts the traffic of the IP 10.54.0.254 from the second virtual link group ( index 1 ).
 
<pre>
$ curl --silent -k -u 'admin:allegro'  "https://allegro-mm/API/stats/modules/ip/ips/10.54.0.254?group=1" | jq '.interval[1] + .interval[3]'
</pre>
</pre>


404

edits

Navigation menu