4.4 添加主機
添加主機(Hosts)的目的是對具體的設備進行監控,步驟為:依次單擊Configuration→Hosts→Create host按鈕,如圖4-10所示。填寫主機名(圖中標號④),選擇主機組為“Linux servers”(圖中標號⑤),填寫Agent的IP地址(圖中標號⑥),勾選“Enabled”(啟用)(圖中標號⑦),單擊Add按鈕(圖中標號⑧)進行添加。
在圖4-10中,添加主機的各參數說明如表4-1所示。
表4-1 添加主機的各參數說明
注意:如果要從主機中刪除模板,選擇“Unlink”,并不會清除已經添加的監控數據;而選擇“Unlink and clear”,則會刪除鏈接到主機的模板,并且會清除主機中的監控數據,如圖4-12所示。配置IPMI、Macros、Host inventory的方法與上相同,這里不再贅述。
在數據庫中,模板是存儲在hosts表中的。在MySQL中查看hosts表結構如下:
shell# mysql -uzabbix -pzabbix zabbix -e "show create table hosts\G"
*************************** 1. row ***************************
Table: hosts
Create Table: CREATE TABLE `hosts`(
`hostid` bigint(20)unsigned NOT NULL,
`proxy_hostid` bigint(20)unsigned DEFAULT NULL,
`host` varchar(128)NOT NULL DEFAULT '',
`status` int(11)NOT NULL DEFAULT '0',
`disable_until` int(11)NOT NULL DEFAULT '0',
`error` varchar(2048)NOT NULL DEFAULT '',
`available` int(11)NOT NULL DEFAULT '0',
`errors_from` int(11)NOT NULL DEFAULT '0',
`lastaccess` int(11)NOT NULL DEFAULT '0',
省略部分內容
`ipmi_available` int(11)NOT NULL DEFAULT '0',
`snmp_disable_until` int(11)NOT NULL DEFAULT '0',
`snmp_available` int(11)NOT NULL DEFAULT '0',
`maintenanceid` bigint(20)unsigned DEFAULT NULL,
`maintenance_status` int(11)NOT NULL DEFAULT '0',
`maintenance_type` int(11)NOT NULL DEFAULT '0',
`maintenance_from` int(11)NOT NULL DEFAULT '0',
`ipmi_errors_from` int(11)NOT NULL DEFAULT '0',
`snmp_errors_from` int(11)NOT NULL DEFAULT '0',
`ipmi_error` varchar(2048)NOT NULL DEFAULT '',
`snmp_error` varchar(2048)NOT NULL DEFAULT '',
`jmx_disable_until` int(11)NOT NULL DEFAULT '0',
`jmx_available` int(11)NOT NULL DEFAULT '0',
`jmx_errors_from` int(11)NOT NULL DEFAULT '0',
`jmx_error` varchar(2048)NOT NULL DEFAULT '',
`name` varchar(128)NOT NULL DEFAULT '',
`flags` int(11)NOT NULL DEFAULT '0',
`templateid` bigint(20)unsigned DEFAULT NULL,
`description` text NOT NULL,
省略部分內容
PRIMARY KEY(`hostid`),
省略部分內容
)ENGINE=InnoDB DEFAULT CHARSET=utf8