CA Spectrum - Rest API - getting old alarms during poll
search cancel

CA Spectrum - Rest API - getting old alarms during poll

book

Article ID: 76431

calendar_today

Updated On:

Products

Spectrum

Issue/Introduction

In CA Spectrum how to get only new alarms using REST API?

Environment

Spectrum :: All Supported Versions

Resolution

1. Get the Subscription ID with filter and attribute list as part of subscription request, 

URL: http://<hostname><:portnumber>/spectrum/restful/subscription 

2. Make sure filter attribute also added including filter as below as part of request 

<rs:requested-attribute id="0x12a07" /> <!-- Cause Count --> 

3. Same Subscription should be added for future/next calls 

4. Attached tested xml file PullAlarmsSubscription.xml to case for reference 

<rs:alarm-request> 

<rs:attribute-filter> 
<search-criteria xmlns="http://www.ca.com/spectrum/restful/schema/filter"> 
<filtered-models> 
<equals> 
<attribute id="0x12a07"> 
<value>0</value> 
</attribute> 
</equals> 
</filtered-models> 
</search-criteria> 
</rs:attribute-filter> 

<rs:requested-attribute id="0x1006e" /> <!-- Model Name --> 
<rs:requested-attribute id="0x11f53" /> <!-- Model Handle --> 
<rs:requested-attribute id="0x11f56" /> <!-- Alarm Severity --> 
<rs:requested-attribute id="0x11f4e" /> <!-- Alarm Creation Date --> 
<rs:requested-attribute id="0x12b4c" /> <!-- Alarm Title --> 
<rs:requested-attribute id="0x1296e" /> <!-- Originating Event text --> 
<rs:requested-attribute id="0x12a07" /> <!-- Cause Count --> 
</rs:alarm-request> 

This is the Expected Output: 
-------------------- 
<added-instance preexisting="false"> 
<alarm id="5abfb429-f73c-1003-013e-0050568c7c38"> 
<attribute id="0x10000">Rtr_Cisco</attribute> 
<attribute id="0x12a07">0</attribute> 
<attribute id="0x11f56">3</attribute> 
<attribute id="0x12b4c">CHASSIS DOWN</attribute> 
<attribute id="0x11f9c">5abfb429-f73c-1003-013e-0050568c7c38</attribute> 
<attribute id="0x12a1f"></attribute> 
<attribute id="0x12d7f">xx.xx.xx.xx</attribute> 
<attribute id="0x1006e">name</attribute> 
<attribute id="0x11f4e">1522512937</attribute> 
<attribute id="0x1296e">The chassis name and all of its contained blades have stopped responding to polls and/or external requests. Additionally, all devices upstream from them can be contacted implying a chassis fault. A 'Chassis Down' alarm will be generated.</attribute> 
</alarm> 
</added-instance> 

Verify cause code attribute value, it should be zero ("0") as below, otherwise filter is not working. 
<attribute id="0x12a07">0</attribute> 

Please confirm, this can be easily tested from Browser (Postman - REST client) 

Please Note: Same Subscription ID should be used for all future/next REST GET calls as below 

http://<hostnumber><:portnumber>/spectrum/restful/subscription/<subscription_ID> 


pull-interval value in the request can be updated based on your requirement, this is basically "Subscription ID" expiration time in milliseconds. 
<rs:pull-interval>30000</rs:pull-interval> 

 Note: Same Subscription ID should be used for all future/next REST GET calls as below

http://<hostnumber><:portnumber>/spectrum/restful/subscription/<subscription_ID>

Additional Information

Please reference the "subscription" section of the documentation for more information.

restful-resources-nouns/subscription