[comment]: # ({833f04d0-1da35dcd})
# 1 配置一台主机

[comment]: # ({/833f04d0-1da35dcd})

[comment]: # ({a71d6c20-50dffad5})
#### 概述

按照以下步骤在Zabbix前端创建一台主机：

-   进入：*配置 → 主机*
-   在右侧点击 *创建主机* (或者在主机名上编辑一台已有的主机)
-   在表单中输入主机的相关参数

你可以在已经存在的主机上使用 *Clone* 和 *Full clone*
按钮的形式创建一台新的主机，点击 *Clone*
将保留所有的主机参数和模板链接（保留这些模版中的所有实体），*Full clone*
将额外保留直接附加的实体（应用集、监控项、触发器、视图、底层自动发现规则和Web定制的场景）。

*注意*: 当主机被克隆时，它将保留最初在模板上的所有模板实体.
在现有主机级别上对这些实体所做的任何更改（例如更改的监控间隔、修改正则表达式或添加原型到底层发现规则）都不会克隆到新主机；相反，而是与最初模板一致。

[comment]: # ({/a71d6c20-50dffad5})

[comment]: # ({ae4e580b-17ff3076})
#### 配置

这个 **Host** 标签页包含了通用的主机属性：

![](../../../../assets/en/manual/config/host_a.png){width="600"}

所有必填输入字段都标有红色星号。

