zabbix入门到精通之Zabbix对linux主机的监控

咱们大概了解了怎么对台主机进行监控,主要步骤设计到添加主机,而且为主机添加监控项,这里主要为item,而后在item的基础上对item进行绘图而且经过screen的方式把不一样的监控图像汇总到一张screen上。经过对quick章节咱们认识到item监控项在zabbix中是很是重要的,而item的监控是经过key来定义的,key又分为系统预约义好的key和自定义的key组成,这一节,咱们经过对zabbix预约义的内存key来了解一下key究竟是怎么组成和怎么使用的。linux

Key
参数
类型
单位
举例
vm.memory.size[<mode>]
total (default), active,anon,
 buffers, cached, exec, file, free, inactive
 pinned, shared, wired, used, pused, available, pavailable
Numeric (unsigned)
Decimal
B
 vm.memory.size[total]
vm.memory.size[total]
vm.memory.size[total]
vm.memory.size[total]
system.swap.in[<device>,<type>]
Type:count, sectors pages
Numeric (unsigned)
Decimal
B
system.swap.in[,pages]
system.swap.out[<device>,<type>]
Type:count, sectors pages
Numeric (unsigned)
Decimal
B
system.swap.out[,pages]
上图为全部与内存相关的key已经与之相对应的参数,单位,例子等相关信息,下面我将经过一个例子来展现怎么添加一个合适的内存key而且填写与之对应的单位,返回值等信息在zabbix添加item项时。
 
例1:监控主机的总内存,剩余内存。

 

       经过图表和截图咱们能够很方便的看出来相关的对应关系。截图中的key:vm.memory.size[total] 中的对应图表中的key vm.memory.size[<mode>]而中括号中的mode这对应图表中的参数,这里为total,固然了你们也能够根据须要填写,好比监控内存以及使用的大小,这能够写成vm.memory.size[used] 。截图中的单位对应图表中的单位B,等等对应关系很容易看出来,这里就很少说了。而后你们按照quick章节中的实例为item绘图而后加入到screen里就能够了。ui

1.1 Zabbix对linux网卡的监控
Linux对网卡的监控的基本思路和监控其余linux项目没什么区别第一步添加linux主机,第二步为linux主机添加网卡相对应的item,任何在item的基础上绘制graph而后把graph集中添加到一张screen上方便集中展现。下面的图表为监控网卡流量用到的相关key。
Key
参数
类型
单位
举例
net.if.in[if,<mode>]
Bytes ,packets errors,dropped
Numeric (unsigned)
Decimal
Bps
net.if.in[eth0,errors]             net.if.in[eth0]
net.if.out[if,<mode>]
Bytes ,packets errors,dropped
Numeric (unsigned)
Decimal
Bps
net.if.out[eth0,errors]             net.if.out[eth0]
net.if.total[if,<mode>]
Bytes ,packets errors,dropped
Numeric (unsigned)
Decimal
Bps
net.if.total[eth0,errors]             net.if.total[eth0]
这里须要主要添加item的时候数据存储类型store value要选择为Delta(speed per second)
例1:对linux主机eth0网卡进口流量的监控item

 

例2:对linux主机eth0网卡出口流量的监控item

 

 

为linux主机eth0网卡的进出网卡绘图。

 

 

 

1.1 Zabbix对cpu的监控
相关key
Key
参数
类型
单位
举例
system.cpu.load[<cpu>,<mode>]
Cpu:all ,percpu
Avg1,avg5,avg15
Numeric (float)
system.cpu.load[,avg5]
system.cpu.num[<type>]
Online,max
Numeric (unsigned)
Decimal
system.cpu.num
system.cpu.switches
Numeric (float)
system.cpu.switches
system.cpu.util[<cpu>,<type>,<mode>]
Cpu:all,number
Type: idle, nice, user,iowait, interrupt, softirq, steal
Mode:avg1,av5,avg15
Numeric (float)
%
system.cpu.util[0,user,avg5]
 
例1:linux主机cpu的负载item

 

 

linux主机cpu利用率绘图

 

 

 

 

 

1.1 Zabbix对磁盘的监控
首先咱们添加主机,而且为主机添加一个item,而后在item上填写相关内容,其中key安装下面的格式来填写。
Key
参数
类型
单位
举例
vfs.fs.size[fs,<mode>]
fs:文件系统
mode:total(默认)
free,used,pfree,pused
Numeric (unsigned)
Decimal
B
%
vfs.fs.size[/tmp,free]
vfs.file.size[file]
文件路径
Numeric (unsigned)
Decimal
B
vfs.file.size[/var/log/syslog]
 
下图为监控/分区空间剩余大小的item截图。

 

 

 

为item绘图

 

 

效果图

 

1.1把监控的图像放入到一张screen中
建立screen:configureàscreenàcreate screen,这里建立了一张名为test,2行2列的screen。

 

建立后入下图所示:

 

    选择change后添加想要加入的graph,下图为添加内存图形(3.1中建立)到screen中,选中后双击保存按钮就行保存spa

 

依次双击change按钮添加上节 建立的4张graph图到名test的 screen中。

 

1.1 模板的建立
3.6.1建立模版
选择ConfigureàTemplatesàCreate template

 

输入建立模板的名字和所在的组,而后保存便可。这时你们会发现多了一个名为test_linux可是里面的数据位空的设计

 

 

3.6.2向模版里导入数据
选择往模版里导入的主机的item,而后选择copy select to后双击go按钮。以下图所示

                                                                                                                                                                      

 

 

选择要导入的模版,而后双击copy按钮便可,一样方法能够把graph数据也导入模版里。
3.6.3 模版的使用
建立主机时选择模版按钮后点击add按钮选择关联的模版便可,最后选择save按钮进行保存。

 

3.6.4模版的导入导出
3.6.4.1模版的导出
选择ConfigureàTemplates选择要导出的模版后,选择下方的Export selectd后双击go按钮,导出模版到想要保存的位置。

 

 

3.6.4.2模版的导入
选择ConfigureàTemplates-import后双击浏览按钮后选择要导入的模版,已经导入的模版类型后双击,Import便可。

 

 http://nanwangting.blog.51cto.com/608135/1118799blog

相关文章
相关标签/搜索