zabbix 查询cpu负载和内存空闲,月度

本文介绍了一个使用Zabbix进行系统性能监控的方法,通过SQL查询展示如何收集和分析2018年11月的主机内存及CPU负载数据。具体包括:查询各主机的可用内存和自由内存的最小值、最大值及平均值;查询各主机的CPU负载1分钟平均值的最小值、最大值及平均值。此方法有助于理解系统资源使用情况。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

--查询月份内存空闲
select host,name,c.* into outfile '/tmp/availmemory.csv' fields terminated by ',' optionally enclosed by ' ' lines terminated by '\r\n' from hosts join (select hostid,min(b.value_min)/(102410241024),max(b.value_max)/(102410241024),avg(value_avg)/(102410241024) from items join (select * from trends_uint where itemid in (select itemid from items where name="Available memory" or name="Free memory") and date_format(FROM_UNIXTIME(clock),'%Y-%m')="2018-11") as b on items.itemid=b.itemid group by hostid) as c on hosts.hostid=c.hostid;

cpu load
select host,name,c.* into outfile '/tmp/cpuload.csv' fields terminated by ',' optionally enclosed by ' ' lines terminated by '\r\n' from hosts join (select hostid,min(b.value_min),max(b.value_max),avg(value_avg) from items join (select * from trends where itemid in (select itemid from items where name like "%1 min average per core%" or name="CPU Load") and date_format(FROM_UNIXTIME(clock),'%Y-%m')="2018-11") as b on items.itemid=b.itemid group by hostid) as c on hosts.hostid=c.hostid;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值