|属性                   描|<|
|----------------------------|-|
|*Host name*|输入一个唯一的主机名。允许有字母、空格、圆点、破折号和下划线。<br>*注意:* 由于 Zabbix agent 运行在你所配置的那台主机上，所以此 agent [配置文件](/zh/manual/appendix/config/zabbix_agentd) 的参数 *Hostname* 必须和这里输入的主机名是一致的。 在配置 [主动代理检查](/zh/manual/appendix/items/activepassive) 的过程中参数中的主机名也是需要的。|
|*Visible name*|显示名称。如果你设置了这个名称，它将会在列表、拓扑图等地方显示。此属性支持 UTF-8 。|
|*Groups*|选择主机所属主机组。一个主机必须至少属于一个主机组。通过添加不存在的组名，可以创建新组并将其链接到主机组。|
|*Interfaces*|主机支持多种主机接口类型: *Agent*, *SNMP*, *JMX* 和 *IPMI*.<br>要增加一个新接口，在 *Interfaces* 区域点击 *Add* 并输入 *IP/DNS*, *Connect to* 和 *Port* 信息。<br>*注意:* 用在任何监控项的接口都不能被删除，并且*Remove*链接是灰色的。<br>对 SNMP 接口使用 *Use bulk requests* 选项来为每个接口启用和禁用SNMP请求的 [批量处理](/zh/manual/config/items/itemtypes/snmp#internal_workings_of_bulk_processing)。|
|*IP address*|主机的IP地址（可选）。|
|*DNS name*|主机的DNS名称（可选）。|
|*Connect to*|点击对应的按钮告诉Zabbix服务器采用哪种模式从代理端获取数据:<br>**IP** - 连接到主机的IP地址（推荐）<br>**DNS** - 连接到主机的DNS名称|
|*Port*|TCP/UDP 端口. 默认端口：Zabbix agent 10050, SNMP agent 161 , JMX 12345 ， IPMI 623.|
|*Default*|选择单选按钮设置默认接口.|
|*Description*|填写主机描述。|
|*Monitored by proxy*|主机可以被Zabbix服务器或者Zabbix代理服务器监控:<br>**(no proxy)** - 主机被Zabbix服务器监控<br>**Proxy name** - 主机被Zabbix代理服务器“代理服务器名称”监控|
|*Enabled*|选中此项激活主机，准备接受监控。如果没选中，表示主机未激活，不能被监控。|

**Templates** 选项卡允许你将[templates](/zh/manual/config/templates)
链接到主机。所有实体（监控项, 触发器, 图表和应用集）将从模板继承。

要链接一个新模板，请开始在*Link new templates*
区域键入，直到匹配键入的模板列表出现。向下滚动选择你希望链接的模板。当所有的模板链接完成后，单击*Add*.

要取消链接模板，请使用*Linked templates*区域的两个选项之一:

-   *Unlink* - 取消链接模板，但保留它的监控项、触发器和图表
-   *Unlink and clear* - 取消链接模板并删除所有它的监控项、触发器和图表

列出的模板名可以点击跳转到模板配置表单。

**IPMI** 选项卡包含 IPMI 管理属性。

|参数                         描|<|
|----------------------------------|-|
|*Authentication algorithm*|选择认证算法。|
|*Privilege level*|选择权限级别。|
|*Username*|认证用户名。|
|*Password*|认证用户密码。|

**Macros** 选项卡允许你定义主机级别的
[用户宏](/zh/manual/config/macros/usermacros). 如果你选择了 *Inherited
和 host macros*
选项，你也可以在这里查看模板级的宏以及全局宏。那里是为主机定义全部用户宏的地方，用户宏显示解析的值以及来源。

![](../../../../assets/en/manual/config/host_d.png){width="600"}

为方便考虑，提供了相应模板和全局宏配置的链接。还可以在主机级别编辑一个模板/全局宏，有效地在主机上创建宏的副本。

**Host inventory** 选项卡允许你为主机手工输入 [资产](inventory)
信息。你还可以选择启用 *自动* 资产信息填充,
或者禁用此主机的资产信息填充。

**Encryption** 选项卡允许你要求 [加密](/zh/manual/encryption)
与主机建立连接。

|参数                      描|<|
|-------------------------------|-|
|*Connections to host*|Zabbix服务器或Zabbix代理服务器如何连接到主机上的Zabbix Agent：无加密（默认）；使用PSK（预共享密钥）或者证书。|
|*Connections from host*|从主机选择允许的连接类型（例如Zabbix agent和Zabbix Sender）。可以同时选择多种连接类型（对于测试及切换至其他连接类型时有帮助）。默认是“No encryption”。|
|*Issuer*|允许颁发证书。证书首先会通过CA（认证机构）认证。如果是有效的，则由CA签名，然后可以使用*Issuer*字段来进一步限制允许的CA。如果你的Zabbix安装使用多个CA证书，则该字段可以被重复使用。如果这个字段为空，那么任何CA都是可以被接受的。|
|*Subject*|允许的证书主题。证书首先通过CA验证。如果它是有效的，由CA签名，则*Subject*字段可以用于仅允许一个*Subject*字符串值。如果此字段为空，则接受由配置的CA签名的任何有效证书。|
|*PSK identity*|预共享密钥身份字符串.|
|*PSK*|预共享密钥（hex-string）。如果Zabbix使用GnuTLS或者OpenSSL库，最大长度：512位十六进制数，如果Zabbix使用mbed TLS（PolarSSL）库，则是64位十六进制（32字节PSK）。示例: 1f87b595725ac58dd977beef14b97461a7c1045b9a1c963065002c5473194952|

[comment]: # ({/ae4e580b-17ff3076})

[comment]: # ({9a16a7b0-6875b717})
#### 创建一个主机组

要在Zabbix页面创建一个主机组，请执行以下步骤:

-   进入: *Configuration → Host groups*
-   单击页面右上角的 *Create Group*
-   在表单中输入组的参数

![](../../../../assets/en/manual/config/host_group.png){width="600"}

所有必填输入字段都标有红色星号。

|参数                                   描|<|
|--------------------------------------------|-|
|*Group name*|输入唯一的主机组名称。<br>要创建一个嵌套的主机组，请使用 '/' 正斜杠分隔符，例如`Europe/Latvia/Riga/Zabbix servers`. 即使不存在这3个父主机组(`Europe/Latvia/Riga`) ，你也可以创建该组。在这种情况下，创建父主机组取决于使用者；它们不会自动创建。\\\\不允许有正斜杠、反斜杠及多个斜杠，不支持反斜杠转义'/'。<br>自Zabbix 3.2.0起，支持主机组的嵌套。|
|*Apply permissions to all subgroups*|复选框仅适用于Zabbix Super Admin用户，仅在编辑现有主机组时可用。\\\\选中此复选框并单击*Update*以对所有嵌套主机组应用相同级别的权限。对于可能已将[权限](/zh/manual/config/users_and_usergroups/usergroup#configuration)分配给嵌套主机组的用户组，将对嵌套组强制实施父主机组的权限级别。\\\\这是一次性选项，未保存在数据库中。\\\\自Zabbix 3.4.0起支持此选项。|

**嵌套主机组的权限**

-   当将子主机组创建到现有的父主机组时，该子主机组[用户组](/zh/manual/config/users_and_usergroups/usergroup)
    的权限将从父组级继承, (例如,如果`Riga` 已经存在，创建
    `Riga/Zabbix servers`)
-   将父主机组创建到现有的子主机组时，不会设置父级的权限 (例如,
    如果`Riga/Zabbix servers`已经存在，创建`Riga`)

[comment]: # ({/9a16a7b0-6875b717})

[comment]: # ({513311ca-513311ca})
##### Value mapping

The **Value mapping** tab allows to configure human-friendly
representation of item data in [value
mappings](/manual/config/items/mapping).

[comment]: # ({/513311ca-513311ca})

[comment]: # ({2b361a39-2b361a39})
#### Creating a host group

::: noteimportant
Only Super Admin users can create host groups.
:::

To create a host group in Zabbix frontend, do the following:

-   Go to: *Configuration → Host groups*
-   Click on *Create Group* in the upper right corner of the screen
-   Enter parameters of the group in the form

![](../../../../assets/en/manual/config/host_group.png)

All mandatory input fields are marked with a red asterisk.

|Parameter|Description|
|---------|-----------|
|*Group name*|Enter a unique host group name.<br>To create a nested host group, use the '/' forward slash separator, for example `Europe/Latvia/Riga/Zabbix servers`. You can create this group even if none of the three parent host groups (`Europe/Latvia/Riga`) exist. In this case creating these parent host groups is up to the user; they will not be created automatically.<br>Leading and trailing slashes, several slashes in a row are not allowed. Escaping of '/' is not supported.<br>Nested representation of host groups is supported since Zabbix 3.2.0.|
|*Apply permissions and tag filters to all subgroups*|Checkbox is available to Super Admin users only and only when editing an existing host group.<br>Mark this checkbox and click on *Update* to apply the same level of permissions/tag filters to all nested host groups. For user groups that may have had differing [permissions](/manual/config/users_and_usergroups/usergroup#configuration) assigned to nested host groups, the permission level of the parent host group will be enforced on the nested groups.<br>This is a one-time option that is not saved in the database.<br>This option is supported since Zabbix 3.4.0.|

**Permissions to nested host groups**

-   When creating a child host group to an existing parent host group,
    [user group](/manual/config/users_and_usergroups/usergroup)
    permissions to the child are inherited from the parent (for example,
    when creating `Riga/Zabbix servers` if `Riga` already exists)
-   When creating a parent host group to an existing child host group,
    no permissions to the parent are set (for example, when creating
    `Riga` if `Riga/Zabbix servers` already exists)

[comment]: # ({/2b361a39-2b361a39})
