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

被折叠的 条评论
为什么被折叠?



