上一篇博文记录了《Ubuntu系统LNMP环境下安装配置zabbix3.04,这里我记录了添加监控主机,添加监控模板和自定义监控CPU

添加监控主机

1、监控主机安装zabbix-agent

$ sudo apt-get install zabbix-agent

wKioL1fOPVGgnwd9AAB9iM4fEJM242.png

2、修改zabbix_agent.conf配置文件

$ sudo vi /etc/zabbix/zabbix_agentd.conf

Server=120.40.*.* #zabbix-server端IP

ServerActive=Server=120.40.*.*  #zabbix-server端IP

Hostname= Cloud_platform001 #主动模式IP要一致

2、启动zabbix-agent服务

$ sudo service zabbix-agent start

wKiom1fOPWSimGQuAAALvvmZYmU680.png

3web平台配置

1)依次ConfigurationèHostsèCreate host

然后配置需要添加的服务器主机信息

wKioL1fOPXWREmXeAACmwFwNTsk076.png

 

2)选择监控方式,“Add”添加保存监控主机

wKioL1fOPcLiFnITAABnFhuq4lo860.png

3)成功添加监控主机

wKiom1fOPeKgcJmcAACExU4Ocw8585.png

添加监控模板

1、添加监控,可以在配置好监控主机信息后直接点击Templates,或可以在点击刚创建好的主机进行配置

wKiom1fOPgShPMLdAACTH7iwg_M038.png

2、单击Templates,“Select”选择监控模板,Add添加保存选择模板。

wKiom1fOPTOAgdRyAADkO6c_7xo495.png

3Add添加之后,update更新保存

wKiom1fOPj2QfTY1AACW02Y_OuI747.png

4、之后我们就可以看到

wKioL1fOPlChX0xYAACPsUeX3Co580.png

 

自定义监控项--监控CPU信息

1、服务端安装zabbix-get安装

Zabbix-Get 是Zabbix 中的一个程序,用于Zabbix-Server 到Zabbix-Agent 的数据获取,通常可以用来检测验证Agent 的配置是否正确。

root@zabbix-server:~# apt-get install zabbix-get

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following NEW packages will be installed:

  zabbix-get

0 upgraded, 1 newly installed, 0 to remove and 86 not upgraded.

Need to get 60.0 kB of archives.

After this operation, 184 kB of additional disk space will be used.

Get:1 http://repo.zabbix.com/zabbix/3.0/ubuntu/ trusty/main zabbix-get amd64 1:3.0.4-1+trusty [60.0 kB]

Fetched 60.0 kB in 0s (91.7 kB/s)

Selecting previously unselected package zabbix-get.

(Reading database ... 119881 files and directories currently installed.)

Preparing to unpack .../zabbix-get_1%3a3.0.4-1+trusty_amd64.deb ...

Unpacking zabbix-get (1:3.0.4-1+trusty) ...

Processing triggers for man-db (2.6.7.1-1ubuntu1) ...

Setting up zabbix-get (1:3.0.4-1+trusty) ...

2、验证AgentCPU信息(120.55.*.*改成你要监控的主机IP

root@zabbix-server:~# zabbix_get -s 120.55.*.* -k system.cpu.util[,user]

22.025549

root@zabbix-server:~# zabbix_get -s 120.55.*.* -k system.cpu.util[,system]

0.642738

root@zabbix-server:~# zabbix_get -s 120.55.*.* -k system.cpu.util[,idle]

77.281456

root@zabbix-server:~# zabbix_get -s 120.55.*.* -k system.cpu.util[,iowait]

3、创建对应的监控项

1)一次点击ConfigurationèHostsèGroup(选择监控主机所在的组)èItems

wKioL1fOPmLwVGo8AAChMAMbEdw168.png

2)创建Create Item

wKiom1fOPrvidT5XAADHD72qr0s300.png

3)配置监控项,监控CPU空闲率

wKiom1fOPt2QqZJHAACTFE9b77U668.png

 

 4)点击Add保存添加

wKioL1fOP9HCVdP_AABmDRmdPz0143.png

5)完成自定义监控项目

wKioL1fOQACTETDjAACcpwOe5Fg651.png

6)查看最新数据

wKiom1fOQA3TNKT_AAC8RRbxcEE245.png

7)同样的方式添加你需要监控的项

wKioL1fOQBzhRcsPAADmN6QJQVk040.png