创建

描述

object hostgroup.create(object/array hostGroups)

此方法允许创建新的主机组.

参数

(object/array) 创建主机组.该方法接受具有标准主机组属性的主机组.

返回值

(object)groupids属性下返回包含已创建主机组ID的对象.返回主机组ID的顺序与传入的主机组顺序一致.

示例

创建主机组

创建名为”Linux servers”的主机组.

请求:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "hostgroup.create",
  4. "params": {
  5. "name": "Linux servers"
  6. },
  7. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  8. "id": 1
  9. }

响应:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "groupids": [
  5. "107819"
  6. ]
  7. },
  8. "id": 1
  9. }

来源

CHostGroup::create() in frontends/php/include/classes/api/services/CHostGroup.php.