上一個主題: 群組 Web 服務下一個主題: 站台群組管理的語法


群組 Web 服務範例語法

發出下列呼叫以查看群組 Web 服務的參數:

http://CA Performance Center 伺服器 IP 位址:8181/pc/center/webservice/groups

發出下列呼叫以查看支援的作業清單:

http://CA Performance Center 伺服器 IP 位址:8181/pc/center/rest/groups/documentation

若要取得 [群組] 樹狀結構中最高層群組 (預設值為 'All Groups') 之下的所有群組清單,您可以使用 groupPath 參數或 groupItemId 參數。

發出下列呼叫以使用 groupPath 參數來識別預設群組:

http://CA Performance Center 伺服器 IP 位址:8181/pc/center/webservice/groups/
groupPath/All%20Groups

附註:使用某些 REST 用戶端時,必要的語法為 ‘All Groups’ 而非 ‘All%20Groups’。 但一般而言,空格不適用於 URL。

發出下列呼叫以使用 groupItemId 參數來識別預設群組 (其 groupItemId 值為 1):

http://CA Performance Center 伺服器 IP 位址:8181/pc/center/webservice/
groups/groupItemId/1

子群組語法

若要取得您指定的群組下的所有子群組清單,兩個選項可供您使用:

發出下列呼叫以使用 groupPath 參數來識別子群組列在傳回的 XML 中的群組:

http://CA Performance Center 伺服器 IP 位址:8181/pc/center/webservice/
groups/groupPath/All%20Groups%2FInventory

發出下列呼叫以使用 groupItemId 參數來識別子群組列在傳回的 XML 中的群組:

附註:預設 'Inventory' 群組的 groupItemId 為 5。

http://CA Performance Center 伺服器 IP 位址:8181/pc/center/webservice/
groups/groupItemId/5

傳回的 XML 包含任何套用至該群組之群組規則的語法。 因此,我們建議在使用者介面中測試您建立的各種規則,以及檢查所產生的語法。

站台群組語法

POST 命令中的下列 XML 會建立站台群組 (使用新站台群組的所需值來取代範例值):

<GroupTree path="/All Groups">
   <Group name="East Coast USA" desc="This is a site group"
   inherit="true" type="site group" location="North America"
   bHourID="99990" timeZone="EST"/>
</GroupTree>
繼承

指出群組是否包含群組成員的子項目。 例如,如果 "inherit" 屬性已設為 true,裝置若已新增至群組,則裝置介面就是群組成員。

類型

指出群組的類型。 接受以下的值:

bHourID

(選用) 要與此站台群組產生關聯的營業時間定義內部指派識別碼。

timeZone

(選用) 要與此站台群組產生關聯的時區。 時區只能與站台群組產生關聯,不能與自訂群組產生關聯。

群組規則

除了規則運算式以外,群組規則還可支援多項比較。 例如,在 XML 中使用下列語法來張貼群組規則,該群組規則可新增名稱以 'Cisco' 這個字開頭的裝置:

<Match>
   <Compare readOnly="true" using="MEMBER_OF">
       <Property name="ItemID" type="device"/>
           <Value reference="/All Groups">1</Value>
   </Compare>
   <Compare readOnly="false" using="STARTS_WITH">
      <Property name="DisplayName" type="device"/>
           <Value>Cisco*</Value>
   </Compare>
</Match>

AllowDeletes

'allowDeletes' 參數必須設為 'true',才能刪除群組。 當您要刪除子群組時,請將此參數套用至容器群組。 例如,此 XML 可刪除下列子群組:All Groups\Texas\Austin:

<GroupTree path="/All Groups/Texas">
   Group name="USA" desc="Group to represent the entire
   United States" allowDeletes="true" type="custom group"/> 
</GroupTree>

對於群組路徑語法,正斜線字元適用於您張貼的 XML 文件。 此範例假設您已經有 “All Groups\Texas\Austin” 的群組結構:

<GroupTree inheritDefault="true" path="/All Groups/Texas/Austin">
    <Group desc="" inherit="true" location="" name="CA Office" type="custom group">
        <Group desc="" inherit="true" location="" name="Austin Lab" type="custom group"/>
    </Group>
    <Group desc="" inherit="true" location="" name="Austin Data Center" type="custom group"/>
</GroupTree>

不過,在 Web 服務要求的 URL 中,請對群組路徑使用反斜線字元。 瀏覽器會誤解正斜線。