DX NetOps

 View Only
  • 1.  Event information via RESTful API

    Posted Jun 23, 2015 05:04 PM

    Does anyone know if event data on a landscape is available through the REST API?

     

    If not I would like to suggest it.

     

    We don't want to use another API (vnmsh) to process just event info.

     

    Ideally, we would like to specify the device name(s)/modelhandle/ip and then possibly a time range and then get all events for those devices.

    It would be great if you could create XML and specify what you wanted like you do with current REST calls.

     

    This way you could for example ask for specific event codes happening for devices in a specific container between x and y time.

     

    Is this currently possible?

     

    For now even something like the vnmsh show events would be great.

    It's just a pain to have to use 2 different API's. CA should really look at 'unifying' the API's and at least let everything be done with the REST API (as it is the more powerful and comprehensive one in my opinion).

     

    Thanks,

     

    Frank



  • 2.  Re: Event information via RESTful API

    Posted Jun 23, 2015 11:47 PM

    Hello Frank,

     

    Check thiss


    Try CLI which would use the RESTFUL interface instead of vnmsh

     

    You can run "curl -X POST -H "Content-Type: application/xml" -d @filter.xml -i --user YourUser:AndThePassword https://your-oneclick-server/spectrum/restful/alarms"

    and specify the filter and data you want to receive in a seperate file (e.g. filter.xml)

     

     

    The following POST-data lists you all the alarms for models with model-class pingable and prints out model_handle, model_name, AlarmTitle and the EventMsg.

    You can then use the data for further processing.

     

     

    1<?xml version="1.0" encoding="UTF-8"?> 2<rs:alarm-request 3 throttlesize="1024" 4 xmlns:rs="http://www.ca.com/spectrum/restful/schema/request" 5 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 6 xsi:schemaLocation="http://www.ca.com/spectrum/restful/schema/request ../../../xsd/Request.xsd "> 7 <rs:requested-attribute id="0x12b4c" /> 8 <rs:requested-attribute id="0x1296e" /> 9 <rs:requested-attribute id="0x11f53" />10 <rs:requested-attribute id="0x1006e" />11 <rs:target-models>12  <rs:models-search>13   <rs:search-criteria xmlns="http://www.ca.com/spectrum/restful/schema/filter">14    <filtered-models>15     <and>16      <equals>17       <attribute id="AttributeID.MODEL_CLASS">18        <value>12</value>19       </attribute>20      </equals>21     </and>22    </filtered-models>23   </rs:search-criteria>24  </rs:models-search>25 </rs:target-models>

     

    Hope this helps



  • 3.  Re: Event information via RESTful API

    Posted Jun 24, 2015 08:06 AM

    Hi Kothapalli,

     

    I know how to obtain information about alarms, but I'm specifically looking for event info (REST equivalent of './show events' using vnmsh).

     

    Regards,


    Frank



  • 4.  Re: Event information via RESTful API
    Best Answer

    Broadcom Employee
    Posted Jul 15, 2015 04:10 PM

    You cannot get events via the REST API, you can only create events. The SSORB API allow you to get events from SPECTRUM if you are looking to get events using an API.



  • 5.  RE: Re: Event information via RESTful API

    Posted Jul 11, 2019 01:25 AM
    can you please help me how to create an event via API as I am trying to create an event using post method using below API
    http://192.168.2.104/spectrum/restful/events/0x100059c/model/12
     But in body, I am getting Eventcreationfails 
     Regards


  • 6.  RE: Re: Event information via RESTful API

    Posted Jul 11, 2019 09:00 AM
    What is 12 here? Model_handle will be an hex code. Please check and try again. Select the device --> Attributes --> Model_handle --> Check the value of this attribute and use that.

    http://<hostname><:portnumber>/spectrum/restful/events/<eventType>/model/<model_handle>


    ------------------------------
    Thank you.
    Rajashekar
    ------------------------------



  • 7.  RE: Re: Event information via RESTful API

    Broadcom Employee
    Posted Sep 28, 2021 12:17 PM
    Edited by Donald Laberge Sep 29, 2021 08:59 AM

    Hello,

    I am trying to use that call:

    http://Your.OneClick.here:8080/spectrum/restful/events/0x6a50007/model/0x1004e37

    but it returns - a 405 ? 

    the CLI command expects an additional value - text= but works.

    ./create event type=0x6a50007 text=Custom_Event_update mh=0x1004e37


    Date Time                   Type             MHandle       MName              MTypeName
    09/28/2021 08:34:50 0x6a50007 0x1004e37   CISGateWay      Rtr_Cisco

    The call needs a small change to Work:

    /usr/bin/curl -X POST -u User:passwd http://localhost:8080/spectrum/restful/events/0x6a50007/model/{0}"

    Thank ,
          Don




  • 8.  Re: Event information via RESTful API

    Posted Jul 17, 2015 08:49 AM

    I run queries against the reporting MySQL database, mine is installed on the OneClick server.

     

    This example is searching for active alarms with a cause code of 18219057 (hex value 0x1160031) and "6008" in the event message.

     

     

    Select dm.model_name,

     

    e.event_msg,

     

    ai.set_time

     

    FROM reporting.alarminfo ai

     

    join reporting.event e

     

      on ai.orig_event_key = e.event_key

     

    join reporting.devicemodel dm

     

      on ai.model_key = dm.model_key

     

    where clear_time is null

     

    and cause = 18219057

     

    and e.event_msg like ''%6008%''