Wired Intelligent Edge

last person joined: an hour ago 

Bring performance and reliability to your network with the Aruba Core, Aggregation, and Access layer switches. Discuss the latest features and functionality of the ArubaOS-Switch and ArubaOS-CX devices, and find ways to improve security across your network to bring together a mobile first solution.

Count attribute on API calls always returns 0

This thread has been viewed 5 times
  • 1.  Count attribute on API calls always returns 0

    Posted Jul 24, 2021 08:21 AM
    Just starting my first attempts with the CX-OS API and I want to retrieve an attribute but as far as I can see I am doing exactly what the documentation tells me but it won't work.  If I request
    https://10.0.0.1/rest/v10.04/system/interfaces?attributes=statistics&depth=2

    {
      "1/1/1": {
        "statistics": {
          "dot1d_tp_port_in_frames": 28865608,
          "ethernet_stats_broadcast_packets": 1339058,
          "ethernet_stats_bytes": 266994044625,
          "ethernet_stats_packets": 213352850,
          "ethernet_stats_packets_1024_to_1518_bytes": 3770707,
          "ethernet_stats_packets_128_to_255_bytes": 1834360,
          "ethernet_stats_packets_1519_to_2047_bytes": 167761706,
          "ethernet_stats_packets_256_to_511_bytes": 2139537,
          "ethernet_stats_packets_512_to_1023_bytes": 4336370,
          "ethernet_stats_packets_64_bytes": 22,
          "ethernet_stats_packets_65_to_127_bytes": 33510148,
          "ethernet_stats_rx_no_errors": 28865608,
          "ethernet_stats_rx_packets_1024_to_1518_bytes": 3222,
          "ethernet_stats_rx_packets_128_to_255_bytes": 246039,
          "ethernet_stats_rx_packets_1519_to_2047_bytes": 20054,
          "ethernet_stats_rx_packets_256_to_511_bytes": 120100,
          "ethernet_stats_rx_packets_512_to_1023_bytes": 53330,
          "ethernet_stats_rx_packets_65_to_127_bytes": 28422863,
          "ethernet_stats_tx_no_errors": 184487242,
          "ethernet_stats_tx_packets_1024_to_1518_bytes": 3767485,
          "ethernet_stats_tx_packets_128_to_255_bytes": 1588321,
          "ethernet_stats_tx_packets_1519_to_2047_bytes": 167741652,
          "ethernet_stats_tx_packets_256_to_511_bytes": 2019437,
          "ethernet_stats_tx_packets_512_to_1023_bytes": 4283040,
          "ethernet_stats_tx_packets_64_bytes": 22,
          "ethernet_stats_tx_packets_65_to_127_bytes": 5087285,
          "fe_if_in_discard_packets": 56503,
          "if_hc_in_broadcast_packets": 959,
          "if_hc_in_bytes": 2094607097,
          "if_hc_in_multicast_packets": 61253,
          "if_hc_in_unicast_packets": 28803396,
          "if_hc_out_broadcast_packets": 1338099,
          "if_hc_out_bytes": 264899437528,
          "if_hc_out_multicast_packets": 3007473,
          "if_hc_out_unicast_packets": 180141670,
          "if_in_broadcast_packets": 959,
          "if_in_multicast_packets": 61253,
          "if_in_non_unicast_packets": 62212,
          "if_in_unicast_packets": 28803396,
          "if_out_broadcast_packets": 1338099,
          "if_out_multicast_packets": 3007473,
          "if_out_non_unicast_packets": 4345572,
          "if_out_unicast_packets": 180141670,
          "multicast": 3068726,
          "rx_bytes": 2094607097,
          "rx_jumbos": 20054,
          "rx_packets": 28865608,
          "total_jumbos": 167761706,
          "total_packets_no_errors": 213352850,
          "total_uc_packets": 208945066,
          "tx_bytes": 264899437528,
          "tx_jumbos": 167741652,
          "tx_packets": 184487242
        }
      },

    I get a list of all the interface stats and exactly as in the docs it says I can extract just one by adding it after a dot

    https://10.0.0.1/rest/v10.04/system/interfaces?attributes=statistics.rx_bytes&depth=2

    But that just returns
    {
      "1/1/1": {},
      "1/1/10": {},
      "1/1/11": {},
      "1/1/12": {},
      "1/1/13": {},
      "1/1/14": {},
      "1/1/15": {
        "statistics.rx_bytes": null
      },
      "1/1/16": {
        "statistics.rx_bytes": null
      },
      "1/1/17": {
        "statistics.rx_bytes": null
      },
    
    I have tried it with the v1 api, just one interface, varuious formats
    https://10.0.0.1/rest/v10.04/system/interfaces/1%2f1%2f1?attributes=statistics.rx_bytes
    https://10.0.0.1/rest/v10.04/system/interfaces/1%2f1%2f1?attributes=rx_bytes

    and even by copying the URI byte for byte from a known working aruba certified script which still doesn't work
    https://10.0.0.1/rest/v1/system/interfaces/*?attributes=statistics.tx_dropped&filter=type:system


    I have read and re-read the documentation and it even gives an example like my first attempt. 
    The resulting example URI to monitoring CPU utilization is the following:
    /rest/v1/system/subsystems?attributes=resource_utilization.cpu
    and I get the same thing:
    Error when calling GET: Invalid attribute resource_utilization.cpu.
    but
    /rest/v1/system/subsystems?attributes=resource_utilization
    works fine, returning all the attributes

    What's going on?

    ------------------------------
    David Rickard
    ------------------------------