Events
内容
casp1032jp
内容
events リソースを使用して、イベントを作成します。
注:
events リソースは、単一のモデルまたはモデルのグループで動作します。- ベース URLhttp://<hostname><:portnumber>/spectrum/restful/events
POST event
POST event は新しいイベントを1つ作成します。
- URLhttp://<hostname><:portnumber>/spectrum/restful/events/<eventType>/model/<model_handle>[?varbind=<varbind id>][&val=<varbind value>]
- HTTP メソッドPOST
- ボディなし
- ボディ コンテンツ使用されません
- ヘッダapplication/xml、application/json
- エンコーディングUTF-8
- 出力モデルが作成できない場合に作成されたモデルまたはエラーのモデル ハンドルを一覧化する XML または JSON
URL パラメータ
- <eventType>作成されるイベント タイプを指定します。
- <model_handle>イベントを作成するモデル ハンドルを指定します。
- <varbind id>varbind id を指定します。
- <varbind value>varbind 値を指定します。
POST events
POST eventsを使用して、1 つ以上のモデルに 1 つ以上のイベントを作成できます。イベント要求を POST すると作成するイベントおよびイベントを作成するモデルを指定する XML ドキュメントを提供することができます。ドキュメントには、モデル ハンドル、XML 検索条件、または OneClick サーバ上の既存の検索条件への参照のリストが含まれています。
- URLhttp://<hostname><:portnumber>/spectrum/restful/events
- HTTP メソッドPOST
- ボディ例は <$SPECROOT>/RestfulExamples/xml/Events で提供されます。これらの XML ファイルでは、さまざまな目的のための適切に形成された XML の例を提供します。これらの例を基にして独自の XML を作成します。
- CreateEventByModelHandleList.xml
- CreateEventByModelSearch.xml
- CreateMultipleEventsByModelHandle.xml
- ボディ コンテンツapplication/xml
- ヘッダapplication/xml、application/json
- エンコーディングUTF-8
- 出力SpectroSERVER または分散 SpectroSERVER の要求入力を満たすモデルを一覧化する XML または JSON
例: 4 つの varbind で、すべての RTR_Cisco モデル タイプにイベント 0x10f06 を作成する
以下の例は、4 つの varbind で、すべての RTR_Cisco モデル タイプにイベント 0x10f06 を作成する例です。
- URL
以下の XML ボディを POST します。
http://<hostname><:portnumber>/spectrum/restful/events
- ボディ
<?xml version="1.0" encoding="UTF-8"?> <!--This sample event request will create an event of type 0x10f06 (generates a High Memory Utilization alarm) on all models found by the specified locater search (all models derived from RTR_Cisco) --> <rs:event-request throttlesize="10" 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:event> <rs:target-models> <rs:models-search> <rs:search-criteria xmlns="http://www.ca.com/spectrum/restful/schema/filter"> <filtered-models> <is-derived-from> <attribute id="AttributeID.MTYPE_HANDLE"> <value>0x21000c</value> <!-- RTR_Cisco --> </attribute> </is-derived-from> </filtered-models> </rs:search-criteria> </rs:models-search> </rs:target-models> <!-- event ID --> <rs:event-type id="0x10f06"/> <!-- attributes/varbinds --> <rs:varbind id="0">75</rs:varbind> <rs:varbind id="1">99</rs:varbind> <rs:varbind id="3">mem_instance</rs:varbind> <rs:varbind id="5">name</rs:varbind> </rs:event> </rs:event-request>
POST events (GET トンネリング)
この API は、モデル ハンドルのイベントを取得するのに使用されます。
注
: この API は、デバイス モデルでのみサポートされています。属性 | Description |
| イベントを取得するデバイス モデル ハンドルを指定します。 |
| エポック形式で開始時刻と終了時刻を指定します。 |
| サブコンポーネントのイベントを指定します。サブコンポーネント イベントが必要な場合は True に設定します。 |
| 除外されるイベントを指定します。イベントが複数ある場合、これらのイベントはカンマで区切られます。 |
| 要求された属性が、ユーザの基本設定に従ってカスタマイズできることを指定します。より少ない、または多くの属性を要求できます。 |
| 1 つのランドスケープのみがサポートされてます。 |
| 属性に既存の値がない場合、null 値属性が返されます。 |
- HTTP メソッドPOST
- 本文またはペイロードのサンプル<?xml version="1.0" encoding="UTF-8"?><rs:get-event-request throttlesize="10"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:get-events-filterstart-time="1522640184000"end-time="1522644324000"subcomponents-events="false"exclude-events="0x10005,0x10219,0x10706"/><rs:requested-attribute id="0x11f56"/> <!--Alarm Severity --><rs:requested-attribute id="0x11f4e"/> <!-- Created On --><rs:requested-attribute id="0x129fa"/> <!-- MODEL_HANDLE --><rs:requested-attribute id="0x1006e"/> <!-- Name --><rs:requested-attribute id="0x4820007"/> <!-- Event --><rs:requested-attribute id="0x11fb9"/> <!-- Created By --><rs:requested-attribute id="0x482001b"/> <!--Alarm Cleared On --><rs:requested-attribute id="0x482001c"/> <!--Alarm Cleared By --><rs:requested-attribute id="0x10000"/> <!-- Model type Name --><rs:requested-attribute id="0x11fb8"/> <!-- Event Type --><rs:requested-attribute id="0x12c0a"/> <!-- Event Precedence --><!-- Models of Interest --><rs:target-models><rs:model mh="0x800258"/><!--<rs:model mh="0x100934"/>--><!-- <rs:model mh="0x1000089"/>--></rs:target-models><rs:landscape id="0x800000" /></rs:get-event-request>
- 応答のサンプル<?xml version="1.0" encoding="UTF-8" standalone="yes"?><get-event-response-list xmlns="http://www.ca.com/spectrum/restful/schema/response" total-events="30" throttle="2"><get-event-responses><event id="5abe765b-e8a1-100c-0437-0050568c73e5"><attribute id="0x11f56">3</attribute><attribute id="0x11f4e">1522431579</attribute><attribute id="0x129fa">0x1009ae</attribute><attribute id="0x1006e">Cisco7606-96.37.37.ca.com</attribute><attribute id="0x4820007">Device Cisco7606-96.37.37.ca.com of type Rtr_Cisco has stopped responding to polls and/or external requests. An alarm will be generated.</attribute><attribute id="0x11fb9">System</attribute><attribute id="0x482001b">1522432925</attribute><attribute id="0x482001c">System</attribute><attribute id="0x10000">Rtr_Cisco</attribute><attribute id="0x11fb8">0x10d35</attribute><attribute id="0x12c0a">10</attribute></event><event id="5abe765b-e8a3-100c-0437-0050568c73e5"><attribute id="0x11f56">null</attribute> , null will be retuned if there is no value exists for the attribute<attribute id="0x11f4e">1522431579</attribute><attribute id="0x129fa">0x1009ae</attribute><attribute id="0x1006e">Cisco7606-96.37.37.ca.com</attribute><attribute id="0x4820007">Alarm number 845986 with probable cause id 0x10009 generated for device Cisco7606-96.37.37.ca.com of type Rtr_Cisco. The severity of this alarm is CRITICAL.</attribute><attribute id="0x11fb9">System</attribute><attribute id="0x482001b">null</attribute><attribute id="0x482001c">null</attribute><attribute id="0x10000">Rtr_Cisco</attribute><attribute id="0x11fb8">0x10701</attribute><attribute id="0x12c0a">10</attribute></event></get-event-responses><link type="application/xml" href="http://ocserver-portnumber/spectrum/restful/events/getEvents?id=cdf7caef-9c4a-4f28-9270-6b4b8e87feb6&start=2&throttlesize=2" rel="next"/></get-event-response-list>
- ボディ コンテンツapplication/xml、application
- ヘッダapplication/xml、application/json
- 出力各更新の成功または失敗を示す model-response の XML または JSON 形式の一覧。