How to Pull CPU and Memory Utilization values for all devices using Spectrum REST API?
search cancel

How to Pull CPU and Memory Utilization values for all devices using Spectrum REST API?

book

Article ID: 219467

calendar_today

Updated On:

Products

CA Spectrum

Issue/Introduction

How to Pull CPU and Memory Utilization values for all devices using Spectrum REST API?

Environment

Release : 20.2.x, 21.2.x

Component : SPCAPP - Spectrum Applications

Resolution

We can use a POST (Get Tunneling) Request via Spectrum API to pull the CPU and Memory Utilization attributes for all devices.

The CPU and Memory Utilization values are stored in the following attributes for all devices models in which this applies:

NRM_DeviceCPUUtilization (0x12aaa)
NRM_DeviceMemoryUtilization (0x12ac6)

In this instance, the below would be the details of the request:

POST: http://<OneClick_Hostname>:<Port>/spectrum/restful/models

XML BODY:

<?xml version="1.0" encoding="UTF-8"?>
<!--


   CA Technologies, Inc.
   One CA Plaza
   Islandia, NY 11749 USA

   Copyright (c) 2012 CA Technologies, Inc.
   All rights reserved.

   IN NO EVENT SHALL CA TECHNOLOGIES INCORPORATED BE LIABLE FOR
   ANY INCIDENTAL, INDIRECT, SPECIAL, OR CONSEQUENTIAL DAMAGES
   WHATSOEVER (INCLUDING BUT NOT LIMITED TO LOST PROFITS) ARISING OUT
   OF OR RELATED TO THIS SOFTWARE, EVEN IF CA TECHNOLOGIES INCORPORATED
   HAS BEEN ADVISED OF, KNOWN, OR SHOULD HAVE KNOWN, THE POSSIBILITY OF
   SUCH DAMAGES.


-->

<rs:model-request throttlesize="10000"
  xmlns:rs="http://www.ca.com/spectrum/restful/schema/request"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.ca.com/spectrum/restful/schema/request ../../../xsd/Request.xsd ">


    <rs:target-models>
      <rs:models-search>
        <rs:search-criteria-file>
          topo/config/search-devices-criteria.xml
        </rs:search-criteria-file>
      </rs:models-search>
    </rs:target-models>


    <!-- These are the attributes of interest -->
    <rs:requested-attribute id="0x1006e" /> <!-- Model Name -->
    <rs:requested-attribute id="0x12d7f" /> <!-- Network Address -->
    <rs:requested-attribute id="0x12aaa" /> <!-- CPU Utilization -->
    <rs:requested-attribute id="0x12ac6" /> <!-- Memory Utilization-->
    
  </rs:model-request> 


NOTE: The values of these attributes are updated during each polling interval of the device. Spectrum does not keep a history of previous attribute values either, we will only be able to pull the current value.

Additional Information

This is outlined in more detail in the documentation linked below:

https://techdocs.broadcom.com/us/en/ca-enterprise-software/it-operations-management/spectrum/21-2/programming/web-services-api-reference/how-to-use-the-ca-spectrum-web-services-api/restful-resources-nouns/models.html