DX NetOps

  • 1.  Spectrum REST API: Get alarms for devices that are down

    Posted Nov 19, 2015 03:39 PM

    Using the URL:

    http://myhost/spectrum/restful/alarms?attr=0x1006e&attr=0x129fa&attr=0x11ee8&attr=0x12d7f

     

    I am able to get all the alarms and the attributes I use to identify the models.  However, it would be useful to be able to filter down to just

    that alarm id that is for devices that are currently down (offline).  What is the best way to accomplish this?

     

    Is there a specific alarm ID that pertains to that condition?



  • 2.  Re: Spectrum REST API: Get alarms for devices that are down

    Posted Nov 20, 2015 03:50 PM

    The cause code for "Device Has Stopped Responding to Polls" is 0x10009

     

    So you could possibly use the POST alarms GET(tunneling) method

     

    http://oneclickserver/spectrum/restful/alarms

     

     

     

    <rs:alarm-request throttlesize="100"

      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 "
    >

     

        <!-- This xml can be posted to the Alarms URL to obtain

             attributes on the specified alarms

        -->

      <!-- Attributes of Interest --> 

      <rs:attribute-filter>

        <search-criteria xmlns="http://www.ca.com/spectrum/restful/schema/filter">

        <filtered-models>

          <equals>

            <attribute id="0x11f50">

              <value>0x10009</value>

            </attribute>

          </equals>

          </filtered-models>

        </search-criteria>

      </rs:attribute-filter>

      <!--  -->

        <rs:requested-attribute id="0x1006e" />

        <rs:requested-attribute id="0x129fa" />

        <rs:requested-attribute id="0x11ee8" />

        <rs:requested-attribute id="0x12d7f" />

    </rs:alarm-request>

     

    Greg

     

     

     



  • 3.  Re: Spectrum REST API: Get alarms for devices that are down

    Posted Jan 28, 2016 03:57 PM

    The beauty with the rest calls, is that even though the output you want is for alarms, you can apply device/model logic to the filter:

     

    e.g.:

     

    <?xml version="1.0" encoding="UTF-8"?>
    
    <rs:alarm-request throttlesize="1000"
      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:attribute-filter>
        <search-criteria
          xmlns="http://www.ca.com/spectrum/restful/schema/filter">
            <filtered-models>
              <and>
                <equals>
                  <attribute id="0x10004">
                    <value>0</value>
                  </attribute>
                </equals>
                <has-substring>
                  <attribute id="0x1006e">
                    <value>CUST</value>
                  </attribute>
                </has-substring>
              </and>
            </filtered-models>
        </search-criteria>
      </rs:attribute-filter>
    
      <rs:requested-attribute id="0x12b4c"/>
      <rs:requested-attribute id="0x1006e"/>
      <rs:requested-attribute id="0x129fa"/>
      <rs:requested-attribute id="0x11ee8"/>
      <rs:requested-attribute id="0x12d7f"/>
      <rs:requested-attribute id="0x11f9c"/>
    
    </rs:alarm-request>
    

     

    E.g. Here you can ask show all devices with the Contact Status (0x10004) of '0' (Lost) that have the words 'CUST' in the modelName (0x1006e').

     

    Also some attributes have 'special' data types, such as IP address - you can't query e.g. 'Network_Address' starts with '192.168.' because the values are stored in special format. Sometimes values are also stored using enumerations as in the example above where '0' means 'Lost', '1' means 'Established' and '2' means 'Initial'.