zabbix之map拓扑标签中macro应用
请先预习网地图map : 请点击
macro官方文档介绍 : 请点击
1. Map labels(拓扑图标签)主要注意以下Macros(宏):
MACRO | DESCRIPTION |
{HOST.CONN} | IP or host DNS name, depending on host settings |
{HOST.DNS} | Host DNS name |
{HOST.HOST} | Host name |
{HOST.IP} | Host IP address |
{HOST.NAME} | Visible host name |
{host:key.func(param)} |
Simple macros, as used in trigger expressions. Only the avg, last, max and min functions, with seconds as parameter are supported in this macro in map labels. |
本文利用macros实现监控下map(最简单操作利用宏实现IP地址显示):
① 进入Configuration → Maps,点击Create map创建新拓扑图:
②根据Map labels支持的Macros,修改图片的标签Label( 本例子只使用{HOST.IP} )
2. Linux服务器Label示例:
1 Host:{HOST.NAME} 2 IP:{HOST.IP} 3 OS:{{HOST.HOST}:system.uname.last(0)} 4 CPU Load:{{HOST.HOST}:system.cpu.load[percpu,avg1].last(0)} 5 Free memory:{{HOST.HOST}:vm.memory.size[pavailable].last(0)} 6 Free Disk /:{{HOST.HOST}:vfs.fs.size[/,free].last(0)} 7 Free Disk /data:{{HOST.HOST}:vfs.fs.size[/data,free].last(0)} 8 Incoming network:{{HOST.HOST}:net.if.in[eth0].last(0)} 9 Outgoing network:{{HOST.HOST}:net.if.out[eth0].last(0)}
3. Windows服务器Label示例:
1 Host:{HOST.NAME} 2 IP:{HOST.IP} 3 OS:{{HOST.HOST}:system.uname.last(0)} 4 CPU Load:{{HOST.HOST}:system.cpu.load[percpu,avg1].last(0)} 5 Free memory:{{HOST.HOST}:vm.memory.size[pavailable].last(0)} 6 Free Disk C:{{HOST.HOST}:vfs.fs.size[C:,free].last(0)} 7 Free Disk D:{{HOST.HOST}:vfs.fs.size[D:,free].last(0)} 8 Incoming network:{{HOST.HOST}:net.if.in[Intel(R) 82574L Gigabit Network Connection].last(0)} 9 Outgoing network:{{HOST.HOST}:net.if.out[Intel(R) 82574L Gigabit Network Connection].last(0)}
注意: 对于{host:key.func(param)}这种类型的宏,主机上必须存在相应的监控项,才可以取到数据,否则会显示*UNKNOWN*
4. 同理在修改连接线的Label ,可以显示上下行网络流量。
1 Network 2 ↑ {Zabbix server:net.if.in[eth0].last(0)} 3 ↓ {Zabbix server:net.if.out[eth0].last(0)}