404
edits
No edit summary |
|||
Line 181: | Line 181: | ||
} | } | ||
</pre> | </pre> | ||
== JSON Output Traffic counters == | |||
Traffic counters are represented as a JSON array with at least 4 lines. The structure is as follows: | |||
* line 1: received packets. | |||
* line 2: received bytes. | |||
* line 3: transmitted packets. | |||
* line 4: transmitted bytes. | |||
* other lines are module specific. | |||
The following counters are supported: | |||
* interval: Values of the selected time interval. If no interval is specified, this is similar to lastSecond. | |||
* allTime: Values since start of the Allegro Network Multimeter. | |||
* lastSecond: Values of the last second. | |||
* intervalPerSecond: Average per second value of the selected time interval. If no interval is specified, this is similar to lastSecond. | |||
This example extracts the received bytes of the last second of a specific IP. | |||
<code>curl --silent -k -u USER:PASSWORD 'https://allegro-mm-XXXX/API/stats/modules/ip/ips/10.1.2.3' | jq .lastSecond[1]</code> | |||
This example extracts received and transmitted bytes of the last second of a specific IP. | |||
<code>curl --silent -k -u USER:PASSWORD 'https://allegro-mm-XXXX/API/stats/modules/ip/ips/10.1.2.3' | jq '.lastSecond[1] + .lastSecond[3]'</code> | |||
== API parameters == | == API parameters == | ||
Line 186: | Line 210: | ||
The Allegro REST API has a number of query parameters that can be added to modify the request. By default, the API will display the real time counters since the last restart of the processing unit. | The Allegro REST API has a number of query parameters that can be added to modify the request. By default, the API will display the real time counters since the last restart of the processing unit. | ||
This example extracts the amount of received and transmitted bytes for an IP address since the processing start of the Allegro. | |||
<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]' | ||
Line 199: | Line 222: | ||
* timespan: Duration of the interval selection in seconds. | * timespan: Duration of the interval selection in seconds. | ||
This example extracts the amount of received and transmitted bytes for an IP address for the last 24 hours. | |||
<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)" | | $ 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)" | jq '.interval[1] + .interval[3]' | ||
216087873 | 216087873 | ||
</pre> | </pre> | ||
==== Extract received and transmitted bytes in a time interval (18/06/11 9:00 - 10:00) of a specific IP ==== | ==== Extract received and transmitted bytes in a time interval (18/06/11 9:00 - 10:00) of a specific IP ==== | ||
Line 228: | Line 243: | ||
<code>curl --silent -k -u USER:PASSWORD 'https://allegro-mm-XXXX/API/stats/modules/ip/ips/10.1.2.3' | jq</code> | <code>curl --silent -k -u USER:PASSWORD 'https://allegro-mm-XXXX/API/stats/modules/ip/ips/10.1.2.3' | jq</code> | ||
edits