前言

agent与snmp是Zabbix两种重要的监控方式,这一期主要介绍Zabbix Agent item监控项。。Zabbix agent分为主动代理、被动代理,配置item类型时,可以选择需要的类型:

Zabbix agent :用于被动检查

Zabbix agent(active):用户主动检查

 

 

1. 测试获取监控参数内容:

在Zabbix Server上使用zabbix_get命令可以从监控对象获取监控参数的具体内容。zabbix_get命令的具体使用方法如下:

zabbix_get  -s  目标服务器IP  -p  端口(10050)  -k  {key}

具体执行结果如下:

zabbix_get -s 192.168.3.166 -p 10050 -k system.boottime

2. 监控参数实际意义

2.1. 监控操作系统信息(OS)

system.boottime

# 系统启动的时间点(Host boot time)(单位:时间戳);API中参数history需指定为3;

system.uptime

# 系统已运行时长(System uptime)(单位:秒);API中参数history需指定为3;

system.localtime

# 系统时间(Host local time)(单位:时间戳);API中参数history需指定为3;

system.hostname

# 主机名(Host name);API中参数history需指定为1;

 

2.2. 网卡信息(Network interfaces)

对传输网卡信息进行监控查看等

net.if.out[br0]

# 网卡流速,流出方向;时间间隔60s;

# 获取指定网卡(br0)的流出流量的流速值(Outgoing network traffic on br0),br0为网卡名称,根据实际情况填写;时间间隔60s;

net.if.in[br0]

# 网卡流速,流入方向(单位:字节);

API中参数history需指定为3;下同;时间间隔60s;

# 获取指定网卡(br0)的流入流量的流速值(Incoming network traffic on br0),br0为网卡名称,根据实际情况填写;时间间隔60s;

 

2.3. 进程信息

proc.num[]# 目前系统中的进程总数(Number of processes);时间间隔60s;

proc.num[,,run]# 目前正在运行(处于运行态)的进程总数(Number of running processes);时间间隔60s;

 

2.4. CPU信息

合理的控制用户态、系统态、io等待时间可以保证进程高效率的运行。

系统态运行时间较高说明进程进行系统调用的次数比较多。一般的程序,如果系统态运行时间占用过高,就需要优化程序,减少系统调用。

io等待时间的比例过高,则表明硬盘的IO性能差,如果是读写文件比较频繁,读写效率要求比较高,可以考虑更换硬盘,或者使用多磁盘做Raid的方案。

system.cpu.switches

# CPU的进程上下文切换(Context switches per seconds),单位sps,表示每秒采样次数;API中参数history需指定为3;时间间隔60s;

system.cpu.intr

# CPU中断数量(Interrupts per second);

API中参数history需指定为3;

system.cpu.load[percpu,avg1]

# CPU每分钟的负载值,按照核数做平均值(Processor load (1 min average per core));API中参数history需指定为0;下同

system.cpu.load[percpu,avg5]

# CPU每5分钟的负载值,按照核数做平均值(Processor load (5 min average per core))

system.cpu.load[percpu,avg15]

# CPU每15分钟的负载值,按照核数做平均值(Processor load (15 min average per core))

system.cpu.util[,softirq]

# CPU的软中断时间,百分比形式(CPU softirq time);API中参数history需指定为0;下同

system.cpu.util[,steal]

# CPU的偷盗的时间,百分比形式(CPU steal time);

system.cpu.util[,idle]

# CPU的空闲时间,百分比形式(CPU idle time);API中参数history需指定为0;下同;时间间隔60s;

system.cpu.util[,user]

# CPU的用户态运行时间,百分比形式(CPU user time);时间间隔60s;

system.cpu.util[,system]

# CPU的系统态运行时间,百分比形式(CPU system time);时间间隔60s;

system.cpu.util[,iowait]

# CPU的io等待时间,百分比形式(CPU iowait time)

system.cpu.util[,interrupt]

# CPU的中断时间,百分比形式(CPU interrupt time)

system.cpu.util[,nice]

# CPU的nice时间,百分比形式(CPU nice time)

 

2.5. 内存信息

zabbix_get获取内存使用信息

system.swap.size[available]

# 物理内存目前可用的容量(Available memory)(单位:字节);API中参数history需指定为3;时间间隔60s;

system.swap.size[,total]

# swap分区的总容量(Total swap space);API中参数history需指定为3;时间间隔3600s;

system.swap.size[,free]

# swap分区尚可使用的容量(Free swap space);API中参数history需指定为3;时间间隔60s;

system.swap.size[,pfree]

# swap分区尚可使用的容量,百分比形式(Free swap space in %);API中参数history需指定为0;时间间隔60s;

vm.memory.size[total]

# 物理内存总量(Total memory)(单位:字节);API中参数history需指定为3;时间间隔3600s;

[if !supportLists]2.6. [endif]agent信息

agent.ping

# Agent的在线状态(Agent ping);API中参数history需指定为3;

agent.hostname

# Zabbix Agent的hostname(Host name of zabbix_agentd running);

agent.version

# Agent的软件版本号(Version of zabbix_agent(d) running)

以上就是这一期的内容。大家好,我是乐乐,专注运维技术研究与分享,关注我,学习更多Zabbix技术知识。如有Zabbix问题还可以到乐维社区提问留言,一起交流Zabbix技术心得。