Menu

SNMP API

SNMP monitoring data for all ESnet routers is available from the ESnet ESxSNMP server at http://graphite.es.net/snmp/west 

Graphs of this data are available at: https://graphite.es.net/

Here is info on accessing the data via the REST API.

All URLs are relative to the base url, e.g.: http://graphite.es.net/snmp/west/

/snmp/

returns a list of available devices

/snmp/DEVICE_NAME/

returns the avaiable sets for devices

/snmp/DEVICE_NAME/interface/

returns a list of interfaces and interface details for a specific device

/snmp/DEVICE_NAME/interface/INTERFACE_NAME/

returns details for a specific interface

/snmp/DEVICE_NAME/interface/INTERFACE_NAME/in
/snmp/DEVICE_NAME/interface/INTERFACE_NAME/out
/snmp/DEVICE_NAME/interface/INTERFACE_NAME/error/in
/snmp/DEVICE_NAME/interface/INTERFACE_NAME/error/out
/snmp/DEVICE_NAME/interface/INTERFACE_NAME/discard/in
/snmp/DEVICE_NAME/interface/INTERFACE_NAME/discard/out

returns counter data for a specific interface

You can get a time range by adding GET query parameters for 'begin' and 'end'.

For example, you can get the most recent 1 hour inbound bytes/second into nersc-tb1 100G interface (1/1/1) by doing:

curl 'http://graphite.es.net/snmp/west/nersc-tb1/interface/1_1_1/in'

To specify the begin/end times do:

curl 'http://graphite.es.net/snmp/west/nersc-tb1/interface/1_1_1/in?begin=1320524335&end=1320527935'

the begin and end are in seconds since the epoch, in this case: Sat Nov 5 15:18:55 CDT 2011 to Sat Nov 5 16:18:55 CDT 2011

(curl is just used to provide an example, you can just as easily use a library in your favorite language or a web browser.)

The query interface takes several arguments, all of which are optional:

  • begin -- expressed a seconds since the epoch
  • end -- expressed a seconds since the epoch
  • agg -- use a precomputed aggregate for data, defaults to highest available resolution
  • cf -- consolidation function. defaults to average
  • calc -- calculate an aggregate, see below for more details
  • calc_func -- see below

calc_func details

agg specifies which precomputed aggregate to use. Aggregates are represented as rates (eg. bytes/sec) and are calculated for the base rate at the time the data is persisted to disk. This is specified as the number of seconds in the aggregation period or as 'raw'. 'raw' returns the counter data as collected from the device without any processing. Currently there is only the aggreagate for the base polling interval and as a result this is rarely used. cf determines how data points are agreggated into a single datapoint. By default the data points are averaged but the maximum and minimum can also be used. valid options for this parameter are 'min', 'max' and 'average'. This applies to precomputed aggregates that are greater than the base polling frequency.

calc requests that the database dynamically generate an aggregate from the base aggregate for this counter. The parameter is set to the number of seconds to be used in the aggregation period. The function used to consolidate each group of data points into a single data in the aggregate is controlled by the calc_func parameter.

calc_func specifies the function to use when calculating an aggregate. It may be one of 'average', 'min', or 'max' and defaults to 'average.

For example, to use a calc_func of max:

curl 'http://graphite.es.net/snmp/west/nersc-tb1/interface/1_1_1/in?begin=1320524335&end=1320527935&calc_func=max&calc=300'

JSON format

An interface data JSON object has the following fields:

:param data: a list of tuples. each tuple is [timestamp, value]
:param begin_time: the requested begin_time
:param end_time: the requested end_time
:param agg: the requested aggregation period
:param cf: the requestion consolidation function

Example:

{"agg": "30",
"end_time": 1254350090,
"data": [[1254349980, 163.0],
[1254350010, 28.133333333333333],
[1254350040, 96.966666666666669],
[1254350070, 110.03333333333333]],
"cf": "average",
"begin_time": 1254350000